Home » Other » Training & Certification » Combination Function (PLSQL Functions)
Combination Function Tue, 18 November 2008 15:07
 jnwaima Messages: 1Registered: November 2008 Location: Texas Junior Member
I am new to PLSQL but I've been given a task to write a function that checks to see if there are more than 1 possible combination of transaction_ids whose total amount adds up to a specified amount.

e.g In my TRANSACTION TABLE

transaction_id AMOUNT
1111 \$20.00
2222 \$25.00
3333 \$25.00
4444 \$50.00
5555 \$150.00
6666 \$180.00

Charge is to find out if there is more than one possible combinations of transaction_ids that adds up to \$200.00 (
e.g 25+25+150 or 50+150 or 20+180
If there is only one combination, then return the transaction Ids that adds up to \$200.00

Any ideas or suggestions will be greatly appreciated.
Thanks,
J.

Re: Combination Function [message #359950 is a reply to message #359911] Tue, 18 November 2008 23:17
 tarmenel@gmail.com Messages: 18Registered: November 2008 Junior Member
you would probably need some type of loop for this. A loop to step through the transaction list and maybe then add till you either get to the predetermined amount or if it goes over to step onto the next transaction.
Re: Combination Function [message #359954 is a reply to message #359950] Tue, 18 November 2008 23:30
 Akash83 Messages: 9Registered: November 2008 Location: India Junior Member
You can use two loops. In one loop you can take one Amount and in another loop you can sum it with other Amounts till you reach the Sum of 200.
 Previous Topic: material Next Topic: OCA 1Z0-042 exam question categories
Goto Forum:

Current Time: Sat Jul 29 07:07:05 CDT 2017

Total time taken to generate the page: 0.06259 seconds