For example ‘ABC-12345-6789-10’ I want to return "10" as these are all the characters after the last "-" dash.
I have tried this but I only get a zero at the end:
SUBSTRING('ABC-12345-6789-10',len('ABC-12345-6789-10'),LEN(CHARINDEX('-', 'ABC-12345-6789-10')))
2
Answers
Oracle does not support the functions:
SUBSTRING
– you wantSUBSTR
instead.LEN
– you wantLENGTH
instead.CHARINDEX
– you wantINSTR
instead.You want:
Which outputs:
fiddle
For MySQL it is easier. there you have
SUBSTRING_INDEX
fiddle