且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

抑制批处理脚本中的SQL * PLUS错误

更新时间:2023-12-05 11:28:58

对于这些类型的错误,SQL * Plus正在挂起"用户名提示符,因为它无法连接.由于-s标志,您看不到它.默认情况下,它将允许进行三次尝试,这在交互式运行时很有用,而在从此类脚本运行时则无济于事.您可以使用 登录"选项:

For those kinds of errors, SQL*Plus is 'hanging' at a username prompt, as it hasn't been able to connect. You don't see that because of the -s flag. By default it will allow three attempts, which is useful when running interactively, but isn't helpful when run from a script like this. You can make it exit after the failed login with the -l 'logon' option:

sqlplus -s -l %%A @fetch.sql  >> output.txt