📅  最后修改于: 2022-03-11 14:57:10.531000             🧑  作者: Mango
create trigger branch_manager_trg
before insert or update on branch_manager
for each row
declare
dummy employee.employee_id%type;
begin
select e.employee_id
into dummy
from employee e
where e.employee_id = :new.manager_id
and e.branch_id = :new.branch_id
and e.emp_type = 'MANAGER';
exception
when no_data_found then
raise_application_error(-20000, 'Branch manager must be a MANAGER');
end;
/