Question

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.

Was it helpful?

Solution

substr('DV-2011-01-000004', length('DV-2011-01-000004')-6 + 1 )

OTHER TIPS

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top