plsql查询中补入空行--做报表分页挺有用

时间:2021-09-03 11:42:19
/*这行把查询的结果中和10的倍数差查出来*/
with cnt as (select 10-mod(count(*),10) from scott.emp)
select scott.emp.empno,scott.emp.ename
from scott.emp
union all
select null,null
from all_objects where rownum<=(select * from cnt);
/*引用with子句中需要补的空行数目 */
 
结果:
1 7369 SMITH
2 7499 ALLEN
3 7521 WARD
4 7566 JONES
5 7654 MARTIN
6 7698 BLAKE
7 7782 CLARK
8 7788 SCOTT
9 7839 KING
10 7844 TURNER
11 7876 ADAMS
12 7900 JAMES
13 7902 FORD
14 7934 MILLER
15 1000 IVON
16 2313 DSASA
17 2 233
18  
19  
20