1-- ORACLE substr(string, start, [, length ])
2SELECT substr('Hello World', 4, 5) FROM DUAL; -- lo Wo
3SELECT substr('Hello World', 4) FROM DUAL; -- lo World
4SELECT substr('Hello World', -3) FROM DUAL; -- rld
5SELECT substr('Hello World', -3, 2) FROM DUAL; -- rl
1-- For Oracle only
2
3-- syntax
4SUBSTR(<main-string>,1,<number-of-characters>)
5
6-- example
7SUBSTR('Useless stuff',1,10) -- OUTPUT: Useless st
8
9-- practical example
10SELECT SUBSTR('Useless stuff',1,10)
11FROM DUAL;
1-- For Oracle only
2
3-- syntax
4SUBSTR(<main-string>,-<number-of-characters>)
5
6-- example
7SUBSTR('Useless stuff',-9) -- OUTPUT: ess stuff
8
9-- practical example
10SELECT SUBSTR('Useless stuff',-9)
11FROM DUAL;
1SUBSTR(string, :START_POS, :SUBSTR_LENGTH);
2
3SELECT SUBSTR('ABCDEFG',3,4) FROM DUAL;
4--OUTPUT: CDEF