![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi all, is it possible to use sa_split_list over a table column, i.e. something like select * from sa_split_list((select myListColumn from mytable)) ? If so, is it only valid when the select will jst return 0 or 1 rows? Note, the call above is syntactically wrong. TIA Volker |
#3
| |||
| |||
|
|
While I would still like to get an answer, I worked around this problem with the obvious solution of using a for-statement like: for forList as crsList cursor for select col1, myListColum from mytable for read only do -- use each row_value for any action, e.g. put it in a temp table LT insert LT (col1, myUnlistedColum) select col1, cast(row_value as int) from sa_split_list(myListColumn) order by line_num; end for; Volker Volker Barth wrote: Hi all, is it possible to use sa_split_list over a table column, i.e. something like select * from sa_split_list((select myListColumn from mytable)) ? If so, is it only valid when the select will jst return 0 or 1 rows? Note, the call above is syntactically wrong. TIA Volker |
#4
| |||
| |||
|
|
You can use the LATERAL derived-table syntax to use a join with outer references to tables earlier in the FROM clause. A contrived example tested with 10.0.1(3932). If you are using more recent versions, the OPENSTRING syntax may be of interest as it offers some additional flexibility such as decoding multiple columns and specifying the data type. This functionality can also be accomplished with XML support. These mechanisms enable some interesting solutions that pack rows into a scalar and then decode them. select "precision" x, list(domain_name) str into #tab from sysdomain group by x; select x, line_num, row_value from #tab, lateral( sa_split_list(str) ) P Regards, |
![]() |
| Thread Tools | |
| Display Modes | |
| |