最初由 jiang 发布
[B]
在程序中这样使用ROWID, 会不会有问题:
JAVA (JDBC)
从数据库中取出 一批记录(含ROWID), 然后针对每条记录做处理---- 对每条记录数据计算, 然后把结果update 回该记录,
UPDATE TBL
SET RESULT=
WHERE ROWID=v_ROWID;
我想问的是, 若表TBL中的记录发生 行迁移 (或其他什么)的话, 记录的ROWID会不会改变?会不会UPDATE找不到记录或改了其他记录?
[/B]
As others say, rowid still works unless you alter table move tablespace to another tablespace. But using ROWIDs directly may be bad programming practice. To say the least, if you upgrade your database later and if the ROWID format changes, your program may stop working. (But UPDATE TBL SET RESULT= aaa WHERE ROWID=v_ROWID still works.)
Steven Feuerstein in his "Oracle PL/SQL Programming" p.100 "I'm not convinced that the theoretical performance gains of searching by rowid justy its use".
Yong Huang