The UROWID and ROWID Datatypes
The UROWID and ROWID types allow you to work with database rowids in your PL/SQL programs. A rowid is a row identifier —a binary value that identifies a row of data in an Oracle table. Referencing rowids in UPDATE and DELETE statements can sometimes lead to desirable improvements in processing speed, as access by rowid is typically the fastest way to locate or retrieve a particular row in the database—faster even than a search by primary key. Figure 12-1 contrasts the use of a rowid in an UPDATE statement with the use of column values such as those for a primary key.
Figure 12-1. ROWIDs take you directly to rows in a table
In the history of Oracle, the ROWID type came first. As Oracle added functionality such as index-organized tables (IOTs) and gateways to other types of databases, Oracle developed new types of rowids and hence had to develop a new datatype capable of holding them. Enter the UROWID datatype. The U in UROWID stands forUniversal, and a UROWID variable can contain any type of ROWID from any type of table.
Tip
We recommend the use of UROWID for all new development involving rowids. The ROWID type provides backward compatibility, but can’t accommodate all types of rowids now encountered in an Oracle database. UROWID is safer because it accommodates any type of rowid.
Getting at Rowids
In the Oracle RDBMS, ROWID is a pseudocolumn that ...
Get Oracle PL/SQL Programming, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.