使用 Host() 命令的 oracle 程序 [英] oracle procedure ussing Host() command

查看:35
本文介绍了使用 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 程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