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: Malcolm Turner <mal_at_wcs.dnet.co.uk>
Date: Tue, 25 Aug 1998 13:51:54 GMT
Message-ID: <35e4ae91.74637128@news2.dnet.co.uk>


iancrozier_at_aol.com (Iancrozier) wrote:

>I am trying to run a sql statement, something like this:
>select sum(A)/sum(B) from table T;
>Sometimes sum(B) is equal to zero. Is there any way in sqlplus I can run this
>or do I have to go to PL/SQL?



Try sum(A) / nvl(sum(B),1) or whatever. You need to decide what value you want returned id sum(B) is 0. Received on Tue Aug 25 1998 - 08:51:54 CDT

Original text of this message

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