DBMS_ROWID

The DBMS_ROWID package lets you create ROWIDs and obtain information about ROWIDs from PL/SQL programs and SQL statements. You can find the data block number, the object number, and other ROWID components without writing code to interpret the base-64 character external ROWIDDBMS_ROWID is intended for upgrading from Oracle database version 7 to Oracle database version 8.X.

Summary of DBMS_ROWID Subprograms

Table 126-5 DBMS_ROWID Package Subprograms

SubprogramDescription

ROWID_BLOCK_NUMBER Function

Returns the block number of a ROWID

ROWID_CREATE Function

Creates a ROWID, for testing only

ROWID_INFO Procedure

Returns the type and components of a ROWID

ROWID_OBJECT Function

Returns the object number of the extended ROWID

ROWID_RELATIVE_FNO Function

Returns the file number of a ROWID

ROWID_ROW_NUMBER Function

Returns the row number

ROWID_TO_ABSOLUTE_FNO Function

Returns the absolute file number associated with the ROWID for a row in a specific table

ROWID_TO_EXTENDED Function

Converts a ROWID from restricted format to extended

ROWID_TO_RESTRICTED Function

Converts an extended ROWID to restricted format

ROWID_TYPE Function

Returns the ROWID type: 0 is restricted, 1 is extended

ROWID_VERIFY Function

Checks if a ROWID can be correctly extended by the ROWID_TO_EXTENDED function


红色部分标出的经常用到,下面给出相应示例:

SELECT ROWID,
       DBMS_ROWID.ROWID_OBJECT(ROWID) as OBJECT#,
       DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID) as FILE#,
       DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID) as BLOCK#,
       DBMS_ROWID.ROWID_ROW_NUMBER(ROWID) as ROW#,
       T.EMPLOYEE_ID as eid,
       T.FIRST_NAME || T.LAST_NAME as name
  FROM HR.EMPLOYEES T;


可以看到这张表里的记录存放在了两个块中92、93;

如果我们想看看块中的内容,那么我们可以根据文件号和块号来dump出:

SQL> alter system dump datafile 5 block 92;

然后即可查看里面的具体内容,详细信息,请查看老郭的一篇文章:http://www.itpub.net/forum.php?mod=viewthread&tid=1772905

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

搞怪的索引

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值