Oracle ATAN() Function

Oracle ATAN() is a built-in function that returns the arctangent of a given number.

Oracle ATAN() syntax

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

ATAN(num)

Parameters

num

Required. 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

The Oracle ATAN() function returns the arctangent of a given number. It is -pi/2a pi/2value in the range to , expressed in radians.

If the parameter is of type BINARY_FLOAT, ATAN() returns a BINARY_DOUBLE. Otherwise, ATAN() returns the same data type as the parameter.

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

Oracle ATAN() Examples

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

Basic Usage

SELECT
    ATAN(1)
FROM dual;

Output:

                                      ATAN(1)
_____________________________________________
   0.7853981633974483096156608458198757210456

Non-Numeric Values

If the parameter cannot be converted to a number, ATAN() will give an error.

SELECT
  ATAN('ABC')
FROM dual;

Output:

01722\. 00000 -  "invalid number"
*Cause:    The specified number was invalid.
*Action:   Specify a valid number.

NULL Parameters

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

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

Output:

   ATAN(NULL)
_____________
         NULL

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

Conclusion

Oracle ATAN() is a built-in function that returns the arctangent of a given number.