|
-
Alright! We have feedback! 
rsuri - excellent example
My take on ROWIDs:
The only times that I think the use of ROWIDs are acceptable:
- Internal to a single statement, such as rsuri's example
- After a SELECT FOR UPDATE or UPDATE...RETURNING, such as cheland's reference to the standard cursor commit work-around. ( However, I must add that to do a FOR UPDATE on a cursor is not such a good idea to begin with, IMHO - too many locks )
This is because how volatile ROWIDs are. If you don't have a lock on the record, you have absolutely no idea if that ROWID will be valid the next time you go to use it. Right?
However, I wonder if this is even 100% safe. Consider:
The ROWID basically says where the row is... block, offset and all that.
In an index-organized table, someone can move your record by inserting/deleting other records without even having a lock on your record. Of course, in this case, there is no *real* ROWID - Oracle 'fakes' one, so this example should be safe.
Are there any other possible examples, however? Is it possible in *any* circumstance for a ROWID to change *while* the row is locked?
So, the questions now are:
- Do my two use cases represent the only times that the ROWID should be used? Are there others?
- Is my second use case safe 100% of the time?
- Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|