De PIVOT-operator is geïntroduceerd in Oracle 11gR1 . Uw zoekopdracht werkt prima in die versie of later. In eerdere versies krijgt u die foutmelding:
SQL> SELECT * FROM sales PIVOT (sum(quantity) FOR color IN ('WHITE','DARK'));
SELECT * FROM sales PIVOT (sum(quantity) FOR color IN ('WHITE','DARK'))
*
ERROR at line 1:
ORA-00933: SQL command not properly ended
U lijkt dus geen versie te gebruiken die de operator ondersteunt. In eerdere versies kunt u dezelfde taak handmatig uitvoeren met aggregaties en case-statements:
select item_name, clothes_size,
sum(case when color = 'WHITE' then quantity end) as white,
sum(case when color = 'DARK' then quantity end) as dark
from sales
group by item_name, clothes_size
order by item_name, clothes_size;