SQRT
The SQRT function returns the square root of a number.
- expression
- An expression that returns a value of any built-in numeric, character-string, or graphic-string data type. A string argument is converted to double-precision floating point before evaluating the function. For more information about converting strings to double-precision floating point, see DOUBLE_PRECISION or DOUBLE. The value of expression must be greater than or equal to zero.
If the data type of the argument is DECFLOAT(n), the result is DECFLOAT(n). Otherwise, the data type of the result is double-precision floating point. If the argument can be null, the result can be null; if the argument is null, the result is the null value.
Note
Example
- Assume the host variable SQUARE is a DECIMAL(2,1) host variable
with a value of 9.0.
Returns the approximate value 3.00.SELECT SQRT(:SQUARE) FROM SYSIBM.SYSDUMMY1
1 If
*YES is specified for the SQL_DECFLOAT_WARNINGS query option, NaN is returned
with a warning.