#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    Goi‚nia,GO,Brazil
    Posts
    17
    Rep Power
    0

    Ye unmerciful Gods! It doesn't recognize "inserting"


    I'm trying to create a trigger that starts like that:
    Code:
    SET TERM ^ ;
    
    CREATE TRIGGER TBFINANCEIRO_AUDIT FOR TBFINANCEIRO
       ACTIVE
       AFTER INSERT OR UPDATE OR DELETE 
       AS 
       BEGIN
    
      IF  ((USER<>'USISTEMACAL') OR (old.OPERACAO IN(0,3)) ) THEN
        IF INSERTING THEN 
              INSERT INTO TBFINANCEIRO_HISTORY(REF_ANOMES,ID_AUX,CDG_ORGAO,CDG_ORDEM,CDG_FUNCIONAL,
    							CDG_PROVDESC,FORMULA,PRAZO_INI,PRAZO_FIM,QUANTIDADE,
    							VALOR,OPERACAO,CALCULADO,OBSERVACAO,DTA_ATUALIZACAO,
    							ODM_ATUALIZACAO,USUARIO,DATA_HORA,ACAO)
               VALUES (new.REF_ANOMES,new.ID_AUX,new.CDG_ORGAO,
                      new.CDG_ORDEM, new.CDG_FUNCIONAL, new.CDG_PROVDESC,new.FORMULA,
                      new.PRAZO_INI,new.PRAZO_FIM,new.QUANTIDADE,new.VALOR,new.OPERACAO,
                      new.CALCULADO,new.OBSERVACAO,new.DTA_ATUALIZACAO,new.ODM_ATUALIZACAO,
                      USER,SYSDATE,'INSERT');
    ....
    and it goes on....
    it doesnt recognize "inserting"! It says "token unknown: inserting"!
    I'm using FB1.5 RC7

    I'm trying to compile it using IBOConsole.... the word doesn't even gets bold (like the others reserved words do).
    What's wrong???

    Thank you
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    250
    Rep Power
    14
    In an "IF" clause in Firebird, always use parenthesis:

    Code:
    IF (INSERTING)
    THEN ...
    The example given in the Firebird 1.5 release notes is:
    Code:
    IF (INSERTING OR DELETING)
    THEN ...
    Again, with parenthesis.
    Martijn Tonies
    Database Workbench: developer IDE for Firebird, MySQL, InterBase, MSSQL Server and Oracle
    Upscene Productions
    http://www.upscene.com
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    Goi‚nia,GO,Brazil
    Posts
    17
    Rep Power
    0
    I can't believe I'm such a moron. Thank you, O merciful upscene.

IMN logo majestic logo threadwatch logo seochat tools logo