8.2.7 DEGREES
Returns the result of converting the specified angle from radians to degrees.
- Organization of this subsection
(1) Specification format
scalar-function-DEGREES ::= DEGREES(angle) angle ::= value-expression
(2) Explanation of specification format
- angle:
-
Specifies the angle in radians.
The following rules apply:
-
Specify the angle in the form of a value expression. For details about value expressions, see 7.20 Value expression.
-
Specify numeric data for the angle. For details about numeric data, see (1) Numeric data in 6.2.1 List of data types.
-
You cannot specify a dynamic parameter by itself for the angle.
-
(3) Rules
-
The data type of the execution result is the DOUBLE PRECISION type.
-
If the execution result cannot be represented in the DOUBLE PRECISION type, an overflow error is generated.
-
The NOT NULL constraint does not apply to the value of the execution result (the null value is allowed).
-
If the angle has a null value, the execution result will be a null value.
(4) Examples
- Example 1:
-
Convert to degrees.
SELECT DEGREES(PI()) FROM "T1"
- Example 2:
-
With the values of columns C1 and C2 from table T1 as input, use the scalar function ATAN2 to determine the inverse tangent of the angle (in radians), and then use the scalar function DEGREES to convert it to degrees.
SELECT DEGREES(ATAN2("C1","C2")) FROM "T1"