Friday, December 29, 2017

PL/SQL - Function

1. NVL FUNCTION:
  • The NVL function is used to replace NULL values with another value.
  • The NVL function replaces a NA value or an empty string with a string.
syntax:
       NVL( value_in, replace_with )
  • The NVL2 is an extended version of NVL. It takes three arguments.
syntax:
       NVL2(expression,value1,value2)


2. UID FUNCTIONS:
  • The UID function returns the id number for a user
syntax:
        UID

3. USERENV Function:
  • The USERENV function can be used to retrieve information about the current Oracle session.
syntax:
       usernev(parameter)

      select userenv('language')from dual;
      select userenv('sid')from dual;         
      select userenv('lang')from dual;

4. NULLIF Function:
  • NULLIF function compares expr1 and expr2.
  • If expr1 and expr2 are equal, the NULLIF function returns NULL. Otherwise, it returns expr1.
Syntax:
      NULLIF( expr1, expr2 )

       select nullif('suriya','suriya')from dual;
       select nullif('suriya','parithy')from dual; 

No comments:

Post a Comment