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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Code review... gurus required!

Re: Code review... gurus required!

From: tojo <Tojo_at_hotmail.com>
Date: Thu, 17 Jul 2003 12:09:30 +0200
Message-ID: <MPG.198094438546e75989693@news.t-online.de>


In article <u2qchv8ufv72gm1ueeto10fmg2ish2s30u_at_4ax.com>, steve_at_itemfront.ltd.uk says...
> Hi All,
>
> I've been asked to do a code review, and came across this line...
>
> select nvl(count(*),0) into variable
>
> ...and I'm not sure if it is necessary! Do you need the nvl() function
> in this pl/sql statement, and will its removal speed things up?
>
> I reckon no and yes, but would appreciate the experts view!
>
> Cheers,
>
> Steve
>

You don't need nvl for count(*). Even if the table is empty, you'll still get "0".

For other aggregates like avg, sum, min, max etc. you will need nvl if there are no records to aggregate.

Not sure about speed loss, probably tiny.

Received on Thu Jul 17 2003 - 05:09:30 CDT

Original text of this message

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