NVL2 function

NVL2 function:-
We can use this function to display the required text for the column when this column have null or having any value

Example:
select commission,nvl2(commission,'exists','not exists') details from employees;
Output:
COMMISSION  DETAILS
-------------------  -------------
                 400      EXISTS
                 1200    EXISTS
                             NOT EXISTS
                 150      EXISTS
                             NOT EXISTS

5 ROWS SELECTED

When the commission data is existing in that field then it displays exists text else it displays not exists text

No comments:

Post a Comment