COSH() Function in Oracle

In Oracle, the COSH() function returns the hyperbolic cosine of its argument.

Syntax

The COSH() function’s syntax goes like this:

COSH(n)

Where n is any numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type.

Example

Here’s an example to demonstrate:

SELECT COSH(2)
FROM DUAL;

Result:

                                    COSH(2) 
___________________________________________ 
   3.76219569108363145956221347777374610831

Null Values

Passing null to COSH() returns null:

SET NULL 'null';

SELECT COSH(null)
FROM DUAL;

Result:

   COSH(NULL) 
_____________ 
         null

By default, SQLcl and SQL*Plus return a blank space whenever a null value occurs as a result of a SQL SELECT statement.

However, you can use SET NULL to specify a different string to be returned. Here I specified that the string null should be returned.

Incorrect Argument Count

Calling COSH() without passing any arguments returns an error:

SELECT COSH()
FROM DUAL;

Result:

Error starting at line : 1 in command -
SELECT COSH()
FROM DUAL
Error at Command Line : 1 Column : 8
Error report -
SQL Error: ORA-00909: invalid number of arguments
00909. 00000 -  "invalid number of arguments"
*Cause:    
*Action:

And passing the wrong number of arguments results in an error:

SELECT COSH(1, 2)
FROM DUAL;

Result:

Error starting at line : 1 in command -
SELECT COSH(1, 2)
FROM DUAL
Error at Command Line : 1 Column : 8
Error report -
SQL Error: ORA-00909: invalid number of arguments
00909. 00000 -  "invalid number of arguments"
*Cause:    
*Action: