Click here to Skip to main content
15,938,218 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using unpivot to convert my result columns as rows. which is working fine on oracle 12c but i need to run the same script on lower version of oracle i.e 10g. so need an alternate way to do that as oracle 10g doesn't support unpivot operator.

Below is the code which i am using.

What I have tried:

(select networkentity_id, period_id, item_id, data,MEASURE  from (
                   Select  networkentity_id, period_id, item_id,mtd,ytd,rc12 from
                   financialdata where networkentity_id in
                        (Select networkentity_id from networkentity
                         where nsc_id=:p_nscid )
                         and PERIOD_ID=:p_period_id
                         and item_id in (24176,15291,287,15293))
                   unpivot (
                   data for MEASURE in (mtd,ytd,rc12))
                   where MEASURE=:p_measure)
Updated 30-May-19 1:37am

1 solution

There are alternatives discussed on this article … Columns to Rows[^] at Oracle Knowledge Share
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900