Arithmetic operators perform arithmetic operations:
In 4gl, arithmetic operators perform arithmetic operations on operands of numeric data types and, in some cases, time data types.
This means that an expressions with arithmetic operators can return numeric, DATE, DATETIME, or INTERVAL values.
Here is the syntax of an expression with an arithmetic operator that will return a numeric value:
Arithmetic operators can be used with the operands with simple or structured data types. Large data types – BYTE or TEXT – are not valid as operands.
The range of returned values is that of the returned data type.
In theory, arithmetic operators can be used with operands of the CHAR or VARCHAR data types if these operands represent a numeric value. However, this imposes certain complications - for example, this can significantly decrease the performance of 4gl applications that include a large number of arithmetic operators. That's why we recommend using only operands of numeric data types with arithmetic operators.
If a Boolean expression is an arithmetic operand, 4GL evaluates it and converts it to an integer so that TRUE = 1 and FALSE = 0.
If any component of an expression that includes arithmetic operators is a null value, the entire expression returns NULL unless the null component is an operand of the IS NULL or IS NOT NULL operators.
Arithmetic operators in 4GL resemble the arithmetic functions of Informix database servers but are evaluated by the client system (unlike those of Informix db).
You can use operands of the DATETIME, or INTERVAL data types in expressions with arithmetic operators only if these operands are
A DATETIME or INTERVAL operand cannot be
Here is the syntax of an expression with an arithmetic operator that will return a DATE value:
Here is the syntax of an expression with an arithmetic operator that will return a DATETIME value:
Here is the syntax of an expression with an arithmetic operator that will return a INTERVAL value: