title: Oracle: Connect by Level & regexp_substr
body: <p>Hi I have an Oracle query that I did not write and I also do not have access to run in an Oracle environment. </p>
  
  <p>Could someone please explain what this query is doing please?</p>
  
  <pre><code>WITH tableName AS 
  ( SELECT regexp_substr(fieldName,'[^,]+',1,level) as tableName 
    FROM   (SELECT :tableName as fieldName From DUAL) 
    CONNECT BY LEVEL &lt;= REGEXP_COUNT(fieldName ,'[,]')+1 )
  </code></pre>
  
  <p>I understand that it is creating a CTE called tableName and that the Oracle allows DUAL to be specified as a table in queries that do not need data from any tables. SO that that the above query is not pulling from any specific table.</p>
  
  <p>However the remainder of the query I do not understand as I am very new to Oracle.</p>
  
  <p>Any help would be appreciated I tried googling but came up blank.</p>