Read Using SQL Snippets ™ before using any of this site's sample code or techniques on your own systems.

String to Rows

UNION ALL Method

This tutorial shows how to extract delimited values from a string like this

C
----------
v1,v2,v3

and return them one value per row, like this.

POSITION VAL
---------- ----------
1 v1
2 v2
3 v3

If we have a known, manageable maximum number of values in our string we can combine any one
of the parsing techniques described in the
SQL Techniques Tutorials: String to Columns
tutorial section with a UNION ALL query to convert the string into a set of rows.