According to oracle documentation, a function PIVOTdoes not support a subquery in a sentence IN, but it is possible in an PIVOTXML function . For instance.
SELECT *
FROM table_name
PIVOT
(
SUM(column_name_1)
FOR [column_name_2] IN (['Output_Column1'],['Output_Column2'])
)
AS aliasName
I need to replace ['Output_Column1'],['Output_Column2']with a subquery.
Is there any other function equivalent PIVOTwhere we can put a subquery instead of hard-coding all output columns or even the function itself PIVOT?
source
share