Skip to main content

MID

Builds a substring by starting at the position specified and reading until either the end of the string is reached or, if specified, length is exceeded.

Syntax​

MID ( string_expression, start_pos [, length] ) 

Arguments​

string_expression
A valid string expression.

start_pos The position to start reading from as a numeric value.

length The number of characters to be returned as a numeric value.

Remarks​

  • The first position in the string is 1.
  • If the start position exceeds the length of the string, an empty string is returned.

Return Type​

Returns values of type STRING.

Examples​

Examples in this section use the example blockchain.

The following example calculates the MID for the specified components.

SELECT MID(str, 2, 4) FROM example;

Response:

MID(str, 2, 4) [STRING]
NULL

ect
iale