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