Oracle SQLPLUS - 如何在提示命令中连接变量?
例如,在脚本的开头,我从用户那里获取输入:
Prompt "Type the path where the script will be saved: "
spool '&&PATH\tmp_script.sql'
好的,最后我想留下一些类似的消息:
Prompt
prompt End of commands.
prompt
prompt Execute: @&PATHtmp_script.sql to execute the generated script.
prompt
但是 sqlplus 不明白我正在尝试将 &PATH 与 tmp_script.sql 连接起来。我尝试过 scape \
,但不适用于提示命令。
For example, in the beggining of script I get the input from user:
Prompt "Type the path where the script will be saved: "
spool '&&PATH\tmp_script.sql'
ok, at the end I want to leave some message like it:
Prompt
prompt End of commands.
prompt
prompt Execute: @&PATHtmp_script.sql to execute the generated script.
prompt
But the sqlplus don't undestand I am trying to concatenate &PATH with tmp_script.sql. I've tried the scape \
, but don't work on prompt command.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这不是两个&符号吗?
Isn't that two ampersands?
替换变量可以用点终止。
给出
Substitution variables can be terminated with a dot.
gives
我找到了解决方案。其实我已经差不多了,需要使用
\
,但是在我们需要使用set escape on
命令将\作为转义之前,你可以检查此处I've found the solution. Actually, I was almost there, need to use
\
, but before we need to useset escape on
command to make \ as escape, You can check here