Re: A Question

From: Mark D Powell <>
Date: Fri, 29 May 2009 07:27:25 -0700 (PDT)
Message-ID: <>

On May 29, 10:13 am, Wudong <> wrote:
> Dear All:
> I have a question on Oracle.
> Basically I have a file with each row is an ID to a row in the
> database. I need to retrieve all the rows with the ID in that file.
> What will be the best way to do that? I'm wondering if Oracle have a
> tool that could possibly help the process because I feel it's quite
> common task..:)
> many thanks.
> Wudong

There is not prewritten tool to join database contents to a file and extract the result, but you can easily use an external table and SQLPlus to do this. I am assumming that you want to extract the target rows out of the database.

Create an external table to represent the file then write a join of the external table to the target table and just spool the results to a file from your SQLPlus session.

An alternate approach is to use the utl_file package to read the file, then execute a query to get the matching rows, and use utl_file to write out the results.

Both approaches above require the file be copied to the database server so it can be accessed.

Pro*C or any other pro*language and java programs can also be written to perform this task and are your choices when the file cannot be copied to the database server.

HTH -- Mark D Powell -- Received on Fri May 29 2009 - 09:27:25 CDT

Original text of this message