View Full Version : Trouble passing exceptions
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
Sorry, I posted this in the wrong forum.
This is NOT about tools...
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@spam_go2_trap.pl GSM:Plus 607598532
{Peugeot 306 ST, WY - 49245, GG: 947-891}
MyLounge.com Site Map
Forum:
Cars,
Cell Phone,
Database,
Games,
Home Improvement,
IT,
Music,
School,
Sports,
Web Design,
Web Server,
Weight Loss
The MyLounge.com forum is intended for informational use only and should not
be relied upon and is not a substitute for any advice. The information contained
on MyLounge.com are opinions and suggestions of members and is not a representation
of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for
the accuracy, completeness or usefulness of any postings or the qualifications
of any person responding. Please consult a expert or seek the services of an
attorney in your area for more accuracy on your specific situation. Please note
that our forums also serve as mirrors to Usenet newsgroups. Many posts you see
on our forums are made by newsgroup users who may not be members of MyLounge.com
Term of Service
vBulletin v3.0.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.