0

I am tring to find the last position of an element in a column in sql (oracle). If I have on a column the value 20-7-1-2-2 I need the position of the last - which is 9. Any ideas how I could find it?

dres
  • 499
  • 6
  • 18

2 Answers2

1

try like this

select INSTR(columnname, '-', -1) from tablename

Fiddle

Sathish
  • 4,419
  • 4
  • 30
  • 59
0
    select instr('20-7-1-2-2', '-', -1, 1) from dual
-------------------------------------^

-1 means search from end of string

See the Oracle Instr reference.

Lord Peter
  • 3,433
  • 2
  • 33
  • 33