PLSQL | SQRT Function

The SQRT function is an inbuilt function in PLSQL which is used to return the square root of the given input number.

Syntax:

SQRT( number )

Parameters Used:
This function accepts a parameters which are illustrated below:



number – This is the input number whose square root is going to be calculated.

Return Value:
This function returns a numeric number which is square root of the given input number.

Supported Versions of Oracle/PLSQL is given below:

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

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

Example-1:

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

Output:

5

In the above example, 5 is the square root of 25.

Example-2:

DECLARE 
   Test_Number number := 5.617;
   
BEGIN 
   dbms_output.put_line(SQRT(Test_Number number)); 
   
END; 

Output:

2.37002109695251

In the above example, 2.37002109695251 is the square root of 5.617

Example-3:

DECLARE 
   Test_Number number := 9;
   
BEGIN 
   dbms_output.put_line(SQRT(Test_Number number)); 
   
END; 

Output:

3

In the above example, 3 is the square root of 9

Advantage:
This function is used to calculate the square root of the given input number.



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.