已用时间: 00: 00: 00.47
13:23:28 SQL> select ttt.col1,ttt.col2,ttt.rn-tttt.mrn+1 r
13:23:32 2 from (select col1,col2,rownum rn from (
13:23:32 3 select * from tb order by col2) t) ttt,
13:23:32 4 (select col2,min(rn) mrn from (
13:23:32 5 select col1,col2,rownum rn from (
13:23:32 6 select * from tb order by col2) t
13:23:32 7 ) tt group by col2) tttt
13:23:33 8 where ttt.col2=tttt.col2(+);