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

2 Answers 2

2

You can use UNION ALL:

SELECT NULL AS DisplayBox, NULL AS id, NULL AS item
UNION ALL
SELECT CONCAT(id, '   ', item)As DisplayBox, id, item FROM table
Sign up to request clarification or add additional context in comments.

Comments

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)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.