A pseudocolumn behaves like a table column, but is not actually
stored in the table. You can select from pseudocolumns, but you
cannot insert, update, or delete their values. This section
describes these pseudocolumns:
For each row in the database, the ROWID pseudocolumn returns a row's
address. ROWID values contain information necessary to locate a
row:
* which data block in the data file
* which row in the data block (first row is 0)
* which data file (first file is 1)
In most cases, a ROWID value uniquely identifies a row in the
database. However, rows in different tables that are stored
together in the same cluster can have the same ROWID.
Values of the ROWID pseudocolumn have the datatype ROWID.
ROWID values have several important uses:
* They are the fastest means of accessing a single row.
* They can show you how a table's rows are stored.
* They are unique identifiers for rows in a table.
A ROWID does not change during the lifetime of its row. However,
you should not use ROWID as a table's primary key. If you delete
and reinsert a row with the Import and Export utilities, for
example, its ROWID may change. If you delete a row, Oracle may
reassign its ROWID to a new row inserted later.
Although you can use the ROWID pseudocolumn in the SELECT and WHERE
clauses of a query, these pseudocolumn values are not actually
stored in the database. You cannot insert, update, or delete a
value of the ROWID pseudocolumn.
EXAMPLE:
This statement selects the address of all rows that contain data for
employees in department 20:
SELECT ROWID, ename
FROM emp
WHERE deptno = 20
ROWID ENAME
----------------- ----------
0000000F.0000.0002 SMITH
0000000F.0003.0002 JONES
0000000F.0007.0002 SCOTT
Internally, every database table has a ROWID pseudocolumn, which stores binary values called rowids. Each rowid represents the storage address of a row. A physical rowid identifies a row in an ordinary table. A logical rowid identifies a row in an index-organized table. The ROWID datatype can store only physical rowids. However, the UROWID (universal rowid) datatype can store physical, logical, or foreign (non-Oracle) rowids.