Cursor and updating same records inside cursor' '
After my previous article on Stored Procedures was published on Site Point, I received quite a number of comments.And finally, if the current win/lose streak is the only thing we want to know from that table, why pull all the raw data? Every insertion of the record will update that table too.But this is way too cumbersome and too error prone. As the name of this article suggests, we will see a better alternative (in my view) to solve this problem: using cursor in a Stored Procedure.In particular, we will see how to return a dataset from an SP. With cursors, we can traverse a dataset and manipulate each record to accomplish certain tasks.When such an operation on a record can also be done in the PHP layer, it saves data transfer amounts as we can just return the processed aggregation/statistical result back to the PHP layer (thus eliminating the – manipulation process at the client side).