CREATE or replace TRIGGER TG_DELETE_act_config AFTER DELETE ON ddt.act_config FOR EACH ROW declare sType varchar(10); sCode varchar(50); BEGIN select act_type,act_code into sType,sCode from deleted;--此处保证返回一条记录 if sType='ZW' then delete from user_act_step_0 where actcode=sCode; delete from user_act_step_1 where actcode=sCode; delete from user_act_step_2 where actcode=sCode; delete from user_act_step_3 where actcode=sCode; delete from user_act_step_4 where actcode=sCode; delete from user_act_step_5 where actcode=sCode; delete from user_act_step_6 where actcode=sCode; delete from user_act_step_7 where actcode=sCode; delete from user_act_step_8 where actcode=sCode; delete from user_act_step_9 where actcode=sCode; delete from user_article_info where actcode=sCode;
end if; END;
把你的注释单独放一行 select act_type,act_code into sType,sCode from deleted; --此处保证返回一条记录
CREATE or replace TRIGGER TG_DELETE_act_config AFTER DELETE ON ddt.act_config FOR EACH ROW BEGIN if :OLD.act_type='ZW' then delete from user_act_step_0 where actcode=:OLD.act_code; delete from user_act_step_1 where actcode=:OLD.act_code; delete from user_act_step_2 where actcode=:OLD.act_code; delete from user_act_step_3 where actcode=:OLD.act_code; delete from user_act_step_4 where actcode=:OLD.act_code; delete from user_act_step_5 where actcode=:OLD.act_code; delete from user_act_step_6 where actcode=:OLD.act_code; delete from user_act_step_7 where actcode=:OLD.act_code; delete from user_act_step_8 where actcode=:OLD.act_code; delete from user_act_step_9 where actcode=:OLD.act_code; delete from user_article_info where actcode=:OLD.act_code; end if; END; /
AFTER DELETE ON ddt.act_config
FOR EACH ROW
declare
sType varchar(10);
sCode varchar(50);
BEGIN
select act_type,act_code into sType,sCode from deleted;--此处保证返回一条记录
if sType='ZW' then
delete from user_act_step_0 where actcode=sCode;
delete from user_act_step_1 where actcode=sCode;
delete from user_act_step_2 where actcode=sCode;
delete from user_act_step_3 where actcode=sCode;
delete from user_act_step_4 where actcode=sCode;
delete from user_act_step_5 where actcode=sCode;
delete from user_act_step_6 where actcode=sCode;
delete from user_act_step_7 where actcode=sCode;
delete from user_act_step_8 where actcode=sCode;
delete from user_act_step_9 where actcode=sCode;
delete from user_article_info where actcode=sCode;
end if;
END;
select act_type,act_code into sType,sCode from deleted;
--此处保证返回一条记录
AFTER DELETE ON ddt.act_config
FOR EACH ROW
BEGIN
if :OLD.act_type='ZW' then
delete from user_act_step_0 where actcode=:OLD.act_code;
delete from user_act_step_1 where actcode=:OLD.act_code;
delete from user_act_step_2 where actcode=:OLD.act_code;
delete from user_act_step_3 where actcode=:OLD.act_code;
delete from user_act_step_4 where actcode=:OLD.act_code;
delete from user_act_step_5 where actcode=:OLD.act_code;
delete from user_act_step_6 where actcode=:OLD.act_code;
delete from user_act_step_7 where actcode=:OLD.act_code;
delete from user_act_step_8 where actcode=:OLD.act_code;
delete from user_act_step_9 where actcode=:OLD.act_code;
delete from user_article_info where actcode=:OLD.act_code;
end if;
END;
/