By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,156 Members | 1,004 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,156 IT Pros & Developers. It's quick & easy.

Trigger to create flat file for new row in table

P: n/a
kk
Hello,

Help! Does anyone have an example of a trigger that will export a
newly inserted row into a flat file? Basically anytime a row is
inserted into a specific table a flatfile (fixed width) should be
created in a hardcoded directory. I have the export command created
but it doesn't seem to work in a trigger. I am sort of a newb to DB2
(at least its more advanced functions). I have a project going 'live'
and I have no idea on how to do this. I had wanted to put it on the
task scheduler but that got shot down. If anyone has any suggestions
or better yet a sample of code I could modify I would be very
grateful.

Thank You,
Keith
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
kk <kk********@hotmail.com> wrote:
Hello,

Help! Does anyone have an example of a trigger that will export a
newly inserted row into a flat file? Basically anytime a row is
inserted into a specific table a flatfile (fixed width) should be
created in a hardcoded directory. I have the export command created
but it doesn't seem to work in a trigger. I am sort of a newb to DB2
(at least its more advanced functions). I have a project going 'live'
and I have no idea on how to do this. I had wanted to put it on the
task scheduler but that got shot down. If anyone has any suggestions
or better yet a sample of code I could modify I would be very
grateful.


Have a look here:

http://www-106.ibm.com/developerwork...303stolze.html

You can call the functions described in the article from a trigger. You can
also simply implement the functions in Java if you want to and if
performance is not that important.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #2

P: n/a
Remember to mark the UDF as EXTERNAL ACTION, otherwise DB2 will optimize
it away.

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.