Re: Insert Trigger Question
Posted in 1998
Topics: Stored Procedures & SPL, Server Administration, Triggers, Constraints & Referential Integrity
What version of Informix do you use?
(I have Informix SE 7.2) You cannot reference the triggering table into
a create trigger statement. Maybe they solved this in later versions...
Florin Micle
<florinmicle@gsc-mbh.de>
Fred Prose wrote in message
<44C2247EAFF4D011B0BD00805F85B09C0A21D6BB@news.maricopa.gov>...
>I'm trying to create a trigger for a table insert. This trigger would call
>a stored procedure which should calculate the value to be stored in the
>column which makes up the primary key. The stored procedure accepts as an
>input parameter the table name (in quoted text.) The SP returns an integer
>value (which should be used as the key). The SP tests ok. For example,
>from DBACCESS, executing the command:
>
> execute procedure combo_key ("t_fred1");>
>returns a numeric value 1051 (which is what I want).
>
>The table (t_fred1) I'm attempting to trigger has columns:
>t_serial integer (this is the primary key)
>t_name character 20
>
>I wrote the trigger to look like:
>
>CREATE TRIGGER trigger_fred1 insert ON t_fred1> referencing new as new_rec
> for each row(execute procedure combo_key("t_fred1") into t_serial);
>
>Attempting to create the trigger I get the error message "Invalid use of
>column reference in trigger body"
>
>If I leave off the "into t_serial" I can create the trigger but when insert
>takes place, t_serial doesn't get updated.