Updated on 2026-11-06 GMT+08:00

ln

The ln function is used to return the natural logarithm of the given numeric value.

Syntax

ln(DOUBLE a) 

Parameters

Parameter

Mandatory

Type

Description

a

Yes

DOUBLE, BIGINT, DECIMAL, or STRING

The format of parameter a includes floating-point format, integer format, and string format. If parameter a is not of type DOUBLE, it is implicitly converted to DOUBLE type before evaluation.

Return Values

Returns a value of type DOUBLE.

  • If a is negative or 0, NULL is returned.
  • If a is NULL, NULL is returned.

Example Code

Returns 1.144729868791239.

select ln(3.1415926); 

Returns 1.

select ln(2.718281828459045); 

Returns NULL.

select ln(null);