I have a table commission_new as output of commission_new table:
when I use the SQL:
select * from
( select employee_no,years ,subtotal from
commission_new
)
pivot
( sum(subtotal) for years in (1999,2001,2000,2003)
--(select distinct nvl(years,0) from commission_new)
)
order by employee_no;
I get the result
but if I use
(select distinct nvl(years,0) from commission_test )
instead of
(1999,2001,2000,2003)
I get the error:
Error at Line: 7 Column: 6 ORA-00936: missing expression
even though the SQL select distinct nvl(years,0) from commission_test
gives the same years as result.
What may be the reason of this?