Updating a record through cursor
As it processes each row, it needs to split amounts into separate new records (accounting data being redistributed to other accounting categories). Clearly, there are multiple better ways to do this.
It deletes WHERE CURRENT OF and then inserts multiple records that would match the cursor's selection criteria. But for the sake of understanding, is a query's result set being processed row-by-row in a cursor loop isolated from DML performed on the same table matching the selection criteria after the cursor is opened?
Check out all our database development sessions at OOW19 Thanks for the question, Peter.
I have learned how to change a set of records in one fell swoop with the UPDATE command.
The Ask TOM team will be busy at Open World this month.
If you are at the conference, drop into the Groundbreaker area and say Hello.
The 'Position Lost' column is populated by default with a value of '0' from the previous query (although this could obviously be altered to populate with NULL values on table creation).
Now I thought a cursor might be the best way to undertake this (through fetching the individual rows into variables), but am obviously doing something (very) stupid here, as when the query is executed, the 'Position Lost' values in the table are all updated with a value of 4730 ! as I mentioned in the original post (you might not have noticed, the post was a bit or a mind-blurt ), the information is ordered by Datetime, which is contained in a separate column (not shown in my example).
This information relates to multiple position 'reports' made by numerous entities over a period of time, with the 'MMSINumber' values indicating the individual entities in question.