SQRT

The SQRT function returns the square root of the argument.

Read syntax diagram
>>-SQRT(numeric-expression)------------------------------------><

The schema is SYSIBM.

The argument must be an expression that returns the value of any built-in numeric data type. If the argument is DECFLOAT, the operation is performed in DECFLOAT. Otherwise, the argument is converted to a double precision floating-point number for processing by the functions.

Start of changeThe argument can also be a character string or graphic string data type. The string input is implicitly cast to a numeric value of DECFLOAT(34).End of change

If the argument is DECFLOAT(n), the result is DECFLOAT(n). Otherwise, the result of the function is a double precision floating-point number. If the argument is a special decimal floating point value, the general rules for arithmetic operations apply. See General Arithmetic Operation Rules for DECFLOAT for more information.

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

Example: Assume that host variable SQUARE is defined as DECIMAL(2,1) and has a value of 9.0. Find the square root of SQUARE.
   SELECT SQRT(:SQUARE)
     FROM SYSIBM.SYSDUMMY1;
This example returns a double precision floating-point number with an approximate value of 3.