Skip to Main Content

Listagg (reversed) for strings

Value
A
B
C
D
E
F
G

Listagg (reversed) for numbers

Value
1
2
3
4
5
6
7

Info

Two solutions for a SQL version of the apex_util.string_to_table PL/SQL function, for both strings and numbers.
I needed a pure SQL version to create insert statements with; of course I could have used a PL/SQL procedure but this was a lot simpler. And it performs very well.
Change the : to whatever you need, and remove the distinct if needed.

Note that apex_string.split was only introduced with Apex 5.1, so I have also include the "OLD" code sctions for the previous versions which use xmltable (and work just as well, but may be slower).

Code

Region

Identification
Sequence
Title
Type
Source
Source Type
Region Source

Region

Identification
Sequence
Title
Type
Source
Source Type
Region Source