create or replace trigger set_class_by_dept after delete or update on dept for each rowbeginif deleting then delete from class where 院系= :old.deptname; elsif updating then
update class set 院系 = :new.deptname where trim(院系) = :old.deptname; end if; end;
or try: create or replace trigger set_class_by_dept after delete or update on dept for each rowbeginif deleting then delete from class where 院系= :old.deptname; elsif updating then
update class set 院系 = :new.deptname where trim(院系) = trim(:old.deptname); end if; end;
create or replace trigger set_class_by_dept before delete or update on dept for each rowbeginif deleting then delete from class where 院系= :old.deptname; elsif updating then update class set 院系 = :new.deptname where 院系 = :old.deptname; end if; end;
after delete or update on dept
for each rowbeginif deleting then
delete from class where
院系= :old.deptname;
elsif updating then
update class set 院系 = :new.deptname where trim(院系) = :old.deptname;
end if;
end;
create or replace trigger set_class_by_dept
after delete or update on dept
for each rowbeginif deleting then
delete from class where
院系= :old.deptname;
elsif updating then
update class set 院系 = :new.deptname where trim(院系) = trim(:old.deptname);
end if;
end;
before delete or update on dept
for each rowbeginif deleting then
delete from class where 院系= :old.deptname;
elsif updating then
update class set 院系 = :new.deptname where 院系 = :old.deptname;
end if;
end;