This topic lists the implicit CASTs available for arithmetic operations.
Normally the arithmetic operators (+, -, *, and /) operate on operands of the same data type, and return a value of the same data type as the operands. Cases where it is acceptable for the operands to be of different data types, or where the data type of the resulting value is different from the type of the operands, are shown in the following table.
Left operand data type | Right operand data type | Supported operators | Result data type |
---|---|---|---|
INTEGER | FLOAT | +, -, *, / | FLOAT1 |
INTEGER | DECIMAL | +, -, *, / | DECIMAL1 |
INTEGER | INTERVAL | * | INTERVAL4 |
FLOAT | INTEGER | +, -, *, / | FLOAT1 |
FLOAT | DECIMAL | +, -, *, / | FLOAT1 |
FLOAT | INTERVAL | * | INTERVAL4 |
DECIMAL | INTEGER | +, -, *, / | DECIMAL1 |
DECIMAL | FLOAT | +, -, *, / | FLOAT1 |
DECIMAL | INTERVAL | * | INTERVAL4 |
TIME | TIME | - | INTERVAL2 |
TIME | GMTTIME | - | INTERVAL2 |
TIME | INTERVAL | +, - | TIME3 |
GMTTIME | TIME | - | INTERVAL2 |
GMTTIME | GMTTIME | - | INTERVAL2 |
GMTTIME | INTERVAL | +, - | GMTTIME3 |
DATE | DATE | - | INTERVAL2 |
DATE | INTERVAL | +, - | DATE3 |
TIMESTAMP | TIMESTAMP | - | INTERVAL2 |
TIMESTAMP | GMTTIMESTAMP | - | INTERVAL2 |
TIMESTAMP | INTERVAL | +, - | TIMESTAMP3 |
GMTTIMESTAMP | TIMESTAMP | - | INTERVAL2 |
GMTTIMESTAMP | GMTTIMESTAMP | - | INTERVAL2 |
GMTTIMESTAMP | INTERVAL | +, - | GMTTIMESTAMP3 |
INTERVAL | INTEGER | *, / | INTERVAL4 |
INTERVAL | FLOAT | *, / | INTERVAL4 |
INTERVAL | DECIMAL | *, / | INTERVAL4 |
INTERVAL | TIME | + | TIME3 |
INTERVAL | GMTTIME | + | GMTTIME3 |
INTERVAL | DATE | + | DATE3 |
INTERVAL | TIMESTAMP | + | TIMESTAMP3 |
INTERVAL | GMTTIMESTAMP | + | GMTTIMESTAMP3 |
Notes:
|
Related concepts
ESQL
Related tasks
Developing ESQL
Related reference
Complex ESQL functions
Implicit casts
Implicit CASTs for comparisons
Implicit CASTs for assignment
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
ak05710_ |