Re: insert trigger on table - SE7.2x
Posted in 1999
Peter
No, AFAIK, the trigger on a table will not work on itself.
One solution is to have a default attribute on the date column (default today),
which will get populated when the insert happens and if you do not specify the
date column in your insert list.
Other approaches involve calling a stored procedure which calls system to fire
of another routine which does the insert, or scheduling a batch job that will
periodically scan for null values in this table and update with the desired
data.
HTH
Sujit
Peter Wuyts <wuytsp@logica.com> on 09/13/99 11:45:44 AM
Please respond to Peter Wuyts <wuytsp@logica.com>
To: informix-list@iiug.org
cc: (bcc: Sujit Pal)
Subject: insert trigger on table - SE7.2x
Database triggers are a nice feature; but why won't it work on a simple
thing?
I have a table and a perform that contains the fields of this table,
I am trying to make an insert trigger that would fill one of the fields in
the records of this table with the date the record was inserted.
Then I get an error 747 which says:
747: Table or column matches object referenced in triggering statement.This error is returned when a triggered SQL statement acts on the triggering
table, or when both statements are updates, and the column that is updated
in the triggered action is the same as the column that the triggering
statement
updates.
Does this mean that I can no way put triggered actions on the SAME table as
the one that undergoes the triggering actions?
Anybody have a way around this?
Regards,
Peter Wuyts
PS: I know when using performs you do not need a trigger to do this (put
"noentry, noupdate, default=today, format=... " as attributes for the field
that should contain the insert-date), problem is that for some tables
records are inserted via ESQL/C-routines which means that I have to make
modifications to all these files in stead of simply(?) creating some
insert-triggers.