DSQL, PSQL

    Changed in

    2.5.1

    Syntax

    Result types

    VARCHAR or BLOB

    Description

    Returns a string’s substring starting at the given position, either to the end of the string or with a given length.

    This function returns the substring starting at character position startpos (the first position being 1). Without the FOR argument, it returns all the remaining characters in the string. With FOR, it returns length characters or the remainder of the string, whichever is shorter.

    In Firebird 1.x, startpos and length must be integer literals. In 2.0 and above they can be any valid integer expression.

    Starting with Firebird 2.1, this function fully supports binary and text BLOBs of any length and character set. If str is a BLOB, the result is also a BLOB. For any other argument type, the result is a . Previously, the result type used to be CHAR if the argument was a CHAR or a string literal.

    If any argument is NULL, the result is NULL.

    Example

      See also

      , LEFT(), , , CHARACTER_LENGTH()