Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PIVOT without in clause

unknown-2982728Jul 10 2015 — edited Jul 20 2015

I am trying to pivot a table but I don't want to use IN keywork because I want the data dynamic. Because when I use in clause data come in 1 column, I want to see it seperate columns. In other words, I want pivot to use IN clause be dynamic rather than hard-coded values. Is this possible?

select * from (

     select 'id'||rownum ids, T.KEFILKOD from GNL_TEMINATLAR T WHERE T.TEMINATKOD = 71 AND T.MUSTERIKOD = '440'

) pivot (

     max(kefilkod) for ids in ('id') ==> I don't want to use it

);

I read the following thread but Solomon (By the way he is the LEGEND) use for XML

Pivot Command, can the IN clause be dynamic rather than hard-coded values?

Should I craete pipelined table function? Does anyone know the source code of PIVOT table function in the following article?

https://technology.amis.nl/2006/05/24/dynamic-sql-pivoting-stealing-antons-thunder/

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 17 2015
Added on Jul 10 2015
21 comments
5,368 views