Data type promotion

Many of the operators that combine two values expect that the input values will have the same type, and the result will also be of the same type. However, if you mix operands of differing types the query language will attempt to promote one of the data values to the type of the other. The table below shows the promotion that will occur for various operators.

Table 24. Promotion of data types.

Operand_1

Operand_2

Result

Comments

<int>

<number>

<number>

<string>

<bool>

<string>

The boolean value will be converted to a literal string ('true' or 'false').

<string>

<int> or <number>

<string>

The integer or number will be converted to a literal string value (e.g. 1.0 will become '1.0').

<bool>

<int> or <number>

Error

Booleans cannot be combined with numbers. Instead, use a relational or equality operator to convert the number to a boolean, or use an 'if' function to convert the boolean to a number.