Oracle10gdbms_rowid包源码

2024-05-29 21:48
文章标签 源码 rowid oracle10gdbms

本文主要是介绍Oracle10gdbms_rowid包源码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

原 Oracle 10g dbms_rowid 包源码https://blog.csdn.net/tianlesoftware/article/details/6697761版权声明: https://blog.csdn.net/tianlesoftware/article/details/6697761

前几天Roger 的blog 更新了一篇文章,是DBMS_ROWID包的定义部分,Oracle 的包的都是用wrap 进行加密的。itpub上有人研究了unwrap,也公布了一些代码,可以实现unwrap。


关于wrap和unwrap,参考我的blog:
Oracle wrap 和 unwrap( 加密与解密) 说明
http://www.cndba.cn/Dave/article/1367


rowid在DB 维护中用的也是比较多。 了解ROWID 的相关函数,有助于工作。 
Oracle Rowid 介绍
http://blog.csdn.net/tianlesoftware/article/details/5020718

Roger贴的那部分没有只有代码,没有注释,所以这里用Toad 把注释部分也拉出来了。贴一下。也可以直接用SQL 查看:
SQL>select text from dba_source where name='DBMS_ROWID'; 
  /* Formatted on2011/8/18 11:26:49 (QP5 v5.163.1008.3004) */
