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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Need help on substr fucntion

srikanth bDec 15 2022

select regexp_replace('1/5AN4/4145','/','',1,1) from dual;

Output : '15AN 4/41 45'

I have to replace regexp_repalce with SUBSTR

This post has been answered by mathguy on Dec 15 2022
Jump to Answer

Comments

mathguy
Answer

Output : '15AN 4/41 45'
That is not true. The output from your query is '15AN4/4145' (without the extra spaces).
If that is what you want, you can get it like this:

select str,
       substr(str, 1, instr(str, '/') - 1) || substr(str, instr(str, '/') + 1) as newstr
from   (select '1/5AN4/4145' as str from dual)
;



STR           NEWSTR    
-----------   ----------
1/5AN4/4145   15AN4/4145
Marked as Answer by srikanth b · Dec 15 2022
srikanth b

Thanks a ton! you saved my time

1 - 2

Post Details

Added on Dec 15 2022
2 comments
83 views