Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Just for fun
On Sat, Nov 05, 2005 at 04:51:26PM, t_adolph_at_hotmail.com wrote:
> Hi all,
>
> Its Saturday afternoon, its raining and the rugby doesn't start for a while, so....
>
> create or replace procedure circle is
> pi constant number(5,3) := 3.142;
I believe it's because you are using a constant for pi. Maybe this code will help:
select n terms
, sqrt(6*(
sum (1 / power(n, 2)) over (
order by n rows between unbounded preceding and current row)
rows between unbounded preceding and current row
)
) / sqrt(2) approx2
, 2*exp(sum(ln(power(2*n, 2) / ((2*n-1)*(2*n+1)))) over (
order by n
rows between unbounded preceding and current row
)) approx3
from (
select level n
from dual
connect by level <= &terms
)
/
Yep, I had a rainy weekend too... :-)
cheers,
Anthony
-- Anthony WilsonReceived on Sun Nov 06 2005 - 07:33:02 CST
![]() |
![]() |