cancel
Showing results for 
Search instead for 
Did you mean: 

string_agg

Former Member
0 Kudos

Hi All,

I'm having issues using the string_agg function

'''value1'',''VALUE2'''

All values with in 2 single quotes seperated by comma and start and end with a single quote

I tried something like this

SELECT STRING_AGG("CODE",''',''') as code from (..select "code" from table)

O/p is value1,'value2

Is there is way to achieve this

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

SergioG_TX
Active Contributor
0 Kudos

Hari,

the string_agg function in sqlscript is to concatenate strings...

the reason I did ',' was because I needed to concatenate strings in single quotes and separate them with a comma so I can use them in an IN clause...

something like this:

select string_agg("column", '','') into :var_str_agg from SOME_TBL;

select *

from SOMEVIEW

WHERE column IN (:var_strg_agg)  or even if I used it with a parametized view, I can pass the :var_str_agg as the value that the placeholder is expecting

hope this helps!