Вопрос

i am performing oracle table rollback using rowId:

so before each data injection, i record the max rowid of the table. If anything went wrong, i will delete from table where rowid > max rowid recorded.

after deletion is executed, i can still see injected records.

please advice!

thanks, Richard

Это было полезно?

Решение

A ROWID is :

A globally unique address for a row in a database.

It is not an identifier that will be incremented for each new row. A new row could use a previously used ROWID if the row that had this ROWID has been deleted.

Also note that Oracle could reuse an older block that has been freed for new rows (which would result in a lower ROWID). Oracle could also get extents in another data file with a lower file number than the file of the last ROWID. In most cases you can't control precisely where your new rows will end up physically so you should not rely on ROWID increasing.

Finally you shouldn't depend upon the current implementation of ROWID, it could change in future releases.

You could use a sequence or a timestamp column to identify new records. Or even a flag column.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top