oracle procedure ussing Host() command(使用 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)
这篇关于使用 Host() 命令的 oracle 程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 Host() 命令的 oracle 程序
基础教程推荐
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- oracle区分大小写的原因? 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 在多列上分布任意行 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
