Converting CSV into rows

Just reminder for myself
WITH t AS (
SELECT ‘AAA,a,b,c,d,e,f,g,h,i,j,k,l’ or_str from dual
)
SELECT SUBSTR(
or_str,
INSTR(’,’ || or_str,’,',1,LEVEL),
INSTR(or_str || ‘,’,',’,1,LEVEL) - INSTR(’,’ || or_str,’,',1,LEVEL)
) SubString
FROM t
CONNECT BY LEVEL <= LENGTH(or_str)-LENGTH(REPLACE(or_str,’,')) + 1
AND PRIOR or_str = or_str
AND PRIOR DBMS_RANDOM.VALUE IS NOT NULL
/

Wednesday, August 31st, 2011 at 11:30
  • amit dubey
    Oct 11th, 2011 at 06:21 | #1

    Will you please explain this query?How Oracle interprets it?

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>