csv Data to Rows - SQL

 If you have a data with Comma, or any other character delimited use the following query to convert it to individual rows.

-- Created on 03/07/2024 by ANANTHAN 

DECLARE

  -- Local variables here

  CURSOR c1 IS WITH rws AS(

    SELECT 'one,two,three' str

    FROM   dual)

    SELECT regexp_substr(str, '[^,]+', 1, LEVEL) split_val

    FROM   rws

    CONNECT BY LEVEL <= length(str) - length(REPLACE(str, ',')) + 1;

BEGIN

  FOR m1 IN c1 LOOP

    dbms_output.put_line(m1.split_val);

  END LOOP;

END;

Output:

one

two

three