Toad World® Forums

syntax error with PIVOT

  SQL> SELECT *
FROM (SELECT deptno, sal, job FROM emp)
JOIN (SELECT deptno, loc FROM dept) USING (deptno)
pivot (sum(sal) for job in ('ANALYST','SALESMAN','CLERK'))
DEPTNO LOC 'ANALYST' 'SALESMAN' 'CLERK'
---------- ------------- ---------- ---------- ----------
20 DALLAS 6000 1900
10 NEW YORK 1300
30 CHICAGO 5600 950

The QP5 v5.277 Formatter reports : [Error] Syntax check (7: 1):