Re: how to disable EXCEPTIONS in PL/SQL ?
Date: 15 Oct 1994 15:59:08 -0400
Message-ID: <37pcac$sdb_at_newsbf01.news.aol.com>
In article <781892379_at_f573.n115.z1.ftn>, Michael Stowe <Michael.Stowe_at_f573.fido.chi.il.us> writes:
>You are apparently neglecting to provide any exception handlers. The
simple
handler
>exception when others then null;
>end
>Will cause the exception to be ignored.
Response:
I sincerely doubt you are really suggesting that someone use this in their code. This is possibly the more dangerous than not handling exceptions at all. Find out the most common exceptions using your DML statement and Chapter 6 of the PL/SQL user's guide. Then do things like:
function do_it
return number
is
l_order_id orders.order_id%type;
begin
select order_id
into l_order_id
from orders
where date = to_date ('10/10/94','dd/mm/yy');
return (l_order_id);
exception
when NO_DATA_FOUND then
return (0);
when OTHERS then
return (-1);
end;
When you call this function if you get a 0 return things are OK and you can continue, though there was no order for the day. If you get a -1 returned, there has been an unexpected error and you need to get out before you destroy something. Received on Sat Oct 15 1994 - 20:59:08 CET