Skip to content

Split a string by comma into columns in Oracle SQL

Advertisements
SELECT  REGEXP_SUBSTR (str, '[^,]+', 1, 1)    AS Col1
,       REGEXP_SUBSTR (str, '[^,]+', 1, 2)    AS Col2
,       REGEXP_SUBSTR (str, '[^,]+', 1, 3)    AS Col3
,       REGEXP_SUBSTR (str, '[^,]+', 1, 4)    AS Col4
FROM    table_x
;
See also  Select rowid along with all other columns from a table in Oracle database

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.