This is a discussion on RE: triggers within the Informix forums, part of the Database Server Software category; --> after the unload in your procedure add: system "cat update-file >>update-file.append" Regards, Bill > -----Original Message----- > From: owner-informix-list@iiug.org ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| after the unload in your procedure add: system "cat update-file >>update-file.append" Regards, Bill > -----Original Message----- > From: owner-informix-list@iiug.org [SMTP > On Behalf Of christrier > Sent: Tuesday, June 07, 2005 7:41 AM > To: informix-list@iiug.org > Subject: triggers > > I want to create some triggers for my database, one on-update trigger, > an on-insert trigger and an on-delete trigger. > I've already read the manual about how to create triggers. > > My problem is: I want to write the rows that are effected into a file > outside the database. > pseudocode: > on update unload TO 'update-file' select 'the updated row' > > I know that unload overrides the file, maybe it would be possible to > append everything in one file?! > > but i hope my problem is described clear enough?! > > greetings > chris > sending to informix-list |
| |||
| you mean it is possible to write it exactly like this: 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) system "cat file >> file.append" ); ? |
| ||||
| christrier wrote: > you mean it is possible to write it exactly like this: > 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) > system "cat file >> file.append" > ); > ? No - any trigger that tries to include UNLOAD is going to fail, as Art already said! If you want to do it, you'll probably need a C code UDR (not running on a CPU VP - but on a user-defined VP class) to do it. You could consider using a Java UDR instead - probably. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2005.01 -- http://dbi.perl.org/ |