Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003

    Question Unanswered: Read from file one line at a time from DB2

    we are evaluating the possibility of migrating all of our Oracle databases to DB2 UDB, we need an easy way to migrate our procedures without rewriting all the codes. We are migrating Oracle to DB2UDB in Windows 2000.
    Our Oracle procedures reads a file one line at a time, treat the data, modify it and then insert it on a table or in another file. Then it reads the next line in the file, treats the data and so on...
    Oracle has a package named UTL_FILE that has several methods to tread files and permit us to read and write lines,one line at a time.

    Trying to migrate these procedures we downloaded the function os_calls UDF. The os_calls has two entries that allows reading from a file, but both of them reads the entire file and loads the data at a table or a clob.

    Is there a similar way in IBM DB2 to access files the way Oracle does that can help us to migrate our Oracle procedures that read files(one line at a time) with the minimum efforts?

    Thank You for your help,


  2. #2
    Join Date
    Jun 2003

    I don't known of any package in DB2 that would do this ...

    One way that I have siimilar jobs is to load/import the data from an intermediate table that consists of two columns: a generated primary key and a varchar that is big enought to hold the largest ligne in the input file.

    Once loaded in the table I used a stored procedure to process the data and insert its final table destination.

    Hope can help ...


    P.S. You might want to look at the IBM DB2 migration kit to Oracle:

Posting Permissions

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