Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL : Alternative way of doing if any
User Billy wrote:
> Single line of code. Easy to read. Easy to understand. And when there
> is no data, you get an exception. No need to write code to check if
> there was data. No mysterious runtime errors because the cursor does
> not return data as expected and never tested. You get an exception.
> Automatically. Exceptions Are Good (tm). Doing in-line testing and
> evalution for runtime results are idiotic.
>
Baka's code will raise exception when, from some reason, cursor fail to
open.
No mysterious runtime errors occurs, there will be %NOTFOUND
pseudocolumn of cursor set to TRUE if cursor fetches no records.
Your example might raise three kind of exception, no_data_found,
too_many_rows and other exception, and you'll need to put some code for
all of those.
I would stick by Baka's solution.
-- TomekB tbal_at_go2.pl-lReceived on Thu Aug 18 2005 - 10:24:36 CDT
![]() |
![]() |