Reputation: 75
In a table column, I have this value:
DV-2011-01-000004 (the data type is varchar2)
How can i get the part of the string '000004'? In t-sql they have this right() function but in PL SQL i cant'seem to find a function just like the right() in t-sql.
Thanks for the help.
Upvotes: 5
Views: 14457
Reputation: 17080
you can use:
SUBSTR('DV-2011-01-000004', INSTR('DV-2011-01-000004', '-', -1) +1)
when using INSTR
with negative start position he will find the last index of "-".
then SUBSTR
will cut from this occurrence until the end (because I didn't supply Length)
Upvotes: 2