vartika dhupar
vartika dhupar

Reputation: 1

Take input from text file into a pl/sql script

I have a text file and a PL/SQL script both present in the same Unix server at same location. I want to take input from the text file into that PL/SQL script. Text File contents:

a.txt
b.csv
c.ext

PL/SQL script:

select status from table where file_name=''-- the file name should come from text file contents
if status ='REQUEST' then
delete from table where file_name ='' --  the same file which is mentioned above
else
if status ='SUCCESS' then
flag=0;
/

Now, I want to take the flag value to the shell script. I hope it is more clear now. Please help.

Upvotes: 0

Views: 2252

Answers (2)

Gary_W
Gary_W

Reputation: 10360

Make use of external tables. In a nutshell, you would create a database object that lets you access a flatfile like a table. See here for an introduction: http://allthingsoracle.com/external-tables-an-introduction/.

Upvotes: 0

Prashant Mishra
Prashant Mishra

Reputation: 647

https://oracle-base.com/articles/9i/utl_file-random-access-of-files-9i refer this tutorial. read the data into a varchar2 variable and then do strin manipulation in that text data.

Upvotes: 1

Related Questions