Numeric functions
- Last Updated: June 27, 2019
- 1 minute read
- DataDirect Connectors
- JDBC
- Aha! 6.0
- Amazon Redshift 6.0
- Apache Cassandra 6.0
- Apache Hive 6.0
- Apache Spark SQL 6.0
- Atlassian Jira 6.0
- Autonomous REST Connector 6.0
- Cloudera Impala 5.1
- + 24
The following table lists the numeric functions that JDBC supports.
The numeric functions listed accept the following arguments:
- numeric_exp can be a column name, a numeric literal, or the result of another scalar function, where the underlying data type is NUMERIC, DECIMAL,TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, SQL_REAL, or DOUBLE.
- float_exp can be a column name, a numeric literal, or the result of another scalar function, where the underlying data type is FLOAT.
- integer_exp can be a column name, a numeric literal, or the result of another scalar function, where the underlying data type is TINYINT, SMALLINT, INTEGER, or BIGINT.
| Function | Returns |
|---|---|
| ABS(numeric_exp) | Absolute value of numeric_exp. |
| ACOS(float_exp) | Arccosine of float_exp as an angle in radians. |
| ASIN(float_exp) | Arcsine of float_exp as an angle in radians. |
| ATAN(float_exp) | Arctangent of float_exp as an angle in radians. |
| ATAN2(float_exp1, float_exp2) | Arctangent of the x and y coordinates, specified by float_exp1 and float_exp2 as an angle in radians. |
| CEILING(numeric_exp) | Smallest integer greater than or equal to numeric_exp. |
| COS(float_exp) | Cosine of float_exp as an angle in radians. |
| COT(float_exp) | Cotangent of float_exp as an angle in radians. |
| DEGREES(numeric_exp) | Number if degrees converted from numeric_exp radians. |
| EXP(float_exp) | Exponential value of float_exp. |
| FLOOR(numeric_exp) | Largest integer less than or equal to numeric_exp. |
| LOG(float_exp) | Natural log of float_exp. |
| LOG10(float_exp) | Base 10 log of float_exp. |
| MOD(integer_exp1, integer_exp2) | Remainder of integer_exp1 divided by integer_exp2. |
| PI() | Constant value of pi as a floating-point number. |
| POWER(numeric_exp, integer_exp) | Value of numeric_exp to the power of integer_exp. |
| RADIANS(numeric_exp) | Number of radians converted from numeric_exp degrees. |
| RAND([integer_exp]) | Random floating-point value using integer_exp as the optional seed value. |
| ROUND(numeric_exp, integer_exp) | numeric_exp rounded to integer_exp places right of the decimal (left of the decimal if integer_exp is negative). |
| SIGN(numeric_exp) | Indicator of the sign of numeric_exp. If numeric_exp < 0, -1 is returned. If numeric_exp = 0, 0 is returned. If numeric_exp > 0, 1 is returned. |
| SIN(float_exp) | Sine of float_exp, where float_exp is an angle in radians. |
| SQRT(float_exp) | Square root of float_exp. |
| TAN(float_exp) | Tangent of float_exp, where float_exp is an angle in radians. |
| TRUNCATE(numeric_exp, integer_exp) | numeric_exp truncated to integer_exp places right of the decimal. (If integer_exp is negative, truncation is to the left of the decimal.) |