Skip to content
Advertisement

oracle 12c – select string after last occurrence of a character

I have below string:

So I want to select Sentence since it is the string after the last period. How can I do this?

Advertisement

Answer

You can probably do this with complicated regular expressions. I like the following method:

Nothing like testing to see that this doesn’t work when the string is at the end. Something about – 0 = 0. Here is an improvement:

EDIT:

Your example works, both when I run it on my local Oracle and in SQL Fiddle.

I am running this code:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement