Skip to content
Advertisement

Transpose rows to columns in Oracle Sql

I want the items in rows to be columns.

I have already set up a DBFiddle with the data. Link: https://dbfiddle.uk/?rdbms=oracle_18&fiddle=122a2865fb645e2e226928e28284c590

This is the table I have.

enter image description here

I want the output to be the following:

enter image description here

How to do this in Oracle SQL? The Sequence and the Primary key is making this confusing for me.

Advertisement

Answer

Something like this?


As you asked for PL/SQL, a function that returns refcursor might be one option:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement