Firebird Documentation IndexFirebird 1.5 Language Ref. UpdateMiscellaneous language elements → || (string concatenator)
Firebird Home Firebird Home Prev: -- (single-line comment)Firebird Documentation IndexUp: Miscellaneous language elementsNext: Shorthand casts

|| (string concatenator)

Table of Contents

Overflow checking

Available in: DSQL, ESQL, PSQL

Overflow checking

Changed in: 1.0

Description: If the sum of the declared string lengths in a concatenation exceeded 32767 bytes, InterBase would raise an error without trying to do the actual concatenation – even though the result might very well be within that limit. In Firebird 1.0 and 1.5, the early error threshold is raised to 65536. Consequently, concatenations of at most two (VAR)CHARs can no longer result in these premature errors. An error will only be raised if the actual outcome exceeds 32767 bytes, or if the sum of the declared lengths exceeds 65535 bytes. The latter is only possible if three or more strings take part in the concatenation.

Examples: 

The following statement will raise an error in InterBase, but not in Firebird:

select cast('abc' as varchar(30000))
    || cast('def' as varchar(30000))
from rdb$database

The following statement will raise an (unnecessary) error in both InterBase and Firebird:

select cast('abc' as varchar(30000))
    || cast('def' as varchar(30000))
    || cast('ghi' as varchar(30000))
from rdb$database

Note

Firebird 2.0 does away with these premature errors altogether.

Prev: -- (single-line comment)Firebird Documentation IndexUp: Miscellaneous language elementsNext: Shorthand casts
Firebird Documentation IndexFirebird 1.5 Language Ref. UpdateMiscellaneous language elements → || (string concatenator)