oracle返回固定条数的SQL,条数不足以空数据补齐的SQL

使用union all可以从数据库检索固定条数的数据,不足以空数据补齐

--返回10条数据

select t.id,t.contract_num,t.contract_line_num from(

select id,contract_num,contract_line_num from cg_procure_contract_detail 
where contract_num='HT20161027175' 
union all
select null,null,null from dual
union all
select null,null,null from dual
union all
select null,null,null from dual
union all
select null,null,null from dual
union all
select null,null,null from dual
union all
select null,null,null from dual
union all
select null,null,null from dual
union all
select null,null,null from dual
union all
select null,null,null from dual
union all
select null,null,null from dual) t
where rownum<=10;
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页