用id做条件,却得到了另外一个值:
select id from table where id=1;
得到的结果却是2,呵呵以前还有次类似情况:
同事发现的问题,很奇怪。
如下sql语句,select rowd from table where pk=v1;
AAASwBAA9AAAY9tAA/
AAASwBAA9AAAY9tAA/
AAASwBAA9AAAY9tABA
AAASwBAA9AAAY9tABA
AAASwBAA9AAAY9tABB
AAASwBAA9AAAY9tABC
AAASwBAA9AAAY9tABF
AAASwBAA9AAAY9tABG
AAASwBAA9AAAY9tABH
AAASwBAA9AAAY9tABI
AAASwBAA9AAAY9tABJ 还是同一张表,还一个查询select rowid from table where unid=v2
AAASwBAA9AAAY9tAA/
AAASwBAA9AAAY9tABA
AAASwBAA9AAAY9tABB
AAASwBAA9AAAY9tABC
AAASwBAA9AAAY9tABD
AAASwBAA9AAAY9tABE
AAASwBAA9AAAY9tABF
AAASwBAA9AAAY9tABG
AAASwBAA9AAAY9tABH
AAASwBAA9AAAY9tABI
AAASwBAA9AAAY9tABJ
比较一下,很吃惊吧。
查询的结果确实应该是11条记录。但第一个查询结果居然得到了两组相同的rowid环境是oracle 9i,在HP平台
不知大家是否遇到过类似问题?欢迎大家讨论讨论原因看!
select id from table where id=1;
得到的结果却是2,呵呵以前还有次类似情况:
同事发现的问题,很奇怪。
如下sql语句,select rowd from table where pk=v1;
AAASwBAA9AAAY9tAA/
AAASwBAA9AAAY9tAA/
AAASwBAA9AAAY9tABA
AAASwBAA9AAAY9tABA
AAASwBAA9AAAY9tABB
AAASwBAA9AAAY9tABC
AAASwBAA9AAAY9tABF
AAASwBAA9AAAY9tABG
AAASwBAA9AAAY9tABH
AAASwBAA9AAAY9tABI
AAASwBAA9AAAY9tABJ 还是同一张表,还一个查询select rowid from table where unid=v2
AAASwBAA9AAAY9tAA/
AAASwBAA9AAAY9tABA
AAASwBAA9AAAY9tABB
AAASwBAA9AAAY9tABC
AAASwBAA9AAAY9tABD
AAASwBAA9AAAY9tABE
AAASwBAA9AAAY9tABF
AAASwBAA9AAAY9tABG
AAASwBAA9AAAY9tABH
AAASwBAA9AAAY9tABI
AAASwBAA9AAAY9tABJ
比较一下,很吃惊吧。
查询的结果确实应该是11条记录。但第一个查询结果居然得到了两组相同的rowid环境是oracle 9i,在HP平台
不知大家是否遇到过类似问题?欢迎大家讨论讨论原因看!
先是程序出错,然后观察分析,发现用sql语句得到了如下结果。
表做过partition,我怀疑是分区引起的。
真实的sql语句应该类似这样:
select id from table where partitionKey='key1' and id=1;
这时得到的结果是2
而如果直接使用
select id from table where id=1;
得到的结果还是1
后来是在pl/sql developer中用
select id from table where partitionKey='key1' and id=1;
做测试,不会是变量名和字段名相同的原因。
表做的是LIST分区。
我不是DBA,具体有些配置不是很清楚。
该问题已经没有了,DBA说并没做什么操作,不过我估计可能有人重建了索引,比较乱,谁也不知原因。