Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

factorial of a number

Mac_Freak_RahulApr 18 2011 — edited Apr 19 2011
Hi all,

I am trying to write a sql that can calculate the factorial from a single sql.with this query I can reach uptill :

with t as
(select 10 num from dual)
select ltrim(max(sys_connect_by_path(rownum,'*')),'*') factorial
from t
connect by rownum <= num

Output: 1*2*3*4*5*6*7*8*9*10

Now my requirements are as follows:

1) great if some1 could help me in writing an outer query on top of mine to get the desired result
2) suggest some other way to make me understand how to calculate factorial of a number from scratch.

Thanks
Rahul
This post has been answered by Ganesh Srivatsav on Apr 18 2011
Jump to Answer

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 17 2011
Added on Apr 18 2011
9 comments
1,035 views