CREATE OR REPLACE PACKAGE SYS.DBMS_ROWID
IS
   ------------
   --  OVERVIEW
   --
   --  This package provides procedures to createROWIDs and to interpret
   --  their contents
     --  SECURITY
   --
   --  The execution privilege is granted to PUBLIC.Procedures in this
   --  package run under the caller security.
       ----------------------------
     ----------------------------
     --  ROWID TYPES:
   --
   --   RESTRICTED - Restricted ROWID
   --
   --   EXTENDED  - Extended ROWID
   --
   rowid_type_restricted    CONSTANT INTEGER := 0;
   rowid_type_extended      CONSTANT INTEGER := 1;
     --  ROWID VERIFICATION RESULTS:
   --
   --   VALID  - Valid ROWID
   --
   --   INVALID - Invalid ROWID
   --
   rowid_is_valid           CONSTANT INTEGER := 0;
   rowid_is_invalid         CONSTANT INTEGER := 1;
     --  OBJECT TYPES:
   --
   --   UNDEFINED - Object Number not defined (forrestricted ROWIDs)
   --
   rowid_object_undefined   CONSTANT INTEGER := 0;
     --  ROWID CONVERSION TYPES:
   --
   --   INTERNAL - convert to/from column of ROWIDtype
   --
   --   EXTERNAL - convert to/from string format
   --
   rowid_convert_internal   CONSTANT INTEGER := 0;
   rowid_convert_external   CONSTANT INTEGER := 1;
     --  EXCEPTIONS:
   --
   --ROWID_INVALID  - invalid rowid format
   --
   --ROWID_BAD_BLOCK - block is beyond end of file
   --
   ROWID_INVALID                     EXCEPTION;
   PRAGMA EXCEPTION_INIT (ROWID_INVALID, -1410);
   ROWID_BAD_BLOCK                   EXCEPTION;
   PRAGMA EXCEPTION_INIT (ROWID_BAD_BLOCK, -28516);
     --  PROCEDURES AND FUNCTIONS:
   --
     --
   --ROWID_CREATE constructs a ROWID from its constituents:
   --
   --rowid_type - type (restricted/extended)
   --object_number - data object number (rowid_object_undefined for restricted)
   --relative_fno - relative file number
   --block_number - block number in this file
   --file_number - file number in this block
   --
   FUNCTION rowid_create (rowid_type      IN NUMBER,
                          object_number   IN NUMBER,
                          relative_fno    IN NUMBER,
                          block_number    IN NUMBER,
                          ROW_NUMBER      IN NUMBER)
      RETURN ROWID;
     PRAGMA RESTRICT_REFERENCES (rowid_create, WNDS, RNDS, WNPS, RNPS);
     --
   --ROWID_INFO breaks ROWID into its components and returns them:
   --
   --rowid_in - ROWID to be interpreted
   --rowid_type - type (restricted/extended)
   --object_number - data object number (rowid_object_undefined for restricted)
   --relative_fno - relative file number
   --block_number - block number in this file
   -- file_number - file number in this block
   --ts_type_in - type of tablespace which this row belongs to
   --              'BIGFILE' indicates BigfileTablespace
   --              'SMALLFILE' indicates Smallfile(traditional pre-10i) TS.
   --              NOTE: These two are the onlyallowed values for this param
   --
   PROCEDURE rowid_info (rowid_in        IN     ROWID,
                         rowid_type         OUT NUMBER,
                         object_number      OUT NUMBER,
                         relative_fno       OUT NUMBER,
                         block_number       OUT NUMBER,
                         ROW_NUMBER         OUT NUMBER,
                         ts_type_in      IN     VARCHAR2 DEFAULT 'SMALLFILE');
     PRAGMA RESTRICT_REFERENCES (rowid_info, WNDS, RNDS, WNPS, RNPS);
     --
   --ROWID_TYPE returns the type of a ROWID (restricted/extended_nopart,..)
   --
   --row_id - ROWID to be interpreted
   --
   FUNCTION rowid_type (row_idIN ROWID)
      RETURN NUMBER;
     PRAGMA RESTRICT_REFERENCES (rowid_type, WNDS, RNDS, WNPS, RNPS);
     --
   --ROWID_OBJECT extracts the data object number from a ROWID.
   --ROWID_OBJECT_UNDEFINED is returned for restricted rowids.
   --
   --row_id - ROWID to be interpreted
   --
   FUNCTION rowid_object (row_idIN ROWID)
      RETURN NUMBER;
     PRAGMA RESTRICT_REFERENCES (rowid_object, WNDS, RNDS, WNPS, RNPS);
     --
   --ROWID_RELATIVE_FNO extracts the relative file number from a ROWID.
   --
   --row_id - ROWID to be interpreted
   --ts_type_in - type of tablespace which this row belongs to
   --
   FUNCTION rowid_relative_fno (row_id       IN ROWID,
                                ts_type_in   IN VARCHAR2 DEFAULT 'SMALLFILE')
      RETURN NUMBER;
     PRAGMA RESTRICT_REFERENCES (rowid_relative_fno, WNDS, RNDS, WNPS, RNPS);
     --
   --ROWID_BLOCK_NUMBER extracts the block number from a ROWID.
   --
   --row_id - ROWID to be interpreted
   --ts_type_in - type of tablespace which this row belongs to
   --
   --
   FUNCTION rowid_block_number (row_id       IN ROWID,
                                ts_type_in   IN VARCHAR2 DEFAULT 'SMALLFILE')
      RETURN NUMBER;
     PRAGMA RESTRICT_REFERENCES (rowid_block_number, WNDS, RNDS, WNPS, RNPS);
     --
   --ROWID_ROW_NUMBER extracts the row number from a ROWID.
   --
   --row_id - ROWID to be interpreted
   --
   FUNCTION rowid_row_number (row_id IN ROWID)
      RETURN NUMBER;
     PRAGMA RESTRICT_REFERENCES (rowid_row_number, WNDS, RNDS, WNPS, RNPS);
     --
   --ROWID_TO_ABSOLUTE_FNO extracts the relative file number from a ROWID,
   --which addresses a row in a given table
   --
   --row_id - ROWID to be interpreted
   --
   --schema_name - name of the schema which contains the table
   --
   --object_name - table name
   --
   FUNCTION rowid_to_absolute_fno (row_id        IN ROWID,
                                  schema_name   IN VARCHAR2,
                                  object_name   IN VARCHAR2)
      RETURN NUMBER;
     PRAGMA RESTRICT_REFERENCES (rowid_to_absolute_fno, WNDS, WNPS, RNPS);
     --
   --ROWID_TO_EXTENDED translates the restricted ROWID which addresses
   -- arow in a given table to the extended format. Later, it may be removed
   --from this package into a different place
   --
   --old_rowid - ROWID to be converted
   --
   --schema_name - name of the schema which contains the table (OPTIONAL)
   --
   --object_name - table name (OPTIONAL)
   --
   --conversion_type - rowid_convert_internal/external_convert_external
   --                   (whether old_rowid wasstored in a column of ROWID
   --                    type, or the characterstring)
   --
   FUNCTION rowid_to_extended (old_rowid         IN ROWID,
                               schema_name       IN VARCHAR2,
                               object_name       IN VARCHAR2,
                              conversion_type   IN INTEGER)
      RETURN ROWID;
     PRAGMA RESTRICT_REFERENCES (rowid_to_extended, WNDS, WNPS, RNPS);
     --
   --ROWID_TO_RESTRICTED translates the extnded ROWID into a restricted format
   --
   --old_rowid - ROWID to be converted
   --
   --conversion_type - internal/external (IN)
   --
   --conversion_type - rowid_convert_internal/external_convert_external
   --                   (whetherreturned rowid will be stored in a column of
   --                    ROWID type, or thecharacter string)
   --
   FUNCTION rowid_to_restricted (old_rowid         IN ROWID,
                                conversion_type   IN INTEGER)
      RETURN ROWID;
     PRAGMA RESTRICT_REFERENCES (rowid_to_restricted, WNDS, RNDS, WNPS, RNPS);
     --
   --ROWID_VERIFY verifies the ROWID. It returns rowid_valid or rowid_invalid
   --value depending on whether a given ROWID is valid or not.
   --
   --rowid_in - ROWID to be verified
   --
   --schema_name - name of the schema which contains the table
   --
   --object_name - table name
   --
   --conversion_type - rowid_convert_internal/external_convert_external
   --                   (whether old_rowid wasstored in a column of ROWID
   --                    type, or the characterstring)
   --
   FUNCTION rowid_verify (rowid_in          IN ROWID,
                          schema_name       IN VARCHAR2,
                          object_name       IN VARCHAR2,
                          conversion_type   IN INTEGER)
      RETURN NUMBER;
     PRAGMA RESTRICT_REFERENCES (rowid_verify, WNDS, WNPS, RNPS);
