FirebirdSQL logo

Conversion of Data Types

When composing an expression or specifying an operation, the aim should be to use compatible data types for the operands.When a need arises to use a mixture of data types, it should prompt you to look for a way to convert incompatible operands before subjecting them to the operation.The ability to convert data may well be an issue if you are working with Dialect 1 data.

Explicit Data Type Conversion

The CAST function enables explicit conversion between many pairs of data types.

Syntax
CAST (<expression> AS <target_type>)

<target_type> ::= <domain_or_non_array_type> | <array_datatype>

<domain_or_non_array_type> ::=
  !! See Scalar Data Types Syntax !!

<array_datatype> ::=
  !! See Array Data Types Syntax !!

See also CAST() in Chapter Built-in Scalar Functions.