8.3.6. LEFT()

Available in

DSQL, PSQL

Syntax

  1. LEFT (string, length)
Table 128. LEFT Function Parameters
ParameterDescription

string

An expression of a string type

length

Integer expression. Defines the number of characters to return

Result type

VARCHAR or BLOB

Description

Returns the leftmost part of the argument string. The number of characters is given in the second argument.

  • This function fully supports text BLOBs of any length, including those with a multi-byte character set.

  • If string is a BLOB, the result is a BLOB. Otherwise, the result is a VARCHAR(*n*) with n the length of the input string.

  • If the length argument exceeds the string length, the input string is returned unchanged.

  • If the length argument is not a whole number, bankers’ rounding (round-to-even) is applied, i.e. 0.5 becomes 0, 1.5 becomes 2, 2.5 becomes 2, 3.5 becomes 4, etc.

See also

RIGHT()