Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
24
Добавлен:
16.04.2013
Размер:
4.96 Mб
Скачать

Addressing Rows Directly with the ROWID Datatype

See Also: PL/SQL Packages and Types Reference for information about using the DBMS_ROWID package functions to get the data object identifier in other ways

Different Forms of the ROWID

Oracle Database documentation uses the term ROWID in different ways, depending on context.

ROWID Pseudocolumn Each table and nonjoined view has a pseudocolumn called ROWID. For example:

CREATE TABLE T_tab (col1 Rowid);

INSERT INTO T_tab SELECT Rowid FROM Emp_tab WHERE Empno = 7499;

This command returns the ROWID pseudocolumn of the row of the EMP_TAB table that satisfies the query, and inserts it into the T1 table.

Internal ROWID The internal ROWID is an internal structure that holds information that the server code needs to access a row. The restricted internal ROWID is 6 bytes on most platforms; the extended ROWID is 10 bytes on these platforms.

External Character ROWID The extended ROWID pseudocolumn is returned to the client in the form of an 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:

OOOOOO: The data object number identifies the database segment (AAAA8m in the example). Schema objects in the same segment, such as a cluster of tables, have the same data object number.

FFF: The datafile that contains the row (file AAL in the example). File numbers are unique within a database.

BBBBBB: The data block that contains the row (block AAAAQk in the example). Block numbers are relative to their datafile, not tablespace. Therefore, two rows with identical block numbers could reside in two different datafiles of the same tablespace.

RRR: The row in the block (row AAA in the example).

There is no need to decode the external ROWID; you can use the functions in the DBMS_ROWID package to obtain the individual components of the extended ROWID.

Selecting a Datatype 2-37

Соседние файлы в папке Oracle 10g