0

We have a requirement to create a stored procedure in Oracle, passing input variables and output to be in JSON format. I've tried using listagg() but getting error as "result of string concatenation is too long" while executing the procedure.

The expected output has to be in JSON format from the procedure.

APC
  • 144,005
  • 19
  • 170
  • 281

2 Answers2

1

A regular select in PL/SQL uses bind variables by default and you might want to have a look at https://github.com/doberkofler/PLSQL-JSON to generate json.

doberkofler
  • 9,511
  • 18
  • 74
  • 126
0

used xmlagg and it worked select (SELECT RTRIM(xmlcast(XMLAGG( XMLELEMENT(E, columnname|| ',') ) AS clob) ,',') FROM table) ||'}' from dual