Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Simple question ...
"Ernest Morariu" <ernest_at_gesora.com> a écrit dans le message de
news:cf005n$6os$1_at_balena.cs.interbusiness.it...
> Hi All!
>
> The following command :
>
> SELECT myField INTO myVariable FROM myTable WHERE myCondition;
>
> generates an error if there is no record satisfying the condition
> "myCondition".
>
> I would like to be able to do something like:
>
> SELECT myField INTO myVariable FROM myTable WHERE myCondition ;
> if myVariable is null then
> -- do something
> else
> -- do something else
> end if ;
>
> Is there any way to do this without having to handle the exceptions ?
>
> I read somewhere that it not advisable to rely the code of the procedure on
> exceptions for getting common results.
>
> ernest
>
>
Have a look at PL/SQL User's Guide and Reference and cursor attributes:
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/13_elems20.htm#34118 http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/06_ora.htm#1967
-- Regards Michel CadotReceived on Fri Aug 06 2004 - 09:10:20 CDT