Oracle COS() Function

Oracle COS() is a built-in function that returns the cosine of a given radian.

Oracle COS() syntax

Here is the syntax for the Oracle COS() function:

COS(num)

Parameters

num

Required. Angles expressed in radians. It can be any numeric data type or any non-numeric data type that can be implicitly converted to a numeric data type.

Return Value

Oracle COS() function returns the cosine of a given radian.

If the parameter is BINARY_FLOAT, COS() returns BINARY_DOUBLE. Otherwise COS() returns the same numeric data type as the parameter.

If any parameter is NULL, COS() will return NULL.

Oracle COS() Examples

Here are some examples that demonstrate the usage of the Oracle COS() function.

Basic Usage

SELECT
    COS(0.2)
FROM dual;

Output:

                                     COS(0.2)
_____________________________________________
   0.9800665778412416311241965167481688773902

NULL Parameters

If any parameter is NULL, COS() will return NULL.

SET NULL 'NULL';
SELECT
    COS(NULL)
FROM dual;

Output:

   COS(NULL)
____________
        NULL

In this example, we use the statement SET NULL 'NULL'; to display NULL values as the string 'NULL'.

Conclusion

Oracle COS() is a built-in function that returns the cosine of a given radian.