If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Define a variable inside a trigger

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-09-11, 04:33
Kishore_228 Kishore_228 is offline
Registered User
 
Join Date: Nov 2011
Posts: 1
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
Reply With Quote
  #2 (permalink)  
Old 11-10-11, 05:34
begooden-it begooden-it is offline
Registered User
 
Join Date: Sep 2011
Location: Pont l'Abbé, Brittany, France
Posts: 183
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On