SQL Tutorial SQL Advanced SQL Database SQL References

Oracle SQRT() Function



The Oracle (PL/SQL) SQRT() function returns the square root of a given number. In special cases it returns the following:

  • If the number is a negative value, then an error is returned.

Syntax

SQRT(number)

Parameters

number Required. Specify the number. Must be a non-negative value.

Return Value

Returns the square root of a given number.

Example 1:

The example below shows the usage of SQRT() function.

SQRT(2)
Result: 1.41421356237309504880168872420969807857

SQRT(3)
Result: 1.73205080756887729352744634150587236694

SQRT(10)
Result: 3.16227766016837933199889354443271853372

SQRT(50)
Result: 7.07106781186547524400844362104849039285

SQRT(100)
Result: 10

Example 2:

Consider a database table called Sample with the following records:

Datax
Data 10.5
Data 21
Data 35
Data 410
Data 550

The statement given below can be used to calculate the square root of column x.

SELECT Sample.*, SQRT(x) AS SQRT_Value FROM Sample;

This will produce the result as shown below:

DataxSQRT_Value
Data 10.5.7071067811865475244008443621048490392848
Data 211
Data 352.23606797749978969640917366873127623544
Data 4103.16227766016837933199889354443271853372
Data 5507.07106781186547524400844362104849039285

❮ Oracle Functions