WeVie
WeVie

Reputation: 598

Remove all characters at the beginning of string up to certain character in Oracle

I have an address field in which I only want to extract only the city and the state. The data is stored as such: (1234 Cherry ST_Sometown_ST). I would like to removed everything up to and including the first underscore. Is there an easy way to do this with REGEXP_REPLACE() or another similar function?

The only think I have found so far is the ability to remove an Nth number.

Upvotes: 1

Views: 202

Answers (1)

SQLChao
SQLChao

Reputation: 7847

Try this

SQL Fiddle Demo

select substr(address, instr(address, '_') + 1, length(address)) as "CityState"
from address

Upvotes: 3

Related Questions