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  bad SQL grammar [SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?] Spring Boot / Spring Batch error. How to fix?

Leave a Reply

Your email address will not be published.

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