RE: a pl/sql question

  • From: Anu <anu_77_d@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Thu, 29 Apr 2004 14:58:07 -0700 (PDT)

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@xxxxxxxxxxx> 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@xxxxxxxxxxxxx
> [mailto:oracle-l-bounce@xxxxxxxxxxxxx]On Behalf Of Jacques Kilchoer
> Sent: Thursday, April 29, 2004 4:09 PM
> To: oracle-l@xxxxxxxxxxxxx
> 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@xxxxxxxxxxxxx
> put 'unsubscribe' in the subject line.
> --
> Archives are at //www.freelists.org/archives/oracle-l/
> FAQ is at //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@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //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@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: