Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Newbie Oracle ROWID questions
> BUTT - there must be a catch somewhere. What are the pitfalls of using
> ROWID as a direct access capability to do UPDATES?.
The biggest catch is that you should not depend on the ROWID to remain constant. Since a components of the ROWID is the physical location of the row, and since the ROWID may vary for many reasons (even a simple update may change the ROWID of the record), you have to be very careful with it.
RowIDs are _very_ temporary, so handle them with great care, and never assume the ROWID will remain the same for any row for too great a time.
It would be much better design if the critical tables had a primary key (which by definition has to be unique). If the data does not lend itself to having a unique primary key, create one based on a sequence (populate it with an ON INSERT trigger). You can then be assured that 1) you can safely use the primary key the same way as you would the ROWID, and 2) the primary key will not change, while the ROWID can change many times for a number of reasons.
With ROWID you are asking for trouble. Go the primary key way if you want to save yourself from big headaeches. Received on Thu May 10 2001 - 13:07:57 CDT