Skip to content
Advertisement

How to select sub string in oracle?

I have a scenario where my data is something like below:

Chapter 18 Unit 10 Sect 16

  • Case 1 : I want to select Chapter 18 from the above string.
  • Case 2 : I want to select Unit 10 from the above string.
  • Case 3 : I want to select Sect 16 from the above string.

Advertisement

Answer

Using substr:

Using regexp:

So the solution with regexp is slower, but it is more readable, if I were you I would use regexp.

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