将文本文件中的输入转换为pl / sql脚本

时间:2016-07-07 11:53:38

标签: unix plsql

我有一个文本文件和一个PL / SQL脚本都存在于同一位置的同一个Unix服务器上。我想从文本文件中输入PL / SQL脚本。 文本文件内容:

a.txt
b.csv
c.ext

PL / SQL脚本:

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;
/

现在,我想将标志值带到shell脚本。 我希望现在更清楚了。请帮忙。

2 个答案:

答案 0 :(得分:1)

https://oracle-base.com/articles/9i/utl_file-random-access-of-files-9i 参考本教程。 将数据读入varchar2变量,然后在该文本数据中进行strin操作。

答案 1 :(得分:0)

利用外部表格。简而言之,您将创建一个数据库对象,使您可以像表格一样访问平面文件。请参阅此处以获取简介:http://allthingsoracle.com/external-tables-an-introduction/