Oracle ROWID- Tables and Constraints
Every row in every table has an address. The address of a row is determined from a combination of the following:
• Data file number
• Block number
• Location of the row within the block
• Object number
You can display the address of a row in a table by querying the ROWID pseudocolumn; for example,
SQL> select rowid, emp_id from emp;
Here is some sample output:
ROWID
——————AAAFJAAAFAAAAJfAAA
EMP_ID
———-1
The ROWID pseudocolumn value is not physically stored in the database. Oracle calculates its value when you query it. The ROWID contents are displayed as base-64 values that can contain the characters A–Z, a–z, 0–9, +, and /. You can translate the ROWID value into meaningful information via the DMBS_ROWID package. For instance, to display the relative file number in which a row is stored, issue this statement:
SQL> select dbms_rowid.rowid_relative_fno(rowid), emp_id from emp;
Here is some sample output:
DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID) ————————————5
EMP_ID
———-1
You can use the ROWID value in the SELECT and WHERE clauses of a SQL statement. In most cases, the ROWID uniquely identifies a row. However, it is possible to have rows in different tables that are stored in the same cluster and that therefore contain rows with the same ROWID.