Luke14
Luke14

Reputation: 106

Create Insert Trigger PL/SQL

I have write a PL/SQL insert trigger but it doesn't compile properly but I don't see the problem.

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;

Upvotes: 0

Views: 173

Answers (1)

Srini V
Srini V

Reputation: 11375

Try this: You missed a ';' at the end of Insert statement

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;
/

Upvotes: 3

Related Questions