
CHADI E. answered 07/10/19
PhD in Systems Engineering with 8+ years expereince in Oracle SQL
The format you used for display the columns with month names is not correct
you will need to use the format
'value' AS month name
where value is either empty or month name if match the month number
I updated your code (see below) with the correct format above:
:
declare p SYS_REFCURSOR;
begin
if (:month)=02 then
open p for
select 'bazisev' as evtipus, month-1 as month, 'january' AS january, '' AS february from db.tablename
where month=(:month)-1
and sorszam between 4 and 15
union all
select 'targyev' as evtipus, month, '' AS january, 'february' AS february from db.tablename
where month=(:month)
and sorszam between 4 and 15
union all
select 'targyev/bazisev' as evtipus, month, '' AS january, 'february' AS februaryfrom db.tablename
where month=(:month)
and sorszam between 32 and 39
order by sorszam;
elsif (:month)=01 then
open p
for select 'bazisev' as evtipus, month-1 as month, '' AS january from db.tablename
where month=(:month)-1
and sorszam between 4 and 15
union all
select 'targyev' as evtipus, month, 'january' AS january from db.tablename
where month=(:month) and sorszam between 4 and 15
union all
select 'targyev/bazisev' as evtipus, month, 'january' AS january from db.tablename
where month=(:month) and sorszam between 32 and 39
order by sorszam;
end if; end
Hope this helps!