Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    4

    Exclamation Unanswered: Any syntax instead for the "REFERENCING"

    I want to define a trigger in postgresql. But this one fail in "line 4" Is there any syntax instead for the "REFERENCING"

    ERROR: syntax error at or near "REFERENCING"
    LINE 4: REFERENCING NEW AS NEW OLD AS OLD
    ^
    ********** Error **********
    ERROR: syntax error at or near "REFERENCING"
    SQL state: 42601
    Character: 91



    CREATE TRIGGER TRG_IPG_BANK_ACCOUNT
    AFTER DELETE OR INSERT OR UPDATE
    ON IPG_BANK_ACCOUNT
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    TMPVAR NUMBER;

    BEGIN
    TMPVAR := 0;

    GET_NEXT_VALUE_OF('IPG_BANK_ACCOUNT_AUDIT_SEQ', TMPVAR) ;

    DBMS_OUTPUT.PUT_LINE('Value of IPG_BANK_ACCOUNT_AUDIT_SEQ =' || TMPVAR);

    BEGIN
    ...........
    ...........
    END;

    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('SQL ERROR MESSAGE =' || SQLERRM);
    RAISE_APPLICATION_ERROR (-20001,'ERROR ON TRIGGER TRG_IPG_BANK_ACCOUNT => ' || SQLERRM);
    END;

    I'm new to postgresql. Can anyone help me...
    Thanks

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Read the manual: PostgreSQL: Documentation: Manuals: PostgreSQL 8.4: Trigger Procedures

    The syntax (and concept) for triggers is totally different in Postgres compared to Oracle.

    Postgres does not have (or need) the "REFERENCING" clause. The new and old rows are always referred to as NEW and OLD

  3. #3
    Join Date
    Jul 2009
    Posts
    4
    Thanks for da reply.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •