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: oracle code to display sum

Re: oracle code to display sum

From: <braj.mahto_at_gmail.com>
Date: 8 Nov 2006 00:59:43 -0800
Message-ID: <1162976383.823630.291380@m73g2000cwd.googlegroups.com>


you can use this simple select to do the job;

WITH sum_number AS

     (SELECT     LEVEL num
            FROM DUAL
      CONNECT BY LEVEL <= 100)

SELECT SUM (num)
  FROM sum_number
 WHERE MOD (num, 5) = 0 OR MOD (num, 7) = 0;

hasta_l3_at_hotmail.com wrote:
> sosa48_at_hotmail.com wrote :
>
> > Can anyone please help in writing a loop or any type of code that would
> > help me display the summation(one sum) for all numbers between 1 and
> > 100, that are dividable by 5 or 7 without a remainder.
> >
> > Thanks in advance!
>
> Well, assuming homework... You dont need a loop.
> Do you know of Gauss trick ?
>
> http://www.math.fau.edu/Richman/mla/triangle.htm
>
> Can you adapt it for multiples of 5 (or 7) between 1 and 100 ?
>
> --- Raoul
>
> (pretty off-topic. Sorry, guys)
Received on Wed Nov 08 2006 - 02:59:43 CST

Original text of this message

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