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 hardcoding values for IN clause

user626688Apr 25 2019 — edited Apr 26 2019

Hi I am using oracle 11g R2. Just wondering if there is a way I can PIVOT date values into columns by havingĀ  a subquery within the IN clause. This way I can dynamically get the values as columns rather than punching each value in the IN clause.

Thanks for you help!.

Regards

select * from

(select trans_date, amt from sales where trans_date between '01/01/2019' and '01/15/2019')

) pivot

(sum(amt) for trans_date in (--can we use a subquery instead of hardcoding the values)

)

Comments
Post Details
Added on Apr 25 2019
9 comments
21,478 views