Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Simple question ...
Michel,
Many thanks for the links. I've already put them in my "Favorites".
I knew I can use cursors for getting the same result(without relying on
exceptions).
The "SELECT INTO myVar" seemd to me more nice, but
now I know that I shoud use it just when it works without generating
exceptions in 99,9% of cases.
ernest
"Michel Cadot" <micadot{at}altern{dot}org> wrote in message
news:411390d6$0$7783$626a14ce_at_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 - 10:12:53 CDT
![]() |
![]() |