多用几个SQL语句,限制范围,没次一半,看看结果数据是不是对! 如select count(*) from tablename where colname >'某数值' and colname < '某数值' ;
zmgowin(隐者(龙祖宗)看了大哥的方法,突然认为这样也可以! select a from t1 a where not exists(select * from t1 b where b.a = (to_number(a,'xxxxx')+1));
select * from( select * from ( select to_number(a,'xxxxx') as n1 ,... from t1 order by a ) where rownum > n1 - ?? ) where rownum < 10返回头几条 ??为代码对应起始数值
.... where rownum < n1 - ?? select min(a) from ( select rownum - n1 + ?? as s, a,.... from ( select to_number(a,'xxxxx') as n1 , a, ... from t1 order by a ) ) group by s 可以返回多处断点
select * from (select rownum no,value from 表A) tmp where rawtohex(value)-rawtohex(to_char(no))<>41303000
--testcreate table t(value varchar2(4)); insert into t select 'A001' from dual union select 'A002' from dual union select 'A004' from dual;select * from t; VALU ---- A001 A002 A004select * from (select rownum no,value from t) tmp where rawtohex(value)-rawtohex(to_char(no))<>41303000; NO VALU --------- ---- 3 A004drop table t;
以上结果的第一条即为所查结果,可以用rownum=1限定,只取出所查的那条记录select * from (select rownum no,value from 表A) tmp where rawtohex(value)-rawtohex(to_char(no))<>41303000 and rownum=1;当然查询必须满足value是升序的
如select count(*) from tablename where colname >'某数值' and colname < '某数值' ;
select a from t1 a where not exists(select * from t1 b where b.a = (to_number(a,'xxxxx')+1));
select *
from (
select to_number(a,'xxxxx') as n1 ,...
from t1 order by a
) where rownum > n1 - ??
) where rownum < 10返回头几条
??为代码对应起始数值
where rownum < n1 - ??
select min(a) from (
select rownum - n1 + ?? as s, a,....
from (
select to_number(a,'xxxxx') as n1 , a, ...
from t1 order by a
)
) group by s
可以返回多处断点
insert into t select 'A001' from dual union select 'A002' from dual union select 'A004' from dual;select * from t;
VALU
----
A001
A002
A004select * from (select rownum no,value from t) tmp where rawtohex(value)-rawtohex(to_char(no))<>41303000;
NO VALU
--------- ----
3 A004drop table t;