SQL Create a procedure that moves the payment amount from one invoice to another invoice (three parameters:
Fantastic news! We've Found the answer you've been seeking!
Question:
SQL
Create a procedure that moves the
payment amount from one invoice to another invoice (three parameters: source invoice ID, target invoice ID, and money amount) Perform the following checks: Both invoices belong to the same vendor Money amount must be > 0 Money amount to move must be <= PaymentTotal of the source invoice Money amount to move must be <= (InvoiceTotal -PaymentTotal –CreditTotal) of the target invoice The procedure decreases PaymentTotal of the source invoice and increases PaymentTotal of the target invoice by money amount in a transaction If for whatever reason something goes wrong, the transaction is rolled back
Related Book For
Probability and Statistics
ISBN: 978-0321500465
4th edition
Authors: Morris H. DeGroot, Mark J. Schervish
Posted Date: