Hi
Version - oracle 19c
I am running the following pivot query. When I am passing dates in the FOR clause query is giving me result but when it passed as subquery it is giving me the error:
sample data:
test_sid table
sales_item buyer sales_item_name mnth qty
100001 57288 KEY HEXAGON 4MM SSH L48 ZN 01-JAN-22 400
100001 57288 KEY HEXAGON 4MM SSH L48 ZN 01-FEB-22 228.57
100001 57288 KEY HEXAGON 4MM SSH L48 ZN 01-MAR-22 371.43
100001 57288 01-APR-22 0
100001 57288 01-MAY-22 0
100001 57288 01-JUN-22 0
Query:
select * from
(
select sales_item, buyer, sales_item_name, mnth, qty
from test_sid
)
pivot
( sum(qty)
for mnth in ('01-JAN-2022','01-FEB-2022','01-MAR-2022','01-APR-2022','01-MAY-2022')
-- for mnth in (select distinct mnth from test_sid order by 1)
)
;
error - ORA-00936: missing expression
00936. 00000 - "missing expression"
Regards,
Sid
Sid