Raise pay level : Utility Function « Stored Procedure Function « Oracle PL / SQL






Raise pay level

  
SQL>
SQL> SET ECHO ON
SQL>
SQL> CREATE OR REPLACE FUNCTION RAISE(
  2            p_paylevel INTEGER,
  3            p_payrate NUMBER)
  4       RETURN NUMBER IS
  5       v_newrate NUMBER;
  6  BEGIN
  7       IF p_paylevel = 1 THEN
  8            v_newrate := p_payrate * 1.10;
  9       ELSIF p_paylevel = 2 THEN
 10            v_newrate := p_payrate * 1.05;
 11       ELSIF p_paylevel = 3 THEN
 12            v_newrate := p_payrate * 1.04;
 13       ELSIF p_paylevel = 4 THEN
 14            v_newrate := p_payrate * 1.03;
 15  ELSIF p_paylevel = 5 THEN
 16            v_newrate := p_payrate ;
 17       ELSE
 18            v_newrate := p_payrate * 1.02;
 19       END IF;
 20       RETURN v_newrate;
 21  END RAISE;
 22  /

Function created.

SQL>
SQL>
SQL> select raise(2,3) from dual;
RAISE(2,3)
----------
      3.15

1 row selected.

SQL>
SQL> --

   
  








Related examples in the same category

1.Your own month add method
2.Raise power function
3.Validate date value format
4.Function to update null value
5.Function to count tab
6.Calculate average grade
7.Temperature package: convert Celsius to Fahrenheit back, forth