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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

convert rows to columns using sql select clause

User_POZ94Nov 9 2020

Hi Gurus,
please help us to achieve this requirement.
Our database table stores model related attributes in Key-Value pair. we want to transpose the data and display model attributes as per traditional relation database structure of single row data.
example data :
select model_number, attribute_name, attribute_value from xxcmst_inv_cmt_product_iface_stg where model_number = 'MODEL123';
image.png
the requirement is to write the select clause in such a way to transpose the result set into a single row as shown below :
image.pngit will always be run for a single model which has unique captions. so resultant set will always be 1 row.
Regards,
Samir Kumar Das

This post has been answered by User_POZ94 on Nov 10 2020
Jump to Answer

Comments

Post Details

Added on Nov 9 2020
7 comments
2,373 views