sqlteiid

Passing Comma Separated List to Function with VARIDIAC parameter as input


I have a user defined function that takes a VARIADIC parameter as an input:

func(name string, VARIADIC values double) returns Blob

Example: select func('abc', 35.2,35.3,35.5)

How can I pass row based float/double values to comma separated double type in TEIID

From:
35.2
35.3
35.5

To:
35.2,35.3,35.5

as a single double/float comma separated variable.

Thank you


Solution

  • See the ARRAY_AGG aggregate function:

    select func('abc', select array_agg(double_col) from something)
    

    There's also array constructors ARRAY[value,...] and (value, ...)