Substr
From Oracle FAQ
SUBSTR is an SQL function that returns a portion of a string (char or varchar2) value.
Syntax[edit]
SUBSTR(string, start_pos, length)
If "start_pos" is negative, substr counts from the end of the string. If "length" is not given, substr defaults to the remaining length of the string.
Examples[edit]
SELECT SUBSTR('123', 1, 1) FROM dual; S - 1
SQL> SELECT SUBSTR('123', 1, 2) FROM dual; SU -- 12
SQL> SELECT SUBSTR('123', 2, 1) FROM dual; S - 2
SQL> SELECT SUBSTR('123', 2, 2) FROM dual; SU -- 23
Also see[edit]
- REGEXP SUBSTR, regular expression based equivalent.
- Instr