当程序路径包含空格时,SQL*plus 无法正确标记其命令行参数
我通过以下命令行使用 SQL*Plus:
sqlplus user/pw@TNS @test.sql foo
test.sql
的内容如下:
SET VERIFY ON
DEFINE argone='&&1'
SELECT '&argone' FROM dual;
EXIT SQL.sqlcode
结果:
- 当 SQL*Plus 可执行文件位于
C:\Program Files\Oracle Client\whatever\ 中时sqlplus.exe
然后&&1
计算结果为Files\Oracle
。 - 当 SQL*Plus 可执行文件位于
C:\Oracle\Client\10.2.xx\bin
中时,&&1
的计算结果为foo
。
有没有人遇到过这个问题并且有办法规避它?
I am using SQL*Plus with the following command line:
sqlplus user/pw@TNS @test.sql foo
The contents of test.sql
follow:
SET VERIFY ON
DEFINE argone='&&1'
SELECT '&argone' FROM dual;
EXIT SQL.sqlcode
Results:
- When SQL*Plus executable is in
C:\Program Files\Oracle Client\whatever\sqlplus.exe
then&&1
evaluates toFiles\Oracle
. - When SQL*Plus executable is in
C:\Oracle\Client\10.2.xx\bin
then&&1
evaluates tofoo
.
Did anyone encounter this problem and had a way to circumvent it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在命令行和
define
语句中使用双引号来正确捕获带空格的参数。脚本:
命令行:
You'll need to use double quotes at both the command line and the
define
statement to properly capture the arguments with spaces.Script:
Command line: