Sql*plus always returns exit code 0?

后端 未结 3 1358
梦毁少年i
梦毁少年i 2020-11-29 11:06

Whenever I run a sql script using Sql*plus and check for $?, I get 0 even when the script wasn\'t succesful.

Example

#$ sqlplus user/password@instanc         


        
3条回答
  •  攒了一身酷
    2020-11-29 11:38

    The best action might a combination of the other ideas on this page and the ideas at

    Help with SQLPLUS please? How to make SQLPLUS startup with DEFINE `OFF` initially?

    Make a login.sql file, or edit the global one to have

    WHENEVER OSERROR EXIT FAILURE
    WHENEVER SQLERROR EXIT SQL.SQLCODE
    

    inside it. Then, if the file doesn't exist, it will error out. If a line fails, it will error out.

    However, keep in mind that as the docs say at : https://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve052.htm#SQPUG135 that certain commands still will not error out as you might expect.

提交回复
热议问题