END;
/
            -------------------------------------------------------------------------------------------------------
QQ:492913789
Email:ahdba@qq.com
Blog:  http://www.cndba.cn/dave
Weibo:   http://weibo.com/tianlesoftware
Twitter:  http://twitter.com/tianlesoftware
Facebook: http://www.facebook.com/tianlesoftware
Linkedin: http://cn.linkedin.com/in/tianlesoftware
DBA1 群:62697716(满);   DBA2 群:62697977(满)  DBA3 群:62697850(满)  
DBA 超级群:63306533(满);  DBA4 群: 83829929(满) DBA5群: 142216823(满) 
DBA6 群:158654907(满)  聊天 群:40132017(满)   聊天2群:69087192(满)
--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请https://img-blog.csdnimg.cn/20190217105710569.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTEwNzgxNDE=,size_16,color_FFFFFF,t_70《算法导论 第三版英文版》_高清中文版.pdf
https://pan.baidu.com/s/17D1kXU6dLdU0YwHM2cvNMw
《深度学习入门:基于Python的理论与实现》_高清中文版.pdf
https://pan.baidu.com/s/1IeVs35f3gX5r6eAdiRQw4A
《深入浅出数据分析》_高清中文版.pdf
https://pan.baidu.com/s/1GV-QNbtmjZqumDkk8s7z5w
《Python编程:从入门到实践》_高清中文版.pdf
https://pan.baidu.com/s/1GUNSg4mdpeOf1LC_MjXunQ
《Python科学计算》_高清中文版.pdf
https://pan.baidu.com/s/1-hDKhK-7rDDFll_UFpKmpw

这篇关于Oracle10gdbms_rowid包源码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!


原文地址:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.chinasem.cn/article/1014725

相关文章

mysql查询使用_rowid虚拟列的示例

