日期:2014-05-16  浏览次数:20470 次

Oracle中查询第N到M条记录

select *

from (select rownum rn , t.* from table table t)

where rn between n and m

?

[注:] ROWNUM 必须重命名为RN或者是其他的一个虚拟名字

?

------------------------以下是更新第N到M条的记录时所需要注意的问题----------------------------

?

update table t set t.price='88'

where t.code in ( select t.code

??????????????????????????? from ( select rownum rn , t1.* from table t where t1) t

????????????????????????????where rn between n and m )

[注:] price 是该表要更新的字段名, code是该表的唯一标识字段

oracle会自动排序.