Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL / SQL Variable
David Williams wrote:
> I am trying to write a SQL script that will access and read a text file
> (comma or tab separated values) and use the values from the text file as
> parameters or variables in my SQL code. For example:
>
> select part_no,
> sub_part_no,
> unit_measure,
> from inventory_part_table
> where part_no = '&Part_No'
>
> &Part_No is my variable. The code needs to use the text file for
> variable input. Any ideas and if so, what would the code look like.
>
> Thank you
>
> David
>
> --
> Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Look at the UTL_FILE built-in package.
Also look at DBMS_UTILITY.COMMA_TO_TABLE.
UTL_FILE can be used in a stored procedure to read the file. Then you can parse it manually or use the COMMA_TO_TABLE procedure.
Daniel Morgan Received on Tue May 07 2002 - 10:09:43 CDT