Table of ContentsPreviousNext

Database Migration


SUBSTR

Syntax

SUBSTR(string, start [, length])

SUBSTR returns part of a character string beginning at start position, length characters long.

if start is positive, Oracle counts from the beginning of the string.

if start is negative, Oracle counts backwards from the end of the string.

if length is omitted, Oracle returns all characters to the end of the string.

Example

This example returns the full first name in one column, and only the first initial in the second column.

SELECT au_fname, SUBSTR(au_fname, 1, 1)
FROM AUTHORS;

Here is the result set:

au_fname
_______________________________
Albert A
Ann A
Anne A
Michael M
Michel M

Equivalents in other databases

TABLE 73. Equivalents in other databases
IBM DB2
SUBSTR, LEFT and RIGHT functions
Microsoft SQL Server
SUBSTRING , LEFT and RIGHT functions


Ispirer Systems
http://www.ispirer.com
ispirer@ispirer.com
Table of ContentsPreviousNext