Hi,
I need to retrieve few columns by doing string concatenate with several single codes to get to a Json format
As like oracle can we give an escape sequence like q'#? if so please let me know the format.
Also the table from which the JSON has to be created is passed dynamically.The table name would be stored in a variable
Example is as below:-
declare
v_tablename varchar(2000):='employee'
v_sql varchar(2000);
v_result clob;
begin
v_sql := q'# select
'{"ENTITYATTRVALUE":{'
||
'"ATTRS":[' || string_agg('{ "ID":"' || e.id || '", "NAME":"' || e.name || '", "VALUE":"' || e.value
||',"DATA_TYPE":"' ||e.DATA_TYPE ||'" '
|| ',"DEFAULT_VALUE":"' || e.DEFAULT_VALUE || '" '||
into v_result from v_tablename e
#';
exec v_sql;
end;
I would like get the output of the select query as a JSON in v_result by querying the table where the table name is substituted from v_tablename
Requesting for help.
Thanks,
Athrey