Total Pageviews

February 5, 2015

2/05/2015 10:11:00 AM

NVL


   The NVL function allows you to replace null values with a default value. If the value in the first parameter is null, the function returns the value in the second parameter. If the first parameter is any value other than null, it is returned unchanged.

  • NVL ( expr1 , expr2 ): If expr1 is null, then NVL returns expr2. If expr1 is not null, then NVL returns expr1.y is alternate value when n is NULL 

    NVL2

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

    Syntax
    The NVL2 function takes three arguments. The first argument (could also be an expression) is evaluated for NULL or NOT NULL. When this argument evaluates to NOT NULL, the second expression is returned. When the first argument evaluates to NULL then last (third) expression is returned.

    It works like this pseudo code:



    IF argument1 IS NOT NULL
       THEN
          argument2;
       ELSE
          argument3;
       END IF;


 
Related Posts Plugin for WordPress, Blogger...