官網說明
owid的定義:A globally unique address for a row in a database.
rowid 分為extended rowid 和 restricted rowied.
1.1 Restricted ROWID
Internally, the ROWID is a structure that holds information that the database server needs to access a row.The restricted internal ROWID is 6 bytes on most platforms.
Each restricted rowid includes the following data:
(1)Datafile identifier
(2)Block identifier
(3)Row identifier
The restricted ROWID pseudocolumn is returned to client applications in the form of an18-character string with a hexadecimal encoding of the datablock, row, and datafile components of the ROWID.
1.2 Extended ROWID
The extended ROWID datatype includes the data in the restricted rowid plus a data object number. The data object number is an identification number assigned to every database segment.The
extended internal ROWID is 10 bytes on most platforms.
Data in an extended ROWID pseudocolumn is returned to the client application in the form ofan 18-character string (for example, "AAAA8mAALAAAAQkAAA"), which represents a base 64 encoding of the components
of the extended ROWID in a four-piece format,OOOOOOFFFBBBBBBRRR.
Extended rowids are not available directly. You canuse a supplied package, DBMS_ROWID, to interpret extended rowid contents. The package functions extract and provide information that would be available
directly from a restricted rowid as well as information specific to extended rowids.
oracle 的rowid是啥意思
---------------------------------------------------------------
rowid是資料庫的一個偽列,建立表的時候資料庫會自動為每個表建立ROWID列
用來唯一標識一行記錄。
rowid是儲存每條記錄的實際物理地址,對記錄的訪問是基於ROWID。
---------------------------------------------------------------
每條記錄的物理地址,
對資料庫中記錄行的作快檢索方式就是使用rowid來進行尋找。
---------------------------------------------------------------
唯一標識一行記錄
select rowid,* from 表名
試一下,你就明白了
---------------------------------------------------------------
rowid就象是郵遞員送信時要找的信封上的家庭地址一樣,每個rowid都不會重複,oracle尋找通過它可以更快地尋找到資料.
---------------------------------------------------------------
rowid是一個偽列,對應 塊號,行號,行的序號..
---------------------------------------------------------------
ROWID
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
0000000F.000A.0002 ADAMS
0000000F.000C.0002 FORD
---------------------------------------------------------------
Pseudocolumns
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:
* CURRVAL
* NEXTVAL
* LEVEL
* ROWID
* ROWNUM
---------------------------------------------------------------
偽列:
偽列如同資料表的列,但它實際上不儲存在表中
你可以從這些偽列中提取值
但你不能將值插入、更新或者刪除它們
以下描述了這些偽列:
---------------------------------------------------------------
oracle資料庫中美一條記錄的唯一標識。