SUBSTR( ) function

Returns a string containing only the specified substring from the input value.

Syntax

SUBSTR(string, start, length)

Parameters

string

Character. The value to extract the substring from.

start

Numeric. The starting character position of the substring.

length

Numeric. The number of characters in the substring.

Output

Character.

Remarks

This function returns characters from the string value starting from the byte position specified in the start parameter. The number of characters returned is specified in length. If the length value exceeds the number of character from the start position to the end of the string value, the output is padded on the right with spaces. If length is 0, the output is blank.

Examples

Example Return value

SUBSTR("ABCDEF", 2, 3)

“BCD”

SUBSTR("***189543***", 4, 6)

“189543”

To extract the year out of a character field containing a date formatted as “MM/DD/YYYY”, specify:

SUBSTR(DATE, 7, 4)


(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback