I want a pl/sql query to update a transaction table where multiple rows are there. the records will be like
in master table
slno product ord_qty del_qty
1 12456 10
2 12586 8
in detail table
slno product ord_qty del_qty due_date
1 12456 2 25-nov-01
1 12456 3 30-nov-01
1 12456 5 15-dec-01
2 12586 8 15-dec-01
now when i enter a value for eg. 6 then it should update 1st table slno 1 del_qty with 6 and in 2nd table it should check the slno 1 1st row for the ord_qty with 6 this 6 is greater than ord_qty i.e.,2 so it has to update 1st row of slno del_qty with 2 and remaining 3 in 2nd row of slno 1 and 1no in 3rd row of slno 1. and next time i give as 4 then in 1st table it has to update with previous value + this 4 and in 2nd table it has to check for the balance in 1st row,2nd row,3rd row should update accordingly.