Link to home
Create AccountLog in
Avatar of Swaminathan K
Swaminathan KFlag for India

asked on

Extract only names using regular expression in Oracle SQL

Hi Team,


I need to write a query to pull out the name from a given column, the column has values like

ID        NAME

1         DR . A Sam 

2          DR . A. Gopal

3        Sam Gopal , DR

4         Daniel Raj . DR .


output : 

1 A Sam

2 A. Gopal

3 Sam Gopal 

4   Daniel Raj



Select regexp_substr(NAME,'([a-zA-Z\.]+])|([^,\.]+)',1,1)

from dual;


Any help is really appreciated.



ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer