OraDev.com
|
The Oracle substr function for substrings
The substr function is a function that returns a substring from a string.
syntax
substr([input],[start],[length]) or
substr([input],[start]) or
With input the String to take a substring from,
start is the starting position where 1 is the first character. (if you pass 0, this will be substituted by 1)
and the optional length parameter is the number of characters in the substring.
If length is left out, then substr will return the substring from position start till the end
of the input-string.
Sample code:
select substr('1234567890',3,2) from dual;
will return: '34'.
select substr('1234567890',7) from dual;
will return: '789'.
|
|
|