SQRT

The SQRT function returns the square root of Expression.

SQL syntax

SQRT(Expression)

Parameters

SQRT has the parameter:

Parameter Description

Expression

Operand or column can be any numeric data type.

Description

  • If Expression is of type NUMBER, the data type returned is NUMBER with maximum precision and scale. If Expression is of type BINARY_FLOAT, the data type returned is BINARY_FLOAT. Otherwise, the data type returned is BINARY_DOUBLE.

  • If Expression is of type NUMBER, the value of Expression cannot be negative.

  • If Expression resolves to a binary floating-point number (BINARY_FLOAT or BINARY_DOUBLE):

    • If the value of the Expression is > = 0, the result is positive.

    • If the value of the Expression is = -0, the result is -0.

    • If the value of the Expression is < 0, the result is NaN.

Examples

Use SQRT function to return the square root of the absolute value of -10. Then cast the value as BINARY_FLOAT.

Command> SELECT CAST (SQRT (ABS (-10)) AS BINARY_FLOAT ) FROM dual;
< 3.162278 >
1 row found.