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: PL/SQL : Alternative way of doing if any

Re: PL/SQL : Alternative way of doing if any

From: Noel <tbal_at_go2.pll-l>
Date: Thu, 18 Aug 2005 17:24:36 +0200
Message-ID: <de298i$sbp$1@inews.gazeta.pl>


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-l
Received on Thu Aug 18 2005 - 10:24:36 CDT

Original text of this message

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