Query [message #645273] |
Wed, 02 December 2015 01:09 |
|
I am using following Query
SELECT * FROM
(
SELECT job, deptno,sal
FROM emp
)
PIVOT
(
SUM(SAL)
FOR deptno IN (select to_char(wm_concat(deptno)) from dept)
)
ORDER BY job
Its generate error, But when i fixed the value in For deptno in (10,20,30) its run and generate output.
I do not want to fix the value..
Any Solution Please
|
|
|
Re: Query [message #645278 is a reply to message #645273] |
Wed, 02 December 2015 02:34 |
|
Michel Cadot
Messages: 68645 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
You cannot use a SELECT in the IN clause of PIVOT (unless you use the XML option).
In addition, you should NEVER use "wm_concat" which is for Oracle internal use only and no more exists in 12c. As you are in 11g you can use listagg instead (this is a general answer, you cannot use it for your current issue).
[Updated on: Wed, 02 December 2015 02:35] Report message to a moderator
|
|
|
|
|