I am trying to perform a dynamic query where I can pass the structure of the table to row of a query keeping the value of that field using some Oracle function. I have seen the references of PIVOT, ws_concat and listagg but they do not fulfill what I require. Example of what I need
Customer Table:
CREATE TABLE cliente(
idCliente NUMBER(10)
,nombre VARCHAR2(128)
,email VARCHAR2(64)
,celular VARCHAR(10)
)
When making the following query:
SELECT * FROM cliente
I get the following:
ID_CLIENTE NOMBRE EMAIL CELULAR
123456 Martin [email protected] 55664878
But what I need is to pass it to the following form:
ID_CLIENTE 123456
NOMBRE Martin
EMAIL [email protected]
CELULAR 55664878
I hope that this can be achieved in a more optimal way, and not having to declare cursors or other types of nested queries.