Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

difference between nvl and nvl2 in oracle

/*
NVL checks if first argument is null and returns second argument.

NVL2 has different logic. If first argument is not null 
then NVL2 returns second argument, but in other case it will 
return third argument.
*/

select nvl(null, 'arg2') from dual
-- Result: arg2;
select nvl2('arg1', 'arg2', 'arg3') from dual 
-- Result: arg2
select nvl2(null, 'arg2', 'arg3') from dual
-- Result: arg3
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #difference #nvl #oracle
ADD COMMENT
Topic
Name
6+9 =