LOG

2024-12-02 03:48:26  Updated

Purpose

LOG() returns the logarithm of y to base x.

Syntax

LOG(x,y)

Parameters

Parameter Description
x The base. It can be of any numeric data type such as NUMBER, FLOAT, BINARY_FLOAT, or BINARY_DOUBLE. x must be greater than 0 and not equal to 1.
y A natural number. It can be of any numeric data type such as NUMBER, FLOAT, BINARY_FLOAT, or BINARY_DOUBLE. y must be greater than 0.

Return type

When any argument is of the BINARY_FLOAT or BINARY_DOUBLE data type, the return type is BINARY_DOUBLE. Otherwise, the return type is NUMBER.

Examples

The following example returns the logarithm of 8 to base 2.

obclient> SELECT LOG(2,8) FROM DUAL;
+----------+
| LOG(2,8) |
+----------+
|        3 |
+----------+
1 row in set

Contact Us