niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Oracle » Tools
Trouble passing exceptions
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
Noel
*nix forums addict


Joined: 25 Mar 2005
Posts: 67

PostPosted: Tue Mar 29, 2005 1:10 pm    Post subject: Re: Trouble passing exceptions Reply with quote

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

PostPosted: Mon Mar 28, 2005 9:34 pm    Post subject: Re: Trouble passing exceptions Reply with quote

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

PostPosted: Mon Mar 28, 2005 9:21 pm    Post subject: Trouble passing exceptions Reply with 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
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 1:19 am | All times are GMT
navigation Forum index » Databases » Oracle » Tools
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Trouble enabling auth on postfix and sasl dklugmann Postfix 0 Fri Feb 29, 2008 11:02 pm
No new posts Shortening URLs passing through a squid hierarchy Irvine, Doug - Resources Squid 0 Fri Jul 21, 2006 10:15 am
No new posts Semantics of propagated exceptions Thomas Lotze python 3 Fri Jul 21, 2006 9:57 am
No new posts Trouble Declaring 3D Array in Header File free2klim C++ 1 Fri Jul 21, 2006 4:07 am
No new posts Storing and passing secure passwords to MS Exchange scoomey PHP 0 Thu Jul 20, 2006 2:30 pm

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
[ Time: 0.1404s ][ Queries: 20 (0.0688s) ][ GZIP on - Debug on ]