Hi friends,
Could you please help me to complete this query?
I have a table like this:
(I know it is not a good design. :-))
Table Name | Column Name | Row Serial Number | Value |
---|
Table_One | Column_One | 1 | 101 |
Table_One | Column_Two | 1 | Arun |
Table_One | Column_Three | 1 | 01-Jan-2018 |
Table_One | Column_Four | 1 | Red |
Table_One | Column_One | 2 | 102 |
Table_One | Column_Two | 2 | Bala |
Table_One | Column_Three | 2 | 02-Jan-2018 |
Table_One | Column_Four | 2 | Blue |
Table_Two | Column_One | 1 | 201 |
Table_Two | Column_Two | 1 | Chitra |
Table_Two | Column_One | 2 | 202 |
Table_Two | Column_Two | 2 | David |
Table_Two | Column_One | 3 | 203 |
Table_Two | Column_Two | 3 | Elango |
And the requirement is to write a query to get Table Name as input and return output like...
For "Table_One" input, the output should be
Serial No | Column_One | Column_Two | Column_Three | Column_Four |
---|
1 | 101 | Arun | 01-Jan-2018 | Red |
2 | 102 | Bala | 02-Jan-2018 | Blue |
For "Table_Two" input, the output should be
Serial No | Column_One | Column_Two |
---|
1 | 201 | Chitra |
2 | 202 | David |
3 | 203 | Elango |
SQL query or any PL/SQL approach is fine.
Thanks in advance!