Oracle LN() Function

Oracle LN() is a built-in function that returns the natural logarithm of the number given by the parameter.

Oracle LN() syntax

Here is the syntax for the Oracle LN() function:

LN(num)

Parameters

num

Required. The value must be greater than 0. It can be any numeric data type or any non-numeric data type that can be implicitly converted to a numeric data type.

Return Value

The Oracle LN() function returns the natural logarithm of the number given by the parameter.

ASIN() returns BINARY_DOUBLE if the parameter is BINARY_FLOAT. Otherwise ASIN() returns the same numeric data type as the parameter.

If any parameter is NULL, LN() will return NULL.

Oracle LN() Examples

Here are some examples that demonstrate the usage of the Oracle LN() function.

Basic Usage

SELECT
    LN(100)
FROM dual;

Output:

                                   LN(100)
__________________________________________
   4.6051701859880913680359829093687284152

Natural Logarithm Of 1

The natural logarithm of 1 is 0, and the following statement demonstrates this:

SELECT
    LN(1)
FROM dual;

Output:

   LN(1)
________
       0

Natural Logarithm Of Natural Base

The natural logarithm of 1 to the natural base, the following statement demonstrates this:

SELECT
    LN(EXP(1))
FROM dual;

Output:

   LN(EXP(1))
_____________
            1

Here use EXP(1) to get the natural base.

NULL Parameters

If any parameter is NULL, LN() will return NULL.

SET NULL 'NULL';
SELECT
    LN(NULL)
FROM dual;

Output:

   LN(NULL)
___________
       NULL

In this example, we use the statement SET NULL 'NULL'; to display NULL values as the string 'NULL'.

Conclusion

Oracle LN() is a built-in function that returns the natural logarithm of the number given by the parameter.