您的位置:首页 > 其它

ROWID and ROWNUM

2006-08-22 11:10 471 查看

ROWID and ROWNUM

ROWID:
   Before the release of Oracle8, ROWID datatype was used to store the physical address of each row of each table, as a hexadecimal number. You can use character host variables to store rowids in a readable format. When you SELECT or FETCH a rowid into a character host variable, Oracle converts the binary value to an 18-byte character string and returns it in the format BBBBBBBB.RRRR.FFFF ,where BBBBBBBB is the block in the database file, RRRR is the row in the block (the first row is 0), and FFFF is the database file. These numbers are hexadecimal. For example, the rowid  0000000E.000A.0007 points to the 11th row in the 15th block in the 7th database file.

ROWNUM:
   ROWNUM returns a number indicating the order in which a row was selected from a table.The first row selected has a ROWNUM of 1, the second row has a ROWNUM of 2, and so on. If a SELECT statement includes an ORDER BY clause, ROWNUMs are assigned to the retrieved rows before the sort is done.

Some Explain in Chinese:
ROWID: 数据库内部存放数据地址
ROWNUM:  选取的行数

ROWID是oracle数据文件管理的标识,信息放在第几块了,第几行了
ROWNUM是表的是逻辑上的第几行

ROWID相当于oracle数据库管理的主键,甚至就可以以它作为所在表的主键
ROWNUM应该是行号,并且顺序排列,根据你的select语句的执行动态生成

posted on 2006-08-22 11:10 Angus 阅读(...) 评论(...) 编辑 收藏

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: