How do I capture a SQLPlus exit code within a shell script?

前端 未结 2 1936
南笙
南笙 2020-12-10 06:26

I have a KornShell (ksh) script that logins into SQL*Plus and executing a script. Within the shell script I would like to capture the status code of the SQL statement that

相关标签:
2条回答
  • 2020-12-10 06:38

    Exit from the sql file with

    exit sql.sqlcode;
    

    capture it in shell with $?

    0 讨论(0)
  • 2020-12-10 06:40

    Have you tried using

    whenever sqlerror exit sql.sqlcode
    

    in your sql script? (also see this link)

    0 讨论(0)
提交回复
热议问题