《mysql查询使用_rowid虚拟列的示例》MySQL中,_rowid是InnoDB虚拟列,用于无主键表的行ID查询,若存在主键或唯一列,则指向其,否则使用隐藏ID(不稳定),推荐使用ROW_NUM... 目录1. 基本查询(适用于没有主键的表)2. 检查表是否支持 _rowid3. 注意事项4. 最佳实

8种快速易用的Python Matplotlib数据可视化方法汇总(附源码)

《8种快速易用的PythonMatplotlib数据可视化方法汇总(附源码)》你是否曾经面对一堆复杂的数据,却不知道如何让它们变得直观易懂?别慌,Python的Matplotlib库是你数据可视化的... 目录引言1. 折线图(Line Plot)——趋势分析2. 柱状图(Bar Chart)——对比分析3

Oracle 通过 ROWID 批量更新表的方法

《Oracle通过ROWID批量更新表的方法》在Oracle数据库中,使用ROWID进行批量更新是一种高效的更新方法,因为它直接定位到物理行位置,避免了通过索引查找的开销,下面给大家介绍Orac... 目录oracle 通过 ROWID 批量更新表ROWID 基本概念性能优化建议性能UoTrFPH优化建议注

Android实现一键录屏功能(附源码)

《Android实现一键录屏功能(附源码)》在Android5.0及以上版本,系统提供了MediaProjectionAPI,允许应用在用户授权下录制屏幕内容并输出到视频文件,所以本文将基于此实现一个... 目录一、项目介绍二、相关技术与原理三、系统权限与用户授权四、项目架构与流程五、环境配置与依赖六、完整

Android实现定时任务的几种方式汇总(附源码)

《Android实现定时任务的几种方式汇总(附源码)》在Android应用中,定时任务(ScheduledTask)的需求几乎无处不在:从定时刷新数据、定时备份、定时推送通知,到夜间静默下载、循环执行... 目录一、项目介绍1. 背景与意义二、相关基础知识与系统约束三、方案一:Handler.postDel

Java 正则表达式URL 匹配与源码全解析

《Java正则表达式URL匹配与源码全解析》在Web应用开发中,我们经常需要对URL进行格式验证,今天我们结合Java的Pattern和Matcher类,深入理解正则表达式在实际应用中... 目录1.正则表达式分解:2. 添加域名匹配 (2)3. 添加路径和查询参数匹配 (3) 4. 最终优化版本5.设计思

Java调用C++动态库超详细步骤讲解(附源码)

《Java调用C++动态库超详细步骤讲解(附源码)》C语言因其高效和接近硬件的特性,时常会被用在性能要求较高或者需要直接操作硬件的场合,:本文主要介绍Java调用C++动态库的相关资料,文中通过代... 目录一、直接调用C++库第一步:动态库生成(vs2017+qt5.12.10)第二步:Java调用C++

Python实现无痛修改第三方库源码的方法详解

《Python实现无痛修改第三方库源码的方法详解》很多时候,我们下载的第三方库是不会有需求不满足的情况,但也有极少的情况,第三方库没有兼顾到需求,本文将介绍几个修改源码的操作,大家可以根据需求进行选择... 目录需求不符合模拟示例 1. 修改源文件2. 继承修改3. 猴子补丁4. 追踪局部变量需求不符合很

Spring 中 BeanFactoryPostProcessor 的作用和示例源码分析

《Spring中BeanFactoryPostProcessor的作用和示例源码分析》Spring的BeanFactoryPostProcessor是容器初始化的扩展接口,允许在Bean实例化前... 目录一、概览1. 核心定位2. 核心功能详解3. 关键特性二、Spring 内置的 BeanFactory

Go中sync.Once源码的深度讲解

《Go中sync.Once源码的深度讲解》sync.Once是Go语言标准库中的一个同步原语,用于确保某个操作只执行一次,本文将从源码出发为大家详细介绍一下sync.Once的具体使用,x希望对大家有... 目录概念简单示例源码解读总结概念sync.Once是Go语言标准库中的一个同步原语,用于确保某个操