|
|
|
|
|
|
| Author |
Message |
Noel *nix forums addict
Joined: 25 Mar 2005
Posts: 67
|
Posted: Tue Mar 29, 2005 1:10 pm Post subject:
Re: Trouble passing exceptions
|
|
|
Użytkownik mike napisał:
| Quote: | 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} |
|
| Back to top |
|
 |
mike *nix forums Guru Wannabe
Joined: 04 Mar 2005
Posts: 233
|
Posted: Mon Mar 28, 2005 9:34 pm Post subject:
Re: Trouble passing exceptions
|
|
|
Sorry, I posted this in the wrong forum.
This is NOT about tools... |
|
| Back to top |
|
 |
mike *nix forums Guru Wannabe
Joined: 04 Mar 2005
Posts: 233
|
Posted: Mon Mar 28, 2005 9:21 pm Post subject:
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 |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Thu Jan 08, 2009 1:19 am | All times are GMT
|
|
Mortgages | Loans | Car Finance | Mobile Phones | Promotional Web Design
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|