In the ETL process, I receive a varchar field, and the length (of the value) is changed from row to row. I need to keep 5 symbols from the right side of the string. It means that I need to cut the left side but I can't, due to the unknown length.
I've tried the select substring('24:15:11',4, 5)
, but it doesn't help me, the string could be '2019-05-01 22:15:11'
.
sql:
select substring('24:15:11',4, 5)
expected:
15:11
You can use substr
. Negative starting position is interpreted as being relative to the end of the string.
select substr('24:15:11', -5)