I am trying to fetch an id from an oracle table. It\'s something like TN0001234567890345
. What I want is to sort the values according to the right most 10 posit
Another way of doing it though more tedious. Use the REVERSE
and SUBSTR
functions as indicated below:
SELECT REVERSE(SUBSTR(REVERSE('TN0001234567890345'), 1, 10)) FROM DUAL;
The first REVERSE function will return the string 5430987654321000NT
.
The SUBSTR
function will read our new string 5430987654321000NT
from the first character to the tenth character which will return 5430987654.
The last REVERSE
function will return our original string minus the first 8 characters i.e. 4567890345