Home > other >  Get varray values as concatenated text list
Get varray values as concatenated text list

Time:06-21

In db<>fiddle for Oracle 18c:

If I select a varray, then db<>fiddle returns an empty resultset, which is misleading.

with data as (select sys.odcivarchar2list('a', 'b', 'c') as my_array from dual)
select my_array from data

Result:

MY_ARRAY
--------   [resultset is empty]

db<>fiddle

@JackDouglas said this in a related post:

PHP’s oci_fetch_all doesn’t like abstract data types like SDO_GEOMETRY, I’m getting errors like this in the logs:

PHP Warning:  oci_fetch_all(): ORA-00932: inconsistent datatypes: expected CHAR got ADT PHP 
Warning:  oci_fetch_all(): ORA-00932: inconsistent datatypes: expected CHAR got ADT

Source: Return a value/row when selecting SDO_GEOMETRY


As a workaround, I want to return the varray's values as a concatenated text list (the same way it works in SQL Developer).

Like this:

with data as (select sys.odcivarchar2list('a', 'b', 'c') as my_array from dual)
select varray_list(my_array) from data
--                      
  • Related