Firebird Documentation Index → Firebird 2.5 Language Ref. Update → Internal functions → RIGHT() |
Find a more recent version at Firebird 5.0 Language Reference: RIGHT()
Available in: DSQL, PSQL
Added in: 2.1
Description: Returns the rightmost part of the argument string. The number of characters is given in the second argument.
Result type: VARCHAR or BLOB
Syntax:
RIGHT (string
,length
)
This function supports text BLOBs of any length, but has a bug in versions 2.1–2.1.3 and 2.5 that makes it fail with text BLOBs 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 a BLOB. Otherwise, the result is a VARCHAR(n
) withn
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 BLOB, this function may need to load the entire object into memory. This may affect performance if huge BLOBs are involved.
If the external function
RIGHT
is declared in your database as right
instead of the default sright
, it will override the internal function.
To make the internal function available, DROP or ALTER the external
function (UDF).
See also: LEFT()
Firebird Documentation Index → Firebird 2.5 Language Ref. Update → Internal functions → RIGHT() |