Re: Trouble passing exceptions

From: Noel <tbal_at_go2.pll-l>
Date: Tue, 29 Mar 2005 17:10:42 +0200
Message-ID: <d2brh5$73l$1_at_inews.gazeta.pl>


Użytkownik mike napisał:

> 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
>

Update doesn't raise no_data_found.

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

    IF SQL%ROWCOUNT = 0 THEN
     RAISE NO_DATA_FOUND;
    END IF;
-- raise_application_error(-20101, 'No Data');   end update_me;

--
Noel




-- 
TomekB tbal_at_spam_go2_trap.pl GSM:Plus 607598532
{Peugeot 306 ST, WY - 49245,       GG: 947-891}
Received on Tue Mar 29 2005 - 17:10:42 CEST

Original text of this message