【发布时间】:2016-06-08 15:39:28
【问题描述】:
我的文件夹结构类似于
/Release_script/
install.sql
/common_code/
error_handling.sql
/Reporting/
fancy_report1.sql
fancy_report2.sql
some_code_to_include.sql
install.sql 脚本包含这些行
@../Reporting/fancy_report1.sql
@../Reporting/fancy_report2.sql
fancy_report1.sql 和 fancy_report2.sql 都以该行开头
@@../common_code/error_handling.sql
它们还包括其他/Reporting/文件,即@@some_code_to_include.sql
如“SQL*Plus 用户指南和参考”中所述,@@ (double "at" sign)
运行脚本。该命令几乎与@(“at”符号)相同 命令。 它对于运行嵌套脚本很有用,因为它具有 在 与调用它的脚本相同的路径或 URL。。只有网址 iSQL*Plus 支持表单。
当我在/Release_script/ 中打开sqlplus 并尝试运行install.sql 时,我得到了错误
SP2-0310:无法打开文件“../common_code/error_handling.sql”
如果我将fancy_report1.sql 的引用更改为@../common_code/error_handling.sql,然后直接从/Reporting/ 文件夹执行fancy_report1.sql,就可以了。
我应该使用哪些命令从调用文件的起点(即fancy_report1.sql)和不从工作目录的起点(即@987654332)运行命令@)? 为什么@@ 命令的行为似乎与@ 命令完全一样?
物有所值:
sqlplus -S /nolog<<EOF
prompt &_SQLPLUS_RELEASE
产量:
1102000100
【问题讨论】:
-
似乎对我有用。你检查过你的目录和文件权限了吗?
-
@tale852150 ... 文件权限?我正在使用 Windows 7...
-
您不应该在 Windows 7 上使用反斜杠作为路径分隔符吗?
-
@JeromyFrench 好的,然后是文件夹权限。我想到了“文件”,因为我看到了问题中的正斜杠并且没有驱动器号。
-
@mustaccio:我也在考虑这个问题......但是第一条路径 (
@../Reporting/fancy_report.sql) 有效,并且它使用正斜杠,所以我认为 sqlplus 做了一些魔法来让它工作.