Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

regexp_substr : regular expression for the comma separated string literals witn IN operator

Peddi Kristipati-OracleJan 9 2015 — edited Jan 9 2015

The following regular expression separates the comma separated plain values (SELECT regexp_substr(:pCsv,'[^,]+', 1, level) FROM DUAL CONNECT BY regexp_substr(:pCsv, '[^,]+', 1, level) IS NOT NULL); Exampple: 300100033146068, 300100033146071 , 300100033146079 returns 300100033146068 300100033146071 300100033146079

this works fine if we use the regular expression with SQL IN operator select * from mytable where t.mycolumn IN (SELECT regexp_substr(:pCsv,'[^,]+', 1, level) FROM DUAL CONNECT BY regexp_substr(:pCsv, '[^,]+', 1, level) IS NOT NULL);

But this query is not working if the comma separated value is a single quoted string literal 'one' , ' two' , 'three'

This post has been answered by Peddi Kristipati-Oracle on Jan 9 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 6 2015
Added on Jan 9 2015
3 comments
1,836 views