CREATE TRIGGER:
Calling a Procedure in a Trigger Body: Example You could create the salary_check
trigger described in the preceding example by calling a procedure instead of providing the trigger body in a PL/SQL block. Assume you have defined a procedure check_sal
in the hr
schema, which verifies that an employee's salary is in an appropriate range. Then you could create the trigger salary_check
as follows:
CREATE TRIGGER salary_check
BEFORE INSERT OR UPDATE OF salary, job_id ON employees
FOR EACH ROW
WHEN (new.job_id <> 'AD_VP')
CALL check_sal(:new.job_id, :new.salary, :new.last_name)
No comments:
Post a Comment