473,396 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Trigger to create flat file for new row in table

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
2 3889
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Lauren Quantrell | last post by:
Is there a way to create a text file (such as a Windows Notepad file) by using a trigger on a table? What I want to do is to send a row of information to a table where the table: tblFileData has...
5
by: Dave Sisk | last post by:
Hey folks: I'm trying to do this: CREATE TRIGGER datawhse.emp_ti AFTER INSERT ON emp REFERENCING NEW AS n FOR EACH ROW MODE DB2ROW BEGIN DECLARE v_rrn DECIMAL(15,0);
0
by: Dave Sisk | last post by:
I've created a system or external trigger on an AS/400 file a.k.a DB2 table. (Note this is an external trigger defined with the ADDPFTRG CL command, not a SQL trigger defined with the CREATE...
0
by: JohnO | last post by:
Thanks to Serge and MarkB for recent tips and suggestions. Ive rolled together a few stored procedures to assist with creating audit triggers automagically. Hope someone finds this as useful as...
3
by: jazpar | last post by:
Hi I have a table - DebtorTurnover - consisting of 5 fields (ID, Date, Turnover, VAT, Netturnover). I get a file which I have to import every know and then, with new data. In this file I only...
0
by: wugon.net | last post by:
Hi , Anyone know how to monitor db2 trigger activity ? We suffer some trigger issue today and we try to monitor trigger's behavior use event monitor and db2audit, but both tools can not get...
9
by: Ots | last post by:
I'm using SQL 2000, which is integrated with a VB.NET 2003 app. I have an Audit trigger that logs changes to tables. I want to apply this trigger to many different tables. It's the same trigger,...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
0
by: raka61 | last post by:
Hi , I need help in understanding if i can directly(there are 100s of different structured files i get in text format with & hence dont wnat to manually define the structure for each file...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.