如何使用Oracle PL SQL读取.sql/.txt文件?
请您告诉我如何使用PL SQL阅读/解析SQL或文本文件! Objectif是我有一个包含关键词的文件,我想要的是PL SQL的过程,该过程可以读取该文件,并且在发现关键字的时刻执行特定函数。
PS:我认为“ dbms_sql.parse”不是这种情况的解决方案!
感谢你 :)
Please can you tell me how can i read/parse an sql or text file with pl sql !
the objectif is that i have a file containing key words and all i want is procedure with pl sql that can read that file and at the moment where the keyword is found it execute a specific function.
Ps: i don't think that "DBMS_SQL.PARSE" is the solution for this situation !
Thank u :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有几个选项,其中有以下几种:
utl_file
内置软件包来读取文件内容这两个选项要求您可以访问A 目录,由特权用户创建和拥有的Oracle对象SYS,它将授予您(至少)
读取
特权(目录)。该目录指向包含文件的文件系统目录(文件夹);它通常位于数据库服务器上。如果您不是DBA(所以您不能自己做),那是一种缺点,并且没有DBA会为您做。还有另一个选项 - 您可以将文件存储在您自己的PC上本地 - 是命令提示实用程序,名为 sql loader 。您要编写一个所谓的控制文件,该文件指示Oracle在哪里以及如何存储文件数据(在模式中的表中)。 SQL*加载程序与任何Oracle数据库一起安装;如果您的PC上没有任何内容,请检查客户端软件。
一旦将数据加载到表中,就可以对其进行任何操作。
There are several options, some of which are the following:
UTL_FILE
built-in package to read file's contentsBoth options require you to have access to a directory, an Oracle object created and owned by a privileged user, SYS, which will grant you (at least)
read
privileges on it (the directory). That directory points to a filesystem directory (folder) which contains the file; it is usually located on the database server. That's kind of a drawback if you aren't a DBA (so you can't do it yourself) and there's no DBA who will do it for you.Yet another option - which lets you store the file locally, on your own PC - is the command prompt utility named SQL Loader. You'd write a so-called control file which instructs Oracle where and how to store file data (into a table in your schema). SQL*Loader is installed along with any Oracle database; if you don't have any on your PC, check the Client software.
Once you load data into the table, you can do whatever you want with it.