Re: Q: any idea what are we missing ?

  • From: "Niall Litchfield" <niall.litchfield@xxxxxxxxx>
  • To: rjamya@xxxxxxxxx
  • Date: Wed, 20 Sep 2006 13:53:54 +0100

It isn't being raised, which I think is the point.

I'd prefer if you expect an exception to deal with it, and otherwise reraise

eg

NIALL @ nl102 >ed
Wrote file afiedt.buf

 1  create or replace function tst return number
 2  is
 3     v_exists number(5):=0;
 4  begin
 5     select 1
 6       into   v_exists
 7       from dual where 1 = 0;
 8       return v_exists;
 9  exception
10       when no_data_found then
11               v_exists := '0';
12       return v_exists;
13       when others then
14       raise;
15* end tst;
NIALL @ nl102 >/

Function created.

NIALL @ nl102 >select tst from dual;

      TST
----------
        0

1 row selected.

NIALL @ nl102 >

note that no exception handling results in a null return

NIALL @ nl102 >ed
Wrote file afiedt.buf

 1  create or replace function tst return number
 2  is
 3    v_exists number(5):=0;  begin
 4       select 1
 5         into   v_exists
 6         from dual where 1 = 0;
 7         return v_exists;
 8* end tst;
NIALL @ nl102 >/

Function created.

NIALL @ nl102 >select tst from dual;

      TST
----------


1 row selected.

NIALL @ nl102 >



On 9/20/06, rjamya <rjamya@xxxxxxxxx> wrote:
what is the point? you are not catching the exception, so why complain when
it is raised?

Raj



On 9/20/06, Amihay Gonen < AmihayG@xxxxxxxxx> wrote:
>
>
>
>
>
> create or replace function t1 return number
>
> is
>
>    v_exists number(5):=0;
>
> begin




--
Niall Litchfield
Oracle DBA
http://www.orawin.info
--
//www.freelists.org/webpage/oracle-l


Other related posts: