SQL LN(), LOG() Function

SQL LN() Function

SQL LN() function return exact log value (natural logarithm value).

Supported Oracle SQL Version

  • Oracle 8i
  • Oracle 9i
  • Oracle 10g
  • Oracle 11g
  • Oracle 12c
  • Oracle 18c

Example

Consider following LN(n) function example.

SQL> SELECT LN(17) "Natural log of 17" FROM DUAL;

Natural log of 17
-----------------
       2.83321334

SQL> SELECT LN(21) "Natural log of 21" FROM DUAL;

Natural log of 21
-----------------
       3.04452244

SQL> SELECT LN(10) "Natural log of 10" FROM DUAL;

Natural log of 10
-----------------
       2.30258509


SQL LOG() Function

SQL LOG() function return log value (base on n1 value of n2 value).

This function take two parameter (n1, n2). Whereas n1 is base positive number and n2 is positive number.
Mathematical formula is Logarithm: log(12) 120 = 1.926628408

Supported Oracle SQL Version

  • Oracle 8i
  • Oracle 9i
  • Oracle 10g
  • Oracle 11g
  • Oracle 12c
  • Oracle 18c

Example

Consider following LOG function example.

SQL> SELECT LOG(12,120) "Log base 12 of 120" FROM DUAL;

Log base 12 of 120
------------------
        1.92662841

SQL> SELECT LOG(15,100) "Log base 15 of 100" FROM DUAL;

Log base 15 of 100
------------------
        1.70054831

SQL> SELECT LOG(10,100) "Log base 10 of 100" FROM DUAL;

Log base 10 of 100
------------------
                 2