The Oracle and PL/SQL SUBSTR functions allows you to extract a substring from a string.
The general format is:
SUBSTR(char, m [, n])
If m is positive, SUBSTR counts from the beginning of char to find the first character.
If m is negative, SUBSTR counts backward from the end of char.
Example 1:
SELECT SUBSTR('JOHN WILLIAMS',6) FROM DUAL;
returns:
WILLIAMS
Example 2:
SELECT SUBSTR('JOHN WILLIAMS',6,4) FROM DUAL;
returns:
WILL
Example 3:
SELECT SUBSTR('JOHN WILLIAMS',-6,4) FROM DUAL;
returns:
LLIA