much like this original SO Pivoting rows into columns dynamically in Oracle
but i would like to do the opposite
how can i get
ID NAME AGE GENDER STATUS
---- ----- ----- ------ --------
1 Bob 30 male
2 Susan married
into this
ID K V
---- ----- -----
1 name Bob
1 age 30
1 gender male
2 name Susan
2 status married
You are looking for
unpivot
.You may have a type mismatch if the age column is an integer. In that case convert it to a character before unpivoting.