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: SQLPLUS divide by zero question

Re: SQLPLUS divide by zero question

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Wed, 26 Aug 1998 07:12:12 GMT
Message-ID: <01bdcff7$5d2576d0$0300a8c0@WORKSTATION>

Just taking the opportunity to complain here: Did you know that things like this (appropriate) solution can really waste CPU on the Parallel Query Option ?

If you write:

	select 
		sum(a), sum(b), 
		decode (sum(b),0,0,sum(a)/sum(b)) 
	from t;

then the lowest PQ slaves will probably end up running something looking like (doctored for ease of reading).

	select /*+ rowid */
		sum(a),
		sum(a),
		sum(b),
		sum(b),
		sum(b)
	from t
	where rowid between ......

And it gets worse if you ant a count(distinct colx) in there.

Jonathan Lewis

Jonathan Gennick <gennick_at_worldnet.att.net> wrote in article
> You might try:
>
> select decode (sum(b),0,0,sum(a)/sum(b)) from t;
>
Received on Wed Aug 26 1998 - 02:12:12 CDT

Original text of this message

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