Welcome Guest ( Log In | Register )


 
 
 
 
 
 

 
 
Oracle 

Performance Tuning Reference poster
 
Oracle training in Linux 

commands
 
Oracle training Weblogic Book
 
Easy Oracle Jumpstart
 
Oracle training & performance tuning books
 
Burleson Consulting Remote DB Administration
 
 
 
Closed TopicStart new topic
> nvl2 function only , not nvl function, please understand my question
thiyagusham
post Mar 28 2012, 05:50 AM
Post #1


Advanced Member
***

Group: Members
Posts: 78
Joined: 16-March 12
From: Chennai from India
Member No.: 46,939



QUOTE (thiyagusham @ Mar 27 2012, 11:40 PM) *
SQL> select * from samp;


NAME DOJ QUAL EMPID
---------- --------------- ---------- -----

sam 21-mar-2012 mca
sony 03-jan-2000 mba 10610
maya 21-mar-2012 m.arch
sonna 18-mar-2012 mis

SQL> select name,doj,qual,empid,
2 nvl2('',doj,'new joinee')"RESULT" from samp;

NAME DOJ QUAL EMPID RESULT
---------- --------------- ---------- ----- - -------------
sam 21-mar-2012 mca new joinee
sony 03-jan- 2000 mba 10610 new joinee
maya 21-mar-2012 m.arch new joinee
sonna 18-mar-2012 mis new joinee

i want to display in result column 10610 in second row , because emp sony having id "10610 "
should i use sub-query ? without sub-query how can i display ????
thanks .

Go to the top of the page
 
+Quote Post
HAL9000
post Mar 28 2012, 12:59 PM
Post #2


Advanced Member
***

Group: Members
Posts: 880
Joined: 25-September 07
Member No.: 12,336



"2 nvl2('',doj,'new joinee')"RESULT" from samp;"

This is nonsense, you have no clew.

You are obviously not prepared to start learning Oracle.

It appears as if you have no skills in computer science whatsoever.

NVL ( expr1 , expr2 ): If expr1 is null, then NVL returns expr2. If expr1 is not null, then NVL returns expr1.

NVL2 ( expr1 , expr2 , expr3 ): If expr1 is null, then NVL2 returns expr3. If expr1 is not null, then NVL2 returns expr2

http://www.dba-oracle.com/t_nvl_vs_nvl2.htm
Go to the top of the page
 
+Quote Post
Florin Aparaschi...
post Mar 29 2012, 02:11 AM
Post #3


Advanced Member
***

Group: Members
Posts: 52
Joined: 7-February 08
From: Iasi, Romania
Member No.: 17,075



NVL2(empid, empid, 'new joinee')
Go to the top of the page
 
+Quote Post
thiyagusham
post Mar 29 2012, 04:56 PM
Post #4


Advanced Member
***

Group: Members
Posts: 78
Joined: 16-March 12
From: Chennai from India
Member No.: 46,939



QUOTE (HAL9000 @ Mar 28 2012, 12:59 PM) *
"2 nvl2('',doj,'new joinee')"RESULT" from samp;"

This is nonsense, you have no clew.

You are obviously not prepared to start learning Oracle.

It appears as if you have no skills in computer science whatsoever.

NVL ( expr1 , expr2 ): If expr1 is null, then NVL returns expr2. If expr1 is not null, then NVL returns expr1.

NVL2 ( expr1 , expr2 , expr3 ): If expr1 is null, then NVL2 returns expr3. If expr1 is not null, then NVL2 returns expr2

http://www.dba-oracle.com/t_nvl_vs_nvl2.htm



It is possible to display :

I didn't get from you clearly. i am not asking about nvl and nvl2 function characteristics.

need to dispaly emp in specific field using nvl2 function.

Try this query

SQL> select name, nvl2(empid,empid,'new_joinee') from samp;

NAME NVL2(EMPID
--------------- ----------
sam new_joinee
chris 10610
rose new_joinee
sona new_joinee
maya new_joinee

this is what i really expect.




Go to the top of the page
 
+Quote Post
burleson
post Mar 29 2012, 04:59 PM
Post #5


Advanced Member
***

Group: Members
Posts: 11,634
Joined: 26-January 04
Member No.: 13



>> This is what i really expect.

I would lower your expectations.

This is a DBA forum, and it is only for asking questions.

Do you have a question?

If you want Oracle support instead, you need to go here:

http://support.oracle.com

Good Luck!


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 31st October 2014 - 05:04 PM