|| (string concatenator)

<< NULL literals allowed as operands | FB 2.5 Language Reference | ALL >>
<< NULL literals allowed as operands | FB 2.1 Language Reference | ALL >>

|| (string concatenator)

Available in: DSQL, ESQL, PSQL

Text BLOB concatenation

Changed in: 2.1

Description

Since Firebird 2.1 the concatenation operator supports BLOBs of any length and any character set. If a mixture of BLOBs and non-BLOBs is involved, the result is a BLOB. If both text and binary BLOBs are involved, the result is a binary BLOB.

Result type VARCHAR

Changed in: 2.0, 2.1

Description

The result type of string concatenations used to be CHAR(n). Starting with Firebird 2.0, it is VARCHAR(n). As a result, the maximum length of a concatenation outcome is now 32765 instead of 32767. In Firebird 2.1 and up, if at least one of the operands is a BLOB, the result is also a BLOB and the maximum doesn't apply. For non-BLOB concatenations the result is still VARCHAR(n) with a maximum of 32765 bytes.

Overflow checking

Changed in: 1.0, 2.0

Description

In Firebird versions 1.x, an error would be raised if the sum of the declared string lengths in a concatenation exceeded 65535 bytes, even if the actual result lay within the maximum string length of 32767 bytes. In Firebird 2.0 and up, the declared string lengths will never cause an error. Only if the actual outcome exceeds 32765 bytes (the new limit for concatenation results) will an error be raised.

back to top of page
<< NULL literals allowed as operands | FB 2.5 Language Reference | ALL >>
<< NULL literals allowed as operands | FB 2.1 Language Reference | ALL >>