Re: triggers
Posted in 2005
christrier wrote:
> maybe something like:
> CREATE TRIGGER before_trig
> INSERT ON table1 REFERENCING NEW AS new
> FOR EACH ROW
> (
> UNLOAD TO 'file' VALUES (new.col1, new.col2, new.col3, ...,
> new.coln)
> );>
> same for update and delete! Instead of unloading (and overriding) I
> would like to append everything to a file
First problem is that you cannot use UNLOAD in a trigger. UNLOAD is NOT an
SQL command but a dbaccess verb. It is ONLY implemented in the dbaccess
tool itself (and incidentally in the 4GL language) not in the IDS server.
The only viable solutions, if you have 9.xx+, would be either:
1- create a UDR that would write the data to the file and call it from the
triggers
- or -
2- use the VTI (Virtual Table Interface) to create a flat file as IDS table
interface so that the trigger could directly write to the file by inserting
to the pseudotable.
Art S. Kagel