1

I know this might seem a bit strange but I want to build a stored procedure that returns some values but I want the first row to be a null value. What I have for the query and returns are

SELECT CONCAT(id, '   ', item)As DisplayBox, id, item FROM table
DisplayBox  id  expense
1   Value2  1   Value2
2   Value3  2   Value3
3   Value4  3   Value4
4   Value5  4   Value5

But I am interested in having a result like

DisplayBox  id  Item
<BlankText> Null <BlankText>
1   Value2  1   Value2
2   Value3  2   Value3
3   Value4  3   Value4
4   Value5  4   Value5
4

2 回答 2

2

您可以使用UNION ALL

SELECT NULL AS DisplayBox, NULL AS id, NULL AS item
UNION ALL
SELECT CONCAT(id, '   ', item)As DisplayBox, id, item FROM table
于 2013-07-24T18:28:41.783 回答
1
SELECT null as displaybox, null as id, null as item from dual
union all
SELECT CONCAT(id, '   ', item)As DisplayBox, id, item FROM table
order by (case when id is null then 0 else 1 end)
于 2013-07-24T18:30:22.040 回答