Firebird Documentation IndexFirebird 2.5 Language Ref. UpdateOperators and predicates → || (string concatenator)
Firebird Home Firebird Home Prev: NULL literals allowed as operandsFirebird Documentation IndexUp: Operators and predicatesNext: ALL

|| (string concatenator)

Table of Contents

Text BLOB concatenation
Result type VARCHAR or BLOB
Overflow checking

Tip

Find a more recent version at Firebird 5.0 Language Reference: Concatenation Operator

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 or BLOB

Changed in: 2.0, 2.1

Description: Before Firebird 2.0, the result type of string concatenations used to be CHAR(n). In Firebird 2.0 this was changed to VARCHAR(n). As a result, the maximum length of a concatenation outcome became 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.

Prev: NULL literals allowed as operandsFirebird Documentation IndexUp: Operators and predicatesNext: ALL
Firebird Documentation IndexFirebird 2.5 Language Ref. UpdateOperators and predicates → || (string concatenator)