16.20 - Result Type and Attributes - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Functions, Expressions, and Predicates

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1145-162K

The result of a concatenation operation is a string formed by concatenating the arguments in a left-to-right direction.

Here are the default result type and attributes for arg1 || arg2:
  • If the arguments are byte strings, the result is a byte string.
  • If the arguments are numeric, character strings, or UDTs that are implicitly cast to character strings, the result is a character string.

If either argument is null, the result is null.

The data types and attributes of the arguments determine whether the result type of a concatenation operation is a fixed length or varying length string. Result types appear in the following table, where n is the sum of the lengths of all arguments:

IF this argument … Is this data type or attribute … THEN the result is this data type or attribute …
either VARBYTE VARBYTE(n)
VARCHAR VARCHAR(n)
numeric
UDT that is implicitly cast to VARCHAR
CLOB CLOB(n)
BLOB BLOB(n)
both BYTE BYTE(n)
CHARACTER (with same server character set) CHARACTER(n)
UDT that is implicitly cast to CHARACTER (with the same server character set)
CHARACTER (with different server character sets) VARCHAR(n)
UDT that is implicitly cast to CHARACTER (with different server character sets)
numeric

When either argument is a character string that specifies the CASESPECIFIC attribute, the result also specifies the CASESPECIFIC attribute.