title: Hello, I am new to Oracle sql and trying to find the equivalent of the Oracle SQL code to Postgres SQL
body: <pre><code>begin
        lcl_sql_stmt := 'SELECT trim(regexp_substr(''' || pmotn_id_array || ''', ''[^,]+'', 1, LEVEL)) ' ||
        'FROM dual ' ||
        'CONNECT BY LEVEL &lt;= instr(''' || pmotn_id_array || ''', '','', 1, LEVEL - 1)';
        open pmotn_cur for execute lcl_sql_stmt;
       
       
        close pmotn_cur;
  end;
  </code></pre>
  <p>I am trying to migrate oracle code to postgres sql. I am trying to understand what this query does and its equivalent in postgres</p>