SQRT scalar function

The SQRT function returns the square root of a number.

Read syntax diagramSkip visual syntax diagramSQRT(expression)

The schema is SYSIBM. (The SYSFUN version of the SQRT function continues to be available.)

expression
An expression that returns a value of any built-in numeric data type. If the argument is decimal floating-point, the operation is performed in decimal floating-point; otherwise, the argument is converted to double-precision floating-point for processing by the function.

If the argument is DECFLOAT(n), the result is DECFLOAT(n); otherwise, the result is a double-precision floating-point number.

The result can be null; if the argument is null, the result is the null value.

Notes

Example

Assume that SQUARE is a DECIMAL(2,1) host variable with a value of 9.0.
   VALUES SQRT(:SQUARE)
Returns the approximate value 3.00.