使用ROWID在Oracle中定位行/记录是否安全? [英] Is it safe to use ROWID to locate a Row/Record in Oracle?

查看:170
本文介绍了使用ROWID在Oracle中定位行/记录是否安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看一个客户端应用程序,该应用程序检索几列,包括ROWID和 以后使用ROWID标识需要更新的行:

I'm looking at a client application which retrieves several columns including ROWID, and later uses ROWID to identify rows it needs to update:

update some_table t set col1=value1
where t.rowid = :selected_rowid

这样做安全吗?在修改表时,行的ROWID可以更改吗?

Is it safe to do so? As the table is being modified, can ROWID of a row change?

推荐答案

从Oracle 8开始,ROWID的格式和大小从8字节更改为10个字节.请注意,ROWID的格式将在您重新组织或导出/导入表.如果是分区表,则在UPDATE期间如果行从一个分区迁移到另一个分区,它也会更改."

"From Oracle 8 the ROWID format and size changed from 8 to 10 bytes. Note that ROWID's will change when you reorganize or export/import a table. In case of a partitioned table, it also changes if the row migrates from a partition to another one during an UPDATE."

http://www.orafaq.com/wiki/ROWID

我会拒绝.如果例如应用程序临时存储ROWID(例如,生成一个可选择项的列表,每个项用ROWID标识,但是该列表将定期重新生成而不存储),则这可能是安全的.但是,如果以任何持久方式使用ROWID,那都是不安全的.

I'd say no. This could be safe if for instance the application stores ROWID temporarily(say generating a list of select-able items, each identified with ROWID, but the list is routinely regenerated and not stored). But if ROWID is used in any persistent way it's not safe.

这篇关于使用ROWID在Oracle中定位行/记录是否安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