日期:2014-05-16 浏览次数:21050 次
SQL> with t1 as ( 2 select 'A' c1, 100 c2 from dual union all 3 select 'B' c1, 900 c2 from dual union all 4 select 'C' c1, 2589 c2 from dual union all 5 select 'D' c1, 123.6598 c2 from dual union all 6 select 'E' c1, 900 c2 from dual union all 7 select 'F' c1, 120 c2 from dual union all 8 select 'G' c1, 100 c2 from dual 9 ) 10 select C1,C2, dense_rank() over (order by C2 DESC) MC FROM T1 11 / C1 C2 MC -- ---------- ---------- C 2589 1 E 900 2 B 900 2 D 123.6598 3 F 120 4 A 100 5 G 100 5 7 rows selected
------解决方案--------------------
可见,你的计算并非是2个值都是100,可能有小数位上的误差
------解决方案--------------------
听说这是oracle的一个bug
------解决方案--------------------
没有发现类似的情况
create table t1(c1 varchar2(10),c2 number);
insert into t1 select 'A',100 from dual;
insert into t1 select 'B',900 from dual;
insert into t1 select 'C',2589 from dual;
insert into t1 select 'D',123.6598 from dual;
insert into t1 select 'E',900 from dual;
insert into t1 select 'F',120 from dual;
insert into t1 select 'G',100 from dual;
select c1,c2,dense_rank()over(order by c2 desc) from t1
C 2589 1
E 900 2
B 900 2
D 123.6598 3
F 120 4
A 100 5
G 100 5