Oracle PL/SQL Tutorial/Numerical Math Functions/SIN

Материал из SQL эксперт
Перейти к: навигация, поиск

ABS(-BS(0) ABS(456) SIGN(-IGN(0) SIGN(456)

   <source lang="sql">

SQL> SQL> select abs(-123), abs(0), abs(456)

 2  ,      sign(-123), sign(0), sign(456)
 3  from   dual;
ABS(-123)     ABS(0)   ABS(456) SIGN(-123)    SIGN(0)  SIGN(456)

---------- ---------- ---------- ---------- ----------
      123          0        456         -1          0          1

SQL></source>


Ordinary Trigonometry Functions

SIN returns the sine of a value.

COS returns the cosine of a value.

TAN returns the tangent of a value.

The SIN, COS, and TAN functions take arguments in radians where,

radians = (angle*2* 3.1416 / 360)

14. 19. SIN 14. 19. 1. Ordinary Trigonometry Functions 14. 19. 2. <A href="/Tutorial/Oracle/0280__Numerical-Math-Functions/UsingtheSINfunctiontofindthesineof30degrees.htm">Using the SIN function to find the sine of 30 degrees</a> 14. 19. 3. <A href="/Tutorial/Oracle/0280__Numerical-Math-Functions/SIN0.htm">SIN(0)</a> 14. 19. 4. <A href="/Tutorial/Oracle/0280__Numerical-Math-Functions/selectsin30314159265180.htm">select sin(30*3.14159265/180)</a> 14. 19. 5. <A href="/Tutorial/Oracle/0280__Numerical-Math-Functions/ABS123ABS0ABS456SIGN123SIGN0SIGN456.htm">ABS(-123) ABS(0) ABS(456) SIGN(-123) SIGN(0) SIGN(456)</a>

select sin(30*3.14159265/180)

   <source lang="sql">

SQL> SQL> SQL> select sin(30*3.14159265/180)

 2  from   dual;

SIN(30*3.14159265/180)


           .499999999

SQL></source>


SIN(0)

   <source lang="sql">

SQL> select SIN(0) from dual;

   SIN(0)

        0</source>
   
  

Using the SIN function to find the sine of 30 degrees

   <source lang="sql">

SQL> SQL> -- create demo table SQL> create table myTable(

 2    value1           NUMBER(3),
 3    value2           NUMBER(3),
 4    value3           NUMBER(3)
 5  )
 6  /

Table created. SQL> SQL> -- prepare data SQL> insert into myTable(value1,value2, value3) values (30,60,90)

 2  /

1 row created. SQL> select * from myTable

 2  /
   VALUE1     VALUE2     VALUE3

---------- ----------
       30         60         90

SQL> SQL> SELECT SIN(value1*2*3.1416/360)FROM myTable

 2  /

SIN(VALUE1*2*3.1416/360)


              .50000106

SQL> SQL> SQL> -- clean the table SQL> drop table myTable

 2  /

Table dropped.</source>