Creating flat file from trigger/procedure
Posted in 2006
Topics: Triggers, Constraints & Referential Integrity, Versions, Editions & End-of-Life
Hi, I appologise if this has been asked before, but I cannot find it documented anywhere :( but... I have a query I need to run whenever there is insert or update to a database table (IDS 7.x) and I need to write the output to a flat file (for automatic transfer to another system). The file name needs to be auto generated based on a sequence number. Please can someone guide me as to how I can do this? Many thanks
On 4/30/06, FRANCES DAN.... <fran@pangvalley.co.uk> wrote: > I appologise if this has been asked before, but I cannot find it documented > anywhere :( > > but... > > I have a query I need to run whenever there is insert or update to a database > table (IDS 7.x) and I need to write the output to a flat file (for automatic > transfer to another system). The file name needs to be auto generated based on > a sequence number. > > Please can someone guide me as to how I can do this? It isn't a good idea, and the performance will, as they say, suck, but if you don't mind ignoring such issues, then, in some SPL: LET cmd = "echo " || val1 || "|" val2 || " >/tmp/whatnot/xyz." || seqno; SYSTEM cmd; Actually, I probably shouldn't point this out, but it is the most trivial way to do it - indeed, in 7.x, probably the only way to do it since you don't have UDRs and UDTs to help out. There are lots, and lots, and lots of gotchas not covered above - that you need to think about and work around before releasing the code into production. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2005.02 -- http://dbi.perl.org/
I'd suggest creating a staging table within the database in which you recorded the change. Then have an external program to extract the chan= ges and put them into the file. That way you minimize the impact to your existing apps. = "FRANCES DAN...." = <fran@pangvalley. = co.uk> = To Sent by: ids@iiug.org = ids-bounces@iiug. = cc org = Subj= ect Creating flat file from = 04/30/2006 02:47 trigger/procedure [6628] = AM = = = Please respond to = ids@iiug.org = = = Hi, I appologise if this has been asked before, but I cannot find it docume= nted anywhere :( but... I have a query I need to run whenever there is insert or update to a database table (IDS 7.x) and I need to write the output to a flat file (for automatic transfer to another system). The file name needs to be auto generated b= ased on a sequence number. Please can someone guide me as to how I can do this? Many thanks ***********************************************************************= ******** Forum Note: Use "Reply" to post a response in the discussion forum. =