Skip to content
Advertisement

Convert VARRAY to text (for concatenation)

I have a query that outputs a VARRAY:

In SQL Developer, the VARRAY gets output as text:

enter image description here


Question:

Similar to what SQL Developer does, is there a way to convert the VARRAY to text using SQL — so that I can concatenate the value in a string?

Example: (fails)


Just a heads up:

DB<>FIDDLE doesn’t seem to output VARRAYS correctly. It outputs an empty resultset, which can be confusing. Return a value/row when selecting SDO_GEOMETRY

Advertisement

Answer

You can use listagg in a subquery:

DBFiddle: https://dbfiddle.uk/?rdbms=oracle_21&fiddle=fa79482bb22501fd67fb2c498ff90bf9

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement