So you have a series of columns called "labelX". You want these to become headings with the rows displaying the corresponding valueXs?
For example, with your sample data you want an output along the lines of:
VALUEA VALUEB DATE NAME ACCNT
def d1e2f3 derp 12345
abc a1b2c3 1/1/2016 Herp
If so you can do this with an unpivot and pivot!
First use unpivot to convert your label/value pairs to rows:
create table t(
ValueA varchar(50), Valueb varchar(50),
label1 VARCHAR (50), label2 VARCHAR (50),
value1 VARCHAR(50), Value2 varchar (50)
);
insert into t values ('abc', 'a1b2c3', 'date', 'name', '1/1/2016', 'Herp');
insert into t values ('def', 'd1e2f3', 'name', 'accnt', 'derp', '12345');
select * from t
unpivot (
(lab, val) for c in (
(label1, value1), (label2, value2)
)
);
VALUEA VALUEB C LAB VAL
abc a1b2c3 LABEL1_VALUE1 date 1/1/2016
abc a1b2c3 LABEL2_VALUE2 name Herp
def d1e2f3 LABEL1_VALUE1 name derp
def d1e2f3 LABEL2_VALUE2 accnt 12345
Then use pivot to convert the labels into columns:
select * from (
select valuea, valueb, val, lab from t
unpivot (
(lab, val) for c in (
(label1, value1), (label2, value2)
)
)
)
pivot (
max(val) for lab in (
'date' as "DATE", 'name' as "NAME", 'accnt' as "ACCNT"
)
);
VALUEA VALUEB DATE NAME ACCNT
def d1e2f3 derp 12345
abc a1b2c3 1/1/2016 Herp
To do the pivot you need to know the values in your value columns! If you know what these will be it's easiest to place them directly in the query. If not you may need to use dynamic SQL to find the values and build your SQL statement.
For more discussion on how to do this and pivot/unpivot, read:
https://blogs.oracle.com/sql/entry/how_to_convert_rows_to