This is an over-simplified explanation of what I m working on.
I have a table with status column. Multiple instances of the application will pull the contents of the first row with a status of NEW
, update the status to WORKING
and then go to work on the contents.
It s easy enough to do this with two database calls; first the SELECT
then the UPDATE
. But I want to do it all in one call so that another instance of the application doesn t pull the same row. Sort of like a SELECT_AND_UPDATE
thing.
存储过程是最好的选择吗?