Okay, thanks for your quick response,

So I should:
  • load all transaction rows belonging to the customer who has won the prize into a cursor
    .

  • Then, I should loop through the cursor aggregating the values of the transaction num_points_given.

  • when I get to equal the prize.num_points_reqd I delete the transaction records marked and break out (as it where) of the cursor.


Ok, (I think). Two points though: firstly I am new to cursors so I will have to look up how to use them. Secondly, I am actually testing on MySQL (sorry if I shouldn´t have posted here), but any further clarifications would be great, thanks again.