Do we have any function which calulates Factorial value.
Factorial definition: n* n-1 * n-2 * ...... * 1 For example: 5! = 5*4*3*2*1
I didn't find any function for this. I am planning to create a PL/SQL function for this.
Any ideas are welcome.
asked Dec 17, 2009 at 09:08 PM in Default
Don Burleson dives into factorials:
He mentions that the exp(sum(ln(rownum))) technique doesn't work in all cases.
Ah, I see he also mentions that his information is drawn from this book:
Probably the best way is just to create your own function. I found one at:
Caution! Not tested. They also show a way to do it in SQL.
answered Dec 17, 2009 at 10:48 PM
Check out this query. I found the query over internet.
select count(*) FACTORIAL from ( select level b from (select level n from dual connect by level <= &x ) YourTable connect by nocycle n != prior n )where b = &x
Replace &x with factorial value.
But this query seems to be very slow. Only to show another way of doing this.
answered Dec 18, 2009 at 08:30 PM
BI DWH BALA