Using PL/SQL to retrieve column names and column values
666644Sep 26 2009 — edited Sep 30 2009If I have a table as follows
Table A(
meal varchar2(32),
beverage varchar2(32),
desert varchar2(32));
and the table contains a row
meal beverage desert
-------------------------------------------------------
pork chops iced tea apple crisp
Is there a way in pl/sql to retrieve the column names along with the values. I have an object type
DATA_DEFINITION_T AS OBJECT (
"FIELD_NAME" VARCHAR2(32),
"FIELD_VALUE" VARCHAR2(32)
I need to store the column name in field_name and the column value in field_value.
So the result would be:
FIELD_NAME = meal
FIELD_VALUE = pork_chops
FIELD_NAME = beverage
FIELD_VALUE = iced tea
FIELD_NAME = desert
FIELD_VALUE = apple crisp
Thanks in advance.