查询结果中的冗余空白行

时间:2015-06-01 06:42:23

标签: oracle

我有这个sql:

with p_1 as
(
    select 1 sorszam, 'X1' tipus from dual
    union all select 2 sorszam, 'X2' tipus from dual
    union all select 3 sorszam, 'X3' tipus from dual
)
select (
    (case when p1.sorszam=1 then ('[' || chr(13) || chr(10)) else '' end) || 
    p1.tipus 
    || (case when p1.sorszam=(select max(sorszam) from p_1) then (chr(13) || chr(10) || ']') else '' end)
    ) szoveg
from p_1 p1
order by p1.sorszam

结果是:

SZOVEG
--------
[
X1

X2
X3
]

我的问题是:为什么第一行后面会出现空白?

1 个答案:

答案 0 :(得分:0)