DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: What is wrong with this code, getting ORA-920

  1. #1
    Join Date
    Aug 2001
    Posts
    11
    Code:
    CREATE OR REPLACE TRIGGER SDS_TRANS_FISCAL_YR_TRIG
     BEFORE INSERT
     ON SDS_TRANSACTION_TABLE
     FOR EACH ROW
     WHEN (:new.FISCAL_YEAR IS NULL)
    -- PL/SQL Block
    BEGIN
     IF TO_DATE(:new.transaction_date,'MON/DD/YYYY') > TO_DATE('AUG/31/'||TO_CHAR(sysdate,'YYYY'),'MON/DD/YYYY')  THEN
       :new.fiscal_year := 'FY'||SUBSTR(TO_CHAR(sysdate,'YYYY'),3)||'-'||SUBSTR(TO_CHAR(TO_NUMBER(TO_CHAR(sysdate,'YYYY'))+1),3);
     ELSE
       :new.fiscal_year := 'FY'||SUBSTR(TO_CHAR(TO_NUMBER(TO_CHAR(sysdate,'YYYY'))-1),3)||'-'||SUBSTR(TO_CHAR(sysdate,'YYYY'),3);
     END IF;
    
    END;

  2. #2
    Join Date
    Apr 2002
    Location
    Philippines
    Posts
    77
    MrT,

    Remove the colon on the NEW key word on the WHEN clause.

    Hth,
    skid

Posting Permissions

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


Click Here to Expand Forum to Full Width