GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Certification  >  Oracle  >  Oracle Developer
Go To First  |  Previous Question  |  Next Question 
 Oracle Developer  |  Question 18 of 23    Print  
what is the purpose of NVL2?

  
Total Answers and Comments: 5 Last Update: June 13, 2009     Asked by: Bvreddy 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 08, 2006 08:11:36   #1  
ajeet kumar        

RE: what is the purpose of NVL2?

We are using NVL2 for checking the multiple conding. NVL2(Exp1 Exp2 Exp3). If Exp1 is not null then funcion will return Exp2 else function will return Exp3.


 
Is this answer useful? Yes | No
July 21, 2006 00:45:12   #2  
Kathirvel R        

RE: what is the purpose of NVL2?

NVL :: We can use when we get the null values..THat is we can replace the null values using the NVL function.

EX : select nvl(sal 0) from emp

NVL2 :: we can check the field is null or not null then we give a value

EX :Select nvl2(sal sal+100 0) from emp

ie if sal is not null we add sal+100.if null we give 0


 
Is this answer useful? Yes | No
December 19, 2006 00:07:49   #3  
Amit Vashishtha        

RE: what is the purpose of NVL2?

NVL2 is a function which is used to deal with NULL values. NVL2 function examines the first expression. If the first expression is not NULL then NVL2 function returns the second expression. If the first expression is NULL then the third expression is returned. Syntax is NVL2(Commision sal*commision sal). Example below will clear all things-

Suppose we have a table which has fields-

Empno Ename Deptno sal Manager job hiredate and Commision. Commision field has NULL values. Now we want to replace null values with string 'NO Comm' and show Commision where it is then

Select Ename job sal NVL2(Commision sal*commision sal) Revised Salary from emp;

run it and check it.


 
Is this answer useful? Yes | No
December 24, 2007 14:10:16   #4  
mala321 Member Since: December 2007   Contribution: 6    

RE: what is the purpose of NVL2?
Hello


NVL2 function is used to substitute a value for an expression

NVL2(string value_if _not_null_value value_null_value)


if the string contains a null vlaue it is replaced with the 2 (Value_null_vale)
else it is substituted with the not_null_value

eg: a 34;
NVL2(a 999 NULL)

here a is substiuted with 999.


bye
mala

 
Is this answer useful? Yes | No
June 13, 2009 06:21:03   #5  
r.kothandaraman Member Since: January 2008   Contribution: 4    

RE: what is the purpose of NVL2?
We can set all the null value columns to some other values after that we can get all the corresponding rows and columns of the table.
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape