Data type conversion can be explicit by using custom functions, or implicit depending on context.
Currently, the following explicit data type conversion functions are available:
STR_TO_INTconverts STRING input to INT output. [ DEPRECATED SINCE 4.7 Use
TO_INTinstead, but see function documentation for semantic differences. ]
- TO_INT converts STRING input to INT output. (Since: CELONIS 4.7)
- TO_STRING converts INT input to STRING output. (Since: CELONIS 4.7)
- TO_TIMESTAMP converts STRING input to DATE output.
In some functions and operators, there will be an implicit data type conversion which is done internally, without any loss of information in the output. Examples include:
- The CONCAT function (operator syntax:
||) will implicitly convert INT and FLOAT input to STRING output.
- The mathematical functions ADD,
and DIV (operator syntax:
/) will implicitly convert an INT operand to FLOAT output, if the other operand is a FLOAT.
Other functions with type changes
There are a number of other functions which takes one data type as input, and returns another. These are not conversion functions as such, since the semantics of the functions inherently imply a loss of information. Examples include:
- FLOOR and ROUND: FLOAT input and returns INT output.
- DATE projection functions, such as CALENDAR_WEEK, HOURS and YEAR will extract part of the DATE input and return that information as an INT.
Specifically for DATE handling, functions are available, which use a non-DATE type as input or output:
- ADD_SECONDS converts INT input to DATE output. Similar conversions are available in the other DateTime Modification functions.
- SECONDS_BETWEEN converts DATE input to FLOAT output. Similar conversions are available in the other DateTime Difference functions.