Home  >  Article  >  Database  >  What type is rowid in oracle?

What type is rowid in oracle?

下次还敢
下次还敢Original
2024-05-08 19:27:171105browse

ROWID is a proprietary data type in Oracle that uniquely identifies a row in a physical database because it is unique and persistent and can persist when the row is moved or updated. Advantages include fast retrieval, can be obtained using the ROWID pseudo-column, and can be used to quickly find, compare, and move rows.

What type is rowid in oracle?

ROWID Data Type in Oracle

What is ROWID?

ROWID is an Oracle-specific data type that uniquely identifies a row of data in a physical database.

Why use ROWID?

Using ROWID has the following benefits:

  • Uniqueness: Each ROWID is unique in the table space, even in the table This is also true after being deleted, recreated, or imported and exported.
  • Persistence: ROWID does not change when the row is moved or updated.
  • Performance: Retrieving rows identified using ROWID is faster than using other identifiers such as primary keys or unique constraints.

The structure of ROWID

The structure of ROWID depends on the Oracle version:

  • Oracle 10g and earlier : ROWID consists of 18 bytes, including file number, data block address and row identification.
  • Oracle 11g and later: ROWID consists of 10 bytes and contains the file number and data block address, the row identifier is no longer included in the ROWID.

Get ROWID

You can use the ROWID pseudo column to get the ROWID of the row:

<code class="sql">SELECT ROWID FROM table_name WHERE ...;</code>

Use ROWID

ROWID can be used for the following purposes:

  • Find a row: Use ROWID to quickly find a specific row, even if the row identifier (such as the primary key) is unknown.
  • Comparing rows: ROWIDs can be compared to determine whether two rows are physically the same.
  • Row migration: ROWID can be used to move rows between different table spaces or databases.

The above is the detailed content of What type is rowid in oracle?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn