The substr functions allows you to extract a substring from a string.

The syntax for the substr function is:

substr ( string start_position ,  [ length ])

string is the source string.

start_position is the position for extraction.  The first position in the string is always 1.
length is the number of characters to extract.

For example:

substr (‘This is a test’, 6, 2)

would return ‘is’

substr (‘This is a test’, 6)

would return ‘is a test’

substr (‘Oracle Home’, 1, 3)

would return ‘Ora’

Substr – Oracle SQL Function
Tagged on: