我的查询基本上是当我尝试从 bash 运行多个 oracle 脚本时,如何在脚本之间添加注释。我尝试通过从双重中选择一个字符串来使用解决方法。但是输出格式不是很好。
谁能给我建议一个更好的方法。
我的代码
#!/bin/bash
#Run Script
echo "-------------------------------"
echo "***Running Script1***"
echo "-------------------------------"
sqlplus -S UID/PSW@DB << EOF
whenever sqlerror exit sql.sqlcode;
set echo off
set heading off
@/my/path/Script1
Select '--------------' from dual;
select '***Running Script1***' from dual;
Select '--------------' from dual;
@/my/path/Script2
exit;
EOF
输出
-------------------------------
***Running Script1***
-------------------------------
SP2-0310: unable to open file "my/path/Script1.sql"
--------------
***Running Script2***
--------------
SP2-0310: unable to open file "my/path/Script2.sql"
预期产出
-------------------------------
***Running Script1***
-------------------------------
SP2-0310: unable to open file "my/path/Script1.sql"
--------------
***Running Script2***
--------------
SP2-0310: unable to open file "my/path/Script2.sql"