是这样的 在每次查询的时候
要求查询结果不足6条的时候 对不足的数据补上null植
是不是要求有点变态
SQL> desc sun
Name Null? Type
----------------------------------------- -------- ---------------------
A NUMBER
B NUMBER
C CHAR(2)
SQL> desc sun1
Name Null? Type
----------------------------------------- -------- ---------------------
NO NUMBER
SQL> select * from sun;
A B C
---------- ---------- --
1 1 x
2 2 x
2 3 x
2 5 x
1 7 x
1 234 x
6 rows selected.
SQL> select * from sun1;
NO
----------
1
2
3
4
5
6
6 rows selected.
SQL> select * from sun where a=1;
A B C
---------- ---------- --
1 1 x
1 7 x
1 234 x
SQL>
1 select b.no,
2 case when a.rno<=(select count(*) from sun where a=1) then
3 a.b else null end b,
4 case when a.rno<=(select count(*) from sun where a=1) then
5 a.c else null end c
6 from sun1 b,(select rownum rno,b,c from sun where a=1) a
7* where a.rno(+)=b.no
SQL> /
NO B C
---------- ---------- --
1 1 x
2 7 x
3 234 x
6
5
4
6 rows selected.
当然还可以采用decode等来实现
在这里只能算是抛砖引玉了
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/39335/viewspace-351734/ ,如需转载,请注明出处,否则将追究法律责任。