8.3.14. RIGHT()
Available in
DSQL, PSQL
Possible name conflict
YES → Read details
Syntax
RIGHT (_string_, _length_)
Parameter | Description |
---|---|
string | An expression of a string type |
length | Integer. Defines the number of characters to return |
Result type
VARCHAR
or BLOB
Description
Returns the rightmost part of the argument string. The number of characters is given in the second argument.
This function supports text
BLOB
s of any length, but has a bug in versions 2.1 - 2.1.3 and 2.5.0 that makes it fail with textBLOB
s larger than 1024 bytes that have a multi-byte character set. This has been fixed in versions 2.1.4 and 2.5.1.If string is a
BLOB
, the result is aBLOB
. Otherwise, the result is aVARCHAR(*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.
When used on a |
See also