Prof.Optimist
Prof.Optimist

Reputation: 1

How to add new rows to SQL results?

I am trying to automate one of the report but I am having difficulties due to adjustments which takes place manually. I need to add new rows to my results approximately 40-50 new rows.

Sample of my query:

Select


CASE WHEN... end as F_Code
,CASE ... end as F_Position
,Round ... balance_eur

 --Merging columns--              
,F_Position||';;'||F_Code||';'||balance_eur||';;;' "1X209;JE;10;100;4;2018;UU"

from ODS.SAP_GL_BALANCES SGLB;

My results;

F_POSITION  F_CODE   BALANCE_EUR      1X209;JE;10;100;4;2018;UU
931112510   13150    -892704.53       931112510;;13150;-896382,31;;;

How can I add multiple rows into my results such as;

F_POSITION  F_CODE   BALANCE_EUR      1X209;JE;10;100;4;2018;UU
931112510   13150    -892704.53       931112510;;13150;-896382,31;;;
95XXXXXXX   15000     12.12           95XXXXXXX;;15000;12,12;;;
93XXXXXXX   14000     187.18          93XXXXXXX;;14000;187,18;;;
93XXXXXXX   14000    -35.56           93XXXXXXX;;14000;-35,56;;;

Upvotes: 0

Views: 94

Answers (1)

Thorsten Kettner
Thorsten Kettner

Reputation: 94914

Use UNION ALL to add rows manually to your result:

SELECT ... -- your query
UNION ALL
select '95XXXXXXX', 15000, 12.12, '95XXXXXXX;;15000;12,12;;;' from dual
UNION ALL
select '93XXXXXXX', 14000, 187.18, '93XXXXXXX;;14000;187,18;;;' from dual
UNION ALL
select '93XXXXXXX', 14000, -35.56, '93XXXXXXX;;14000;-35,56;;;' from dual;

Upvotes: 1

Related Questions