概述
Oracle不支持select top语句,在Oracle中经常是用order by跟rownum
select 列名1 ...列名n from
(
select 列名1 ...列名n
from 表名 order by 列名1
)
where rownum <=N(抽出记录数)
order by rownum asc
如:按姓名排序取出前十条数据
select id,name from (select id,name from student order by name) where rownum<=10 order by rownum asc
查询车辆表前100万条数据(按照id排序,主键id是Number类型):
select ID,
CASEID,
PARTYID,
VEHICLENO,
TAGCOLOR,
TCERTIFICATIONCODE,
RTCISSUER,
ROUTINENO,
VEHICLEBRAND,
VEHICLETYPEID,
OWNERUNIT,
OWNERUNITTYPEID,
DRIVINGSTATEID,
INSURANCECOMPANYID,
UPDATETIME,
UPDATEACCOUNTID,
TAGEXCEPTIONTYPEID,
VEHICLEINDENTIFYID,
REGISTERTIME,
INSURANCENO,
WEIGHT,
APPLYHEIGHT,
APPLYWIDTH,
APPLYLENGTH,
BASICCODEID
from (select ID,
CASEID,
PARTYID,
VEHICLENO,
TAGCOLOR,
TCERTIFICATIONCODE,
RTCISSUER,
ROUTINENO,
VEHICLEBRAND,
VEHICLETYPEID,
OWNERUNIT,
OWNERUNITTYPEID,
DRIVINGSTATEID,
INSURANCECOMPANYID,
UPDATETIME,
UPDATEACCOUNTID,
TAGEXCEPTIONTYPEID,
VEHICLEINDENTIFYID,
REGISTERTIME,
INSURANCENO,
WEIGHT,
APPLYHEIGHT,
APPLYWIDTH,
APPLYLENGTH,
BASICCODEID
from TC_VEHICLE
order by id)
where rownum <= 1000000
order by id asc
最后
以上就是朴实酸奶为你收集整理的Oracle查询前100万条数据的全部内容,希望文章能够帮你解决Oracle查询前100万条数据所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复