Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: oracle code to display sum
you can use this simple select to do the job;
WITH sum_number AS
(SELECT LEVEL num FROM DUAL CONNECT BY LEVEL <= 100)
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