Sunday, April 15, 2012

NVL2 function

The NVL2 function takes three arguments: NVL2 ( arg1, arg2, arg3 ) NVL2 returns arg3 if arg1 is NULL, and arg2 if arg1 is not NULL. The NVL function allows you to perform some value substitution for NULL values while the NVL2 function allows you to implement an IF..THEN...ELSE construct based on the nullity of data. For SQL Server we can uses the CASE statement. CASE WHEN arg1 IS NOT NULL THEN arg2 ELSE arg3 END this CASE statement will return arg3 if arg1 is NULL, and arg2 if arg1 is not NULL

No comments: