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

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

FW: a pl/sql question

From: Freeman, Donald <dofreeman_at_state.pa.us>
Date: Fri, 30 Apr 2004 11:11:45 -0400
Message-ID: <AFF54B073FF15849B53E32E67EE860760144EE84@ENHBGPRI11.PA.LCL>


> The difference in this case is your example selects into a variable =
instead of directly updating the table. I followed up on this by =

reading the PL/SQL manual (RTFM?) and there are several warnings about =
using cursor attributes including one similiar to your example. What I =
wrote is only good for the narrow usage I showed ;-).  On page 6-40 of =
the 9.2 PL/SQL Users Guide is:
>=20
> "If a SELECT INTO statement fails to return a row, PL/SQL raises =
the predefined
> exception NO_DATA_FOUND whether you check %NOTFOUND on the next =
line or not.
> Consider the following example:
> BEGIN
> ...
> SELECT sal INTO my_sal FROM emp WHERE empno =3D my_empno;
> -- might raise NO_DATA_FOUND
> IF SQL%NOTFOUND THEN -- condition tested only when false
> ... -- this action is never taken
> END IF;
> The check is useless because the IF condition is tested only when =
%NOTFOUND is
> false. When PL/SQL raises NO_DATA_FOUND, normal execution stops and =
control
> transfers to the exception-handling part of the block."
> =20
> > An update that doesn't update any records is not an exception =
error.
> >=20
> > Trying to select multiple record values or no record values=20
> > when you expect
> > to always get one and only one value is an exception, so that=20
> > logic won't
> > work in this situation.

>=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
-----------------------------------------------------------------
Received on Fri Apr 30 2004 - 10:09:11 CDT

Original text of this message

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