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: <sosa48_at_hotmail.com>
Date: 8 Nov 2006 06:34:38 -0800
Message-ID: <1162996478.018944.229400@k70g2000cwa.googlegroups.com>


Thanks so much!

braj.mahto_at_gmail.com wrote:
> 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 - 08:34:38 CST

Original text of this message

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