Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

PLSQL | LN Function

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The LN function is an inbuilt function in PLSQL which is used to return the natural logarithm of a given input number. The natural logarithm of a number is the logarithm of that number to the base e, where e is the mathematical constant approximately equal to 2.718. This is written using the notation lnx and also some time as logex.

Syntax:

LN(number) 

Parameters Used:
This function accept a parameter number which is the numeric value used to calculate the natural logarithm. This number should must be greater than 0.

Return Value:
This function returns the natural logarithm of a given input numeric value.

Supported Versions of Oracle/PLSQL:

  1. Oracle 12c
  2. Oracle 11g
  3. Oracle 10g
  4. Oracle 9i
  5. Oracle 8i

Let’s see some examples which illustrate the LN function:

Example-1:

DECLARE 
   Test_Number number := 20;
   
BEGIN 
   dbms_output.put_line(LN(Test_Number number)); 
   
END;  

Output:

2.99573227355399

In the above example, 20 is the numeric value whose natural logarithm value is 2.99573227355399

Example-2:

DECLARE 
   Test_Number number := 25;
   
BEGIN 
   dbms_output.put_line(LN(Test_Number number)); 
   
END; 

Output:

3.2188758248682

In the above example, 25 is the numeric value whose natural logarithm value is 3.2188758248682

Example-3:

DECLARE 
   Test_Number number := 100.5;
   
BEGIN 
   dbms_output.put_line(LN(Test_Number number)); 
   
END; 

Output:

4.61015772749913

In the above example, 100.5 is the numeric value whose natural logarithm value is 4.61015772749913

Advantage:
This function is used to find out the natural logarithm of a given input number.

My Personal Notes arrow_drop_up
Last Updated : 01 Nov, 2019
Like Article
Save Article
Similar Reads