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!

ereg_replace usage

LudockJul 28 2014 — edited Jul 28 2014

Hello,

I want to get all the initials, without spaces, without dots, without small characters.

with t as (

select 1 rn, 'P. P. P.' initials from dual union

select 2 rn, 'A.T-J.' initials from dual union

select 3 rn, 'C,' initials from dual union

select 4 rn, 'Th. C.' initials from dual union

select 5 rn, 'B. Test' initials from dual union

select 6 rn, 'B.A.' initials from dual union

select 7 rn, 'E. F.' initials from dual

)

select REGEXP_SUBSTR(initials, '[A-Z]( |.){1}+', 1, 1)

from t

the result will be.

1     PPP

2     AT

3     C

4     TC

5     BT

6     BA

7     EF

Thanks in advance.

L.

This post has been answered by NSK2KSN on Jul 28 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 25 2014
Added on Jul 28 2014
5 comments
280 views