使用 Host() 命令的 oracle 程序
我在 oracle 程序中使用 host()
命令时遇到问题.我写了很简单的oracle代码.
I am having a problem using host()
command in oracle procedure.
I have written very simple oracle code.
CREATE OR REPLACE PROCEDURE
run_command(command_i IN VARCHAR2)
IS
l_message VARCHAR2 (100);
BEGIN
l_message := 'cmd ' || command_i;
host(l_message);
END run_command;
当 host(l_message);
被消除时工作正常.
when host(l_message);
is eliminated works fine.
问题是什么,无论如何要创建一个使用 host()
的例程?
Whats the problem and is there anyway to create a routine which uses host()
?
推荐答案
HOST 命令仅在 SQL*Plus 中可用,在 PL/SQL 中不可用.
The HOST command is only available in SQL*Plus and not from PL/SQL.
您可以使用 Java 存储过程来调用调用 OS 命令.Oracle 发布了一个 2008 年关于从 PL/SQL 内部调用操作系统命令的白皮书,但还有很多其他内容(包括 Oracle Base,相当不错)
You can use Java stored procedure to call call OS commands. Oracle released a white paper on calling OS commands from within PL/SQL back in 2008 but there's plenty of other stuff out there (including Oracle Base, which is quite good)
相关文章