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  Calculate size of the database in MySQL

Leave a Reply

Your email address will not be published.

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