If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > writing to a flat/txt file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-12-06, 20:55
java guy java guy is offline
Registered User
 
Join Date: Sep 2003
Posts: 8
writing to a flat/txt file

I am trying to find out if in DB2/AIX is possible to create a txt file and append to it once a new record is inserted into a table, from a trigger for instance. Are there any means by which DB2 allows file system manipulation, basically same operations as using a programming language (Java/C) I/O functions/methods.
Reply With Quote
  #2 (permalink)  
Old 04-13-06, 11:57
santosh2005 santosh2005 is offline
Registered User
 
Join Date: May 2005
Posts: 10
Yes you can do that by using combination of trigger and stored procedure or UDF. Create an UDF from C/C++ putline method. and call that function in the trigger. Like.......

CREATE TRIGGER JUNK_TRIG
AFTER INSERT ON JUNK
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
DECLARE v_text VARCHAR(1000);
SET v_text = 'asdjashdasd';
values(put_line( 'junk_file.txt', 'w', v_text));
END;

-Santosh
Reply With Quote
  #3 (permalink)  
Old 04-13-06, 13:07
java guy java guy is offline
Registered User
 
Join Date: Sep 2003
Posts: 8
Santos, you da man. I ll use that.

Many thx
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On