触发器问题!特别急!

jackzhang168 2004-04-30 04:13:28
Create or Replace Trigger T_updatesfc_qcmreceive after update on sfc_qcmreceive
for each row

Begin
UPDATE SFC_QCDRECEIVE
SET LINE_NO = :NEW.LINE_NO,
BAD_NO = :NEW.BAD_NO
WHERE FACT_NO = :OLD.FACT_NO AND DEPT_NO = :OLD.DEPT_NO
AND LINE_NO = :OLD.LINE_NO AND ITEM_NO = :OLD.ITEM_NO
AND BAD_NO = :OLD.BAD_NO AND REASON_NO = :OLD.REASON_NO
AND REC_DATE = :OLD.REC_DATE AND REC_TIME = :OLD.REC_TIME;
COMMIT;

UPDATE SFC_QCREASON
SET LINE_NO = :NEW.LINE_NO,
BAD_NO = :NEW.BAD_NO
WHERE FACT_NO = :OLD.FACT_NO AND DEPT_NO = :OLD.DEPT_NO
AND LINE_NO = :OLD.LINE_NO AND ITEM_NO = :OLD.ITEM_NO
AND BAD_NO = :OLD.BAD_NO AND REASON_NO = :OLD.REASON_NO
AND REC_DATE = :OLD.REC_DATE AND REC_TIME = :OLD.REC_TIME;
COMMIT;
End;


SQL> SHOW ERR;
Errors for TRIGGER T_UPDATESFC_QCMRECEIVE:

LINE/COL ERROR
-------- ---------------------------------------------
7/47 PLS-00049: bad bind variable 'OLD.REASON_NO'
16/47 PLS-00049: bad bind variable 'OLD.REASON_NO'
...全文
43 5 点赞 打赏 收藏 举报
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
jackzhang168 2004-04-30
OK
  • 打赏
  • 举报
回复
welyngj 2004-04-30
自己不可以触发自己的吧!
  • 打赏
  • 举报
回复
jackzhang168 2004-04-30
help me
  • 打赏
  • 举报
回复
jackzhang168 2004-04-30
Create or Replace Trigger T_updatesfc_qcmreceive after update on sfc_qcmreceive
for each row

Begin
UPDATE SFC_QCDRECEIVE
SET LINE_NO = :NEW.LINE_NO,
BAD_NO = :NEW.BAD_NO
WHERE FACT_NO = :OLD.FACT_NO AND DEPT_NO = :OLD.DEPT_NO
AND LINE_NO = :OLD.LINE_NO AND ITEM_NO = :OLD.ITEM_NO
AND BAD_NO = :OLD.BAD_NO AND REASON_NO = :OLD.REASON_NO
AND REC_DATE = :OLD.REC_DATE AND REC_TIME = :OLD.REC_TIME;
End;

Warning: Trigger created with compilation errors.

SQL> show err;
Errors for TRIGGER T_UPDATESFC_QCMRECEIVE:

LINE/COL ERROR
-------- -----------------------------------------------------------
7/47 PLS-00049: bad bind variable 'OLD.REASON_NO'
  • 打赏
  • 举报
回复
atao245993 2004-04-30
错误1,触发器中不能用COMMIT
错误2,AFTER UPDATA型触发器中又UPDATE了两次。OLD算哪个?
  • 打赏
  • 举报
回复
相关推荐
发帖
基础和管理
加入

1.7w+

社区成员

Oracle 基础和管理
申请成为版主
帖子事件
创建了帖子
2004-04-30 04:13
社区公告
暂无公告