Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    8

    Unanswered: 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.

  2. #2
    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

  3. #3
    Join Date
    Sep 2003
    Posts
    8
    Santos, you da man. I ll use that.

    Many thx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •