Oracle SQRT() Function
Oracle SQRT() is a built-in function that returns the square root of a given number.
Oracle SQRT() syntax
Here is the syntax for the Oracle SQRT() function:
SQRT(num)
Parameters
num-
Required. 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
Oracle SQRT() function returns the square root of a given number. The function returns the same data type as the parameter’s numeric data type.
If any parameter is NULL, SQRT() will return NULL.
Oracle SQRT() Examples
Here are some examples that demonstrate the usage of the Oracle SQRT() function.
Basic Usage
SELECT
SQRT(4),
SQRT(9),
SQRT(16)
FROM dual;
Output:
SQRT(4) SQRT(9) SQRT(16)
__________ __________ ___________
2 3 4NULL Parameters
If any parameter is NULL, SQRT() will return NULL.
SET NULL 'NULL';
SELECT
SQRT(NULL)
FROM dual;
Output:
SQRT(NULL)
_____________
NULLIn this example, we use the statement SET NULL 'NULL'; to display NULL values as the string 'NULL'.
Conclusion
Oracle SQRT() is a built-in function that returns the square root of a given number.