Skip to content

LN

Returns the natural logarithm of a numeric expression or another data type that can be implicitly converted to a numeric data type.

Syntax

sql
LN(expr)

Return Values

The return value is of the data type DECIMAL.

Usage Instructions

  • The return value is always DECIMAL, even if the input is INTEGER.

  • If expr ≤ 0, an error is returned.

Example

sql
SELECT ln(10), ln('100'), ln(exp(1));
+--------+---------+------------+
| LN(10) | LN(100) | LN(EXP(1)) |
|--------+---------+------------|
| ~2.3   | ~4.6    |          1 |
+--------+---------+------------+