在一个表上更新后插入触发器

时间:2017-07-13 10:29:39

标签: oracle triggers

create or replace trigger tgr_insertinworkdone
after update on workassgined
referencing new as new old as old
for each row
declare 
    workdonetemp number(15);
begin
    select max(workdoneid) into workdonetemp from workdone;
if :new.complete_status = 'T' 
then 
    insert into workdone(workdoneid,workid,workdatedate,type,status)
    values(workdonetemp+1,old.docid,old.taskdate,'C','Completed');
end if;
end;

获取错误或:此处不允许使用00984列。 在这里我试着在workdone表中插入一行基于完成标志Ture在workassgined表中,一旦这个标志变为'T',那么应该在workdonw表中插入一行。有什么帮助吗?

1 个答案:

答案 0 :(得分:0)

猜猜你在旧之前错过了冒号(:) 应该是

插入workdone(workdoneid,workid,workdatedate,type,status)     值(workdonetemp + 1,:old.docid,:old.taskdate, 'C', '完成');