ROWID_INFO Procedure
This procedure returns information about a ROWID, including its type (restricted or extended), and the components of the ROWID. This is a procedure, and it cannot be used in a SQL statement.
Syntax
DBMS_ROWID.ROWID_INFO ( rowid_in IN ROWID, #输入参数 ts_type_in IN VARCHAR2 DEFAULT 'SMALLFILE', rowid_type OUT NUMBER,#下列几个参数全是输出 参数 object_number OUT NUMBER, relative_fno OUT NUMBER, block_number OUT NUMBER, row_number OUT NUMBER);
Pragmas
pragma RESTRICT_REFERENCES(rowid_info,WNDS,RNDS,WNPS,RNPS);
Parameters
Table 90-8 ROWID_INFO Procedure Parameters
Parameter | Description |
---|---|
rowid_in | ROWID to be interpreted. This determines if the ROWID is a restricted (0) or extended (1) ROWID. |
ts_type_in | The type of the tablespace (bigfile/smallfile) to which the row belongs.
#扩展rowid与限制rowid |
rowid_type | Returns type (restricted/extended).
|
object_number | Returns data object number (rowid_object_undefined for restricted). |
relative_fno | Returns relative file number. |
block_number | Returns block number in this file. |
row_number | Returns row number in this block. |
根据上面编写dbms_rowid.rowid_info的plsql,对于要输入与输出的参数全要定义变量,默认参数可以不用定义对应变量
SQL> r
1 declare
2 v_rowid rowid;
3 v_rowid_type number;
4 v_object_number number;
5 v_relative_fno number;
6 v_block_number number;
7 v_row_number number;
8 begin
9 select rowid into v_rowid from scott.emp where rownum<2;#得到输入变量v_rowid,把它传递给dbms_rowid.rowid_info过程
10 dbms_rowid.rowid_info(v_rowid,v_rowid_type,v_object_number,v_relative_fno,v_block_number,v_row_number);dbms_output.put_line('row id is: '||v_rowid);
11 dbms_output.put_line('rowid type is: '||v_rowid_type);#此处测试仅显示1-2个输出参数,其它同理
12* end;
row id is: AAAMlsAAEAAAAAfAAA
rowid type is: 1
PL/SQL procedure successfully completed.
SQL>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-666426/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-666426/