菜鸟提问:一个触发器, 不知道哪儿错了?
说明:表源zginfo,被触发的表为jxhour,其共同的字段是zg_id,此触发器就是为了保证zg_id的数据的一致性
create or replace trigger trigger_jxks
after delete or insert or update on zginfo
for each row
begin
if deleting then
delete from jxhour
where jxhour.zg_id=:old.zg_id;
end if;
if inserting then
insert into jxhour(:old.zg_id) VALUES (:new.zg_id)
end if;
if updating then
update jxhour
set jxhour.zg_id =:new.zg_id
end if;
end;
------解决方案--------------------insert into jxhour(:old.zg_id)<====这里错
------解决方案--------------------恩,应该为
insert into jxhour(zg_id) VALUES (:new.zg_id)