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!

null in Regexp

sunil_dbaDec 2 2010 — edited Dec 2 2010
I am trying to extract 2 nd value in the the sting sunil;1000;kumar
SQL> select regexp_substr('sunil;1000;kumar','[^;]+',1,2) from dual;

REGE
----
1000
This works fine.
But, when the second field is null, ie., sunil;;kumar
I want the out put to be null only.
SQL> select regexp_substr('sunil;;kumar','[^;]+',1,2) from dual;

REGEX
-----
kumar
How can get this.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 30 2010
Added on Dec 2 2010
3 comments
8,899 views