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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: a pl/sql question

RE: a pl/sql question

From: Anu <anu_77_d_at_yahoo.com>
Date: Thu, 29 Apr 2004 14:58:07 -0700 (PDT)
Message-ID: <20040429215807.67857.qmail@web60804.mail.yahoo.com>


I think you need exception here. It will error out if no row found. It will not go to :  

IF SQL%NOTFOUND THEN. "Freeman, Donald" <dofreeman_at_state.pa.us> wrote: I don't know if it will improve performance but since you know that in a = certain number of cases you will get a SQL%NOTFOUND why not use IF/THEN = to deal with it instead of throwing an exception?

select title, volume, pages, year, journalid into ttl, vol, pg, yr, jid from ref where id=3Drn; begin
select abbrev into jname from journal2abbrev where id=3Djid and medline=3D'Y';
IF SQL%NOTFOUND THEN
select name into jname from journal where id=3Djid; END IF;
end;

> -----Original Message-----
> From: oracle-l-bounce_at_freelists.org
> [mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Jacques Kilchoer
> Sent: Thursday, April 29, 2004 4:09 PM
> To: oracle-l_at_freelists.org
> Subject: RE: a pl/sql question

>=20
>=20

> Is the "when others" exception trying to capture errors like=20
> "table does
> not exist" or is it only for a "%notfound" condition in case=20
> there is no
> row in the table for "id =3D3D jid ;" ?=3D20
>=20

> -----Original Message-----
> Guang Mei
>=20

> I have the following pl/sql function code that gets called a=20
> lot in our
> application.
>=20

> ...
>=20

> select title, volume, pages, year, journalid
> into ttl, vol, pg, yr, jid from ref where id=3D3Drn;
> begin
> select abbrev into jname from journal2abbrev
> where id=3D3Djid and medline=3D3D'Y';
> exception
> when others then select name into jname from journal where =3D
> id=3D3Djid;
> end;
>=20

> ...
> ----------------------------------------------------------------
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> ----------------------------------------------------------------
> To unsubscribe send email to: oracle-l-request_at_freelists.org
> put 'unsubscribe' in the subject line.
> --
> Archives are at http://www.freelists.org/archives/oracle-l/
> FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
> -----------------------------------------------------------------
>=20

Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
		
---------------------------------
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs 

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request_at_freelists.org
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Thu Apr 29 2004 - 16:55:06 CDT

Original text of this message

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