我在Oracle下面运行创建触发器查询: -
SQL>CREATE OR REPLACE TRIGGER tU_DEDPARM_OEFix
AFTER INSERT OR UPDATE ON DED_PARM FOR EACH ROW
BEGIN
UPDATE DED_PARM SET
DED_PARM.OVRD_DED_AM = COALESCE(i.OVRD_DED_AM,0.00),
DED_PARM.OVRD_DED_PC = COALESCE(i.OVRD_DED_PC,0.00000)
FROM DED_PARM AS d INNER JOIN inserted AS i
ON (i.INTERNAL_EMPL_ID=d.INTERNAL_EMPL_ID AND
i.APPOINTMENT_ID=d.APPOINTMENT_ID AND
i.DEDTYP_CD=d.DEDTYP_CD AND
i.EFFECTIVE_DT=d.EFFECTIVE_DT)
END; /
执行查询后我面临以下错误: -
TRIGGER tU_DEDPARM_OEFix编译警告:执行完成 警告。
然后我运行以下查询以查看编译错误
SQL>显示TRIGGER TU_DEDPARM_OEFIX的错误错误;
以下是错误: -
5/3 PL / SQL:ORA-00933:SQL命令未正确结束2/3
PL / SQL:SQL语句忽略10/4 PLS-00103:遇到 期待以下之一时,符号“文件结束”:(如果循环mod为,则开始为goto声明结束异常退出 null pragma raise返回选择更新时使用 << 继续关闭当前删除获取锁定插入打开回滚 savepoint set sql execute commit forall merge pipe purge
有人可以帮我准备正确的查询。仅供参考 - 触发器已创建,但它是使用上面显示的编译错误创建的。
谢谢!
答案 0 :(得分:1)
这不是Oracle中更新的有效语法。我不确定MS {inserted
或:new
中:old
做了什么,但我认为这是该触发器的Oracle语句
CREATE OR REPLACE TRIGGER tU_DEDPARM_OEFix
AFTER INSERT OR UPDATE ON DED_PARM FOR EACH ROW
BEGIN
update DED_PARM d SET
OVRD_DED_AM = COALESCE(:new.OVRD_DED_AM,0),
OVRD_DED_PC = COALESCE(:new.OVRD_DED_PC,0)
where INTERNAL_EMPL_ID = :new.INTERNAL_EMPL_ID and
APPOINTMENT_ID = :new.APPOINTMENT_ID and
DEDTYP_CD = :new.DEDTYP_CD and
EFFECTIVE_DT = :new.EFFECTIVE_DT;
END;