Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2011
    Posts
    1

    Unanswered: Define a variable inside a trigger

    Hi,

    I got the below error when I tried to run the below sql script to crate a trigger.

    Error during Prepare
    37000(-201)[Informix][Informix ODBC Driver][Informix]A syntax error has occured.

    Craeate Trigger script:
    Create Trigger bsidba.HR_EMP_RACE_I
    Insert on bsidba.hr_emp_race
    Referencing new as N
    For each row
    (

    DEFINE j INT;
    LET j = 10;

    );

    Please correct me to solve this problem.

    Thanks in Advance,
    Kishore

  2. #2
    Join Date
    Sep 2011
    Location
    Pont l'Abbé, Brittany, France
    Posts
    381
    Provided Answers: 1
    Hi,

    as far as I know, the only statements you are entitled to execute in an informix trigger are events declarations, SQL Statements or invokea stored procedure.

    I guess your code example is not real, because there is no point in using a trigger to define a variable an assign it a value. The purpose of a trigger is precisely to automatically trigger an SQL "edit" statement ( ie INSERT, UPDATE or DELETE ) fired by another SQL statement under certain conditions.

    If you want to use more elaborate code than a simple SQL statement, create the relevant stored procedure, and invoke it from the trigger code as "EXECUTE PROCEDURE yourprocedure(your parameters)"

    Best regards,
    Eric

Posting Permissions

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