Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Will ROWID change during DB Runing??
For a non-partitioned heap table where no deletes take place and in the
absence of a table reorganization the rowid will not change for the
life of the row.
If a row is deleted, a commit occurs ending the transaction. Another transaction can insert a new row into the same block and slot thus reusing a rowid. If the step that extracts the rowid is separated from the row update via the rowid then this can lead to updating the wrong row. The failsafe is to all extract the PK of the row along with the rowid and code the update so that both the rowid and PK must match. This allows rowid access but verifies that it is the same row.
Inserts change the rowid of rows in IOT's and row movement changes the rowid of rows in partitioned tables.
Hopefully this answers your question. I suggest you always code a check condition to verify that the data has not changed when you access by rowid. You have no way of guarenteeing that just because there is no delete process today that there will not be one tomorrow or that a DBA will not move/rebuild the table. Depending on exactly how the rowid are extracted and used you still want to write your code to target the correct data.
HTH -- Mark D Powell -- Received on Tue Jan 04 2005 - 08:30:06 CST
![]() |
![]() |