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

Home -> Community -> Usenet -> c.d.o.server -> Re: Simple question ...

Re: Simple question ...

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Fri, 6 Aug 2004 16:10:20 +0200
Message-ID: <411390d6$0$7783$626a14ce@news.free.fr>

"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 Cadot
Received on Fri Aug 06 2004 - 09:10:20 CDT

Original text of this message

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