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

3323435Oct 28 2016 — edited Oct 28 2016

Hi, I need some help using the PIVOT clause.

I have a table which has been previously pivoted (or unpivoted, not sure which) so that each row has been split into its separate parts with row_numbers assigned in a new column REF_ROW_NO.

Capture.JPG

I need to reverse this back to its previous format so I can compare some other data to it

I have managed to get the desired results with a self-join and some filtering, though this is quite an untidy approach.

How do I do it with the PIVOT clause, so that I have a column for VALUE_DESC and a column for VALUE_ID for each REF_ROW_NO

So fro example, the first row would be:

REF_ROW_NO=1 VALUE_DESC='Canal' VALUE_ID=311

Thanks,

Rob.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 25 2016
Added on Oct 28 2016
3 comments
502 views