Purpose
This function returns the logarithm of y to the base x.
Syntax
LOG (x,y)
Parameters
Parameter |
Description |
|---|---|
| x | The base of the logarithm. x is a numeric expression (NUMBER, FLOAT, BINARY_FLOAT, or BINARY_DOUBLE). x must be greater than 0 and not equal to 1. |
| y | The number for which the logarithm is calculated. y is a numeric expression (NUMBER, FLOAT, BINARY_FLOAT, or BINARY_DOUBLE). y must be greater than 0. |
Return type
If the parameter is of the BINARY_FLOAT or BINARY_DOUBLE data type, the return type is BINARY_DOUBLE. Otherwise, the return type is NUMBER.
Examples
Return the logarithm of 8 to the base 2.
obclient> SELECT LOG(2,8) FROM DUAL;
+----------+
| LOG(2,8) |
+----------+
| 3 |
+----------+
1 row in set
