SQL * Plus:强制它返回错误代码 [英] SQL*Plus : Force it to return an error code

查看:178
本文介绍了SQL * Plus:强制它返回错误代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存储过程,该存储过程具有OUT参数,指示错误代码. 如果错误代码不为0,则会引发错误

I have a stored procedure that has an OUT parameter, indicating an error code. If the error code is not 0, then I raise an error

DECLARE
BEGIN
 foo (err_code);

 IF (err_code <> 0) THEN
   raise_application_error(...);

END;

到目前为止很好,但这是我的问题.

So far so good, but here's my question.

这段代码(如上所示)由sqlplus执行,这是从外壳程序脚本调用的,该脚本应以0/不为0(作为sql脚本)退出.

This piece of code (shown above) is executed by sqlplus, which is called from a shell script, which should exit with 0 / not 0 (as the sql script).

#shell script

sqlplus ... @myscript
return $?

当执行raise_application_error时,控制权返回到sqlplus.

When the raise_application_error executes, control goes back to sqlplus.

sql>

我想要的是一种退出到shell的方法,而sqlplus在$上不返回0?

What I want, is a way of exiting back to the shell, without sqlplus returning a 0 on $?

有什么想法吗? 预先感谢.

Any thoughts? Thanks in advance.

推荐答案

一旦SQLERROR退出1

这篇关于SQL * Plus:强制它返回错误代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