Теория для лабораторной работы №4 - "PL/SQL – процедурное расширение языка SQL", страница 7

                          BEGIN

                            DELETE FROM emp

                                          WHERE emp.empno = remove_emp.empno;

                            tot_emps := tot_emps - 1;

                          END;

          PROCEDURE remove_dept(deptno NUMBER) IS

                         BEGIN

                            DELETE FROM dept

                                          WHERE dept.deptno = remove_dept.deptno;

                            tot_depts := tot_depts - 1;

                            SELECT COUNT(*)

                                          INTO tot_emps

                                          FROM emp;

                          /*В случае,если Oracle7 сотрёт служащих из таблицы EMP

                            для предписания целостности ссылочных ограничений, установите

                            значение переменной  TOT_EMPS в число

                            служащих в таблице EMP. */

                          END;

          PROCEDURE increase_sal(empno NUMBER, sal_incr NUMBER) IS

                                                         curr_sal NUMBER(7,2);

                          BEGIN

                            SELECT sal

                                          INTO curr_sal

                                          FROM emp

                                          WHERE emp.empno = increase_sal.empno;

                            IF curr_sal IS NULL

                            THEN RAISE no_sal;

                            ELSE

                                          UPDATE emp

                                            SET sal = sal + sal_incr

                                                          WHERE empno = empno;