从启动批处理文件的PL / SQL脚本(带参数) [英] Launch PL/SQL script from batch file (with arguments)

查看:3025
本文介绍了从启动批处理文件的PL / SQL脚本(带参数)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在strugling从Windows传递参数给PL / SQL脚本.bat文件。

I'm strugling at passing arguments to a PL/SQL script from a Windows .bat file.

下面是批处理文件的内容:

Here is the content of the batch file :

@echo off
set mName = "test"
exit | sqlplus <connection_string> @test.sql %mName%
pause

这是TEST.SQL的内容:

And here is the content of test.sql :

set verify off
set serveroutput on size unlimited
BEGIN
  DBMS_OUTPUT.PUT_LINE('&&1');
END;
/

我希望看到测试出现在外壳,而是,我得到以下信息:

I would expect to see "test" appearing in the shell but instead, I get the following message :

Enter value for 1:
SP2-0546: User requested Interrupt or EOF detected.

有没有人有办法解决这个问题?

Does anyone have a solution to this problem ?

推荐答案

在你的 = 标志删除空格。这是我的工作批处理文件:

Remove the spaces around your = sign. Here's my working batch file:

@echo off
set mName="test"
exit | sqlplus <connection_string> @test.sql %mName%
pause

另外请注意,您可以使用sqlplus中的 -L 选项批处理作业:

-L 尝试登录只有一次,而不是对再次提示错误。

-L Attempts to log on just once, instead of reprompting on error.

这篇关于从启动批处理文件的PL / SQL脚本(带参数)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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