Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Exception inside function not being propagated to query

Re: Exception inside function not being propagated to query

From: Christopher M. Day <christopher.day_at_rdbms.freeserve.co.uk>
Date: Thu, 11 Feb 1999 00:46:31 +0000
Message-ID: <36C22867.DEB2EAE1@rdbms.freeserve.co.uk>


Brian,

Why would you want to return an invalid state via an exception ? why not just return 'Invalid' and use you exception handlers to handle exceptions ?

Chris.

bdg_at_hotmail.com wrote:
>
> I'm probably missing something simple here, but . . .
>
> I have a function with the definition
>
> FUNCTION test_function(p_value NUMBER) RETURN VARCHAR2 IS
> BEGIN
> IF p_value = 1 THEN
> RETURN 'Valid';
> ELSE
> RAISE NO_DATA_FOUND;
> END IF;
> END;
>
> When called from a query, the function doesn't seem to be propagating the
> exception as I would expect it to. For example . . .
>
> ********************************************************
>
> SQL> select test_function(1) from dual;
>
> TEST_FUNCTION(1)
> -----------------------------------------------------------------------------
> --- Valid
>
> SQL> select test_function(2) from dual;
>
> TEST_FUNCTION(2)
> -----------------------------------------------------------------------------
> ---
>
> SQL>
>
> ********************************************************
>
> The same results occur if the function is inside a package. I would prefer
> that the exception stop the query entirely. Any hints?
>
> Thanks,
> Brian Gastineau
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Wed Feb 10 1999 - 18:46:31 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US