创建插入触发器PL / SQL

时间:2013-11-29 13:08:39

标签: sql oracle plsql

我已经编写了一个PL / SQL插入触发器,但它没有正确编译,但我没有看到问题。

create or replace TRIGGER trg_NEWROW
BEFORE INSERT or UPDATE OF STATUS_ID ON application FOR EACH ROW
BEGIN
    INSERT INTO APPLICATION_HISTORY
      (APPLICATION_ID, STATUS_ID, DATE_OF_CHANGE)
    VALUES
      (1, 1, SYSDATE)  
END;

1 个答案:

答案 0 :(得分:3)

试试这个:你错过了';'在插入语句的末尾

CREATE OR REPLACE TRIGGER TRG_NEWROW
    BEFORE INSERT OR UPDATE OF STATUS_ID
    ON APPLICATION
    FOR EACH ROW
BEGIN
    INSERT INTO
          APPLICATION_HISTORY ( APPLICATION_ID,
                            STATUS_ID,
                            DATE_OF_CHANGE )
    VALUES
          ( 1,
            1,
            SYSDATE );
END;
/