Mega Code Archive

 
Categories / Oracle PLSQL / Char Functions
 

Use nvl in a function

SQL> SQL> create or replace function total_compensation(   2    p_salary number,   3    p_commission number ) return number   4  deterministic as   5  begin   6    return nvl(p_salary,0) + nvl(p_commission,0);   7  end total_compensation;   8  / Function created. SQL> SQL> select total_compensation(1,2) from dual; TOTAL_COMPENSATION(1,2) -----------------------                       3 SQL>