【问题标题】:Execute shell script from sqlplus prompt and exit sqlplus if shell script fails从 sqlplus 提示符执行 shell 脚本,如果 shell 脚本失败则退出 sqlplus
【发布时间】:2020-06-29 13:31:32
【问题描述】:

我正在从 sqlplus 控制台执行 shell 脚本,它检查文件,如果文件不存在,它会失败,退出代码为 1。虽然,shell 脚本失败,但 sqlplus 不会退出并开始运行下一个脚本。

【问题讨论】:

    标签: oracle shell sqlplus


    【解决方案1】:

    你能修改你的shell脚本吗?让它让 SQL Plus 知道结果状态,例如

    Shell
    =====
    Does normal work.
    if [ shell level error ] then
      echo "pro File not found" > /tmp/sqlplus.status
      echo "exit" >> /tmp/sqlplus.status
    else
      echo "pro Continuing on" > .status
    fi
    
    SQL Plus
    ========
    host my_shell.sh
    @/tmp/sqlplus.status
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-27
      • 2012-06-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多