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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Trouble passing exception

Re: Trouble passing exception

From: Anurag Varma <avdbi_at_hotmail.com>
Date: Tue, 29 Mar 2005 00:01:27 GMT
Message-ID: <rV02e.195$kC3.33@twister.nyroc.rr.com>


mike wrote:
> I'm pretty new to pl/sql and having trouble passing exceptions between
> my sql and procedures.
>
>
> I have my basic sql:
>
>
> begin
> update_me('param1','param2', ....);
> exception when no_data_found then
> insert_me('param1','param2', ....);
> end;
>
>
> my procedures are:
>
>
> create or replace procedure update_me (
> x_param1 in varchar2,
> x_param2 in varchar2,
> ) AS
> begin
> UPDATE mytbl
> SET myfield2 = x_param2,
> WHERE myfield1 = x_param1;
> exception when no_data_found then
> raise_application_error(-20101­, 'No Data');
> end update_me;
>
>
> The raise_application error is not being received, because I have know
> data that is not getting inserted.
>
>
> Any help is appreciated.
>
>
> Mike
>

What makes you think that update will raise a no_data_found exception?
If update updates no rows then sql%rowcount is 0. That you can check and raise error with it.

Anurag Received on Mon Mar 28 2005 - 18:01:27 CST

Original text of this message

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