News:

If you need instructions on how to get through the hotels, check out the enclosed instruction book.

Main Menu

oracle sql: recusrively determine the unique numbers that sum up to a number

Farted by l1fty, January 13, 2012, 06:53:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

l1fty

hey dudes


for a question on my exam i got something i couldn't figure out how to do (in oracle sql) so maybe you can help me

it was something like:


step 1:
recursively come up with a sum of unique numbers that adds up to the specified number

example, for the number 5:
1
1+2
1+3
2+3
1+2+3
1+2+3+4
1+2+4
1+3+4
2+4
3+4
2+3+4

...etc

this one column table would have to be recursively generated using a single table (the dual table in oracle) and hierarchical functionality (connect_by clause)



do any of you guys have any idea? i'm lost