Oracle COS() Function
The Oracle (PL/SQL) COS() function returns trigonometric cosine of an angle (angle should be in radians).
Syntax
COS(x)
Parameters
x |
Required. Specify the angle in radian. |
Return Value
Returns the trigonometric cosine of an angle.
Example 1:
The example below shows the usage of COS() function.
COS(0) Result: 1 COS(1) Result: .5403023058681397174009366074429766037354 COS(-1) Result: .5403023058681397174009366074429766037354 COS(2) Result: -.41614683654714238699756822950076218977 COS(-2) Result: -.41614683654714238699756822950076218977
Example 2:
Consider a database table called Sample with the following records:
Data | x |
---|---|
Data 1 | -10 |
Data 2 | -5 |
Data 3 | 0 |
Data 4 | 5 |
Data 5 | 10 |
The statement given below can be used to calculate the trigonometric cosine value of column x.
SELECT Sample.*, COS(x) AS COS_Value FROM Sample;
This will produce the result as shown below:
Data | x | COS_Value |
---|---|---|
Data 1 | -10 | -.83907152907645245225886394782406483451 |
Data 2 | -5 | .2836621854632262644666391715135573083265 |
Data 3 | 0 | 1 |
Data 4 | 5 | .2836621854632262644666391715135573083265 |
Data 5 | 10 | -.83907152907645245225886394782406483451 |
❮ Oracle Functions