11.13. STRING Manipulation Functions

11.13.1. SUBSTR

SUBSTR(str, start_char, [no_of_chars])
strvarchar2The input string.
start_posintegerGo to the START_POS character position in the string and count forward, NO_OF_CHARS. If START_POS is negative, start from the tail of the string.
no_of_charsintegerNumber of characters to select. If not specified, then get the rest of the string.
retunsvarchar2Returns the substring or NULL.

The SUBSTR function returns a slice of an input string. The arguments START_POS and NO_OF_CHARS can be literals, variables, or string expressions that evaluate to a number. The following are some SUBSTR examples in a SQL*Plus session.

Given the string, 12345, select the tail of the string starting at character position 2. ...

Get Programming Oracle® Triggers and Stored Procedures, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.