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!

extract the value between the _ or till the end

907301Jun 10 2015 — edited Jun 10 2015

Hi,

I was trying to extract a value of below format using regexp_substr. But I'm not sure how to use the REGEXP_SUBSTR for this. Can any one please help on this.

STRING

ORACLE_TECHNOLOGY

ORACLE_TECHNOLOGY_NETWORK

ORACLE_TECHNOLOGY_NETWORK_INDIA

output :

TECHNOLOGY

So, what ever may be the input string the output should be the string between the 1st and 2nd underscore( _ ) . If the 2nd underscore( _ ) is missing then it should give till the end.

My version of oracle is 11g.

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

PL/SQL Release 11.2.0.3.0 - Production

"CORE 11.2.0.3.0 Production"

TNS for 64-bit Windows: Version 11.2.0.3.0 - Production

NLSRTL Version 11.2.0.3.0 - Production

This post has been answered by chris227 on Jun 10 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 8 2015
Added on Jun 10 2015
4 comments
2,179 views