Mega Code Archive

 
Categories / Oracle PLSQL / Analytical Functions
 

REGR_INTERCEPT(expr1, expr2)

SQL> SQL> SQL> create table TestTable (   2    x    number primary key,   3    y    number   4  ); Table created. SQL> insert into TestTable values (1, 7 ); 1 row created. SQL> insert into TestTable values (2, 1 ); 1 row created. SQL> insert into TestTable values (3, 2 ); 1 row created. SQL> insert into TestTable values (4, 5 ); 1 row created. SQL> insert into TestTable values (5, 7 ); 1 row created. SQL> insert into TestTable values (6, 34 ); 1 row created. SQL> insert into TestTable values (7, 32 ); 1 row created. SQL> insert into TestTable values (8, 43 ); 1 row created. SQL> insert into TestTable values (9, 87 ); 1 row created. SQL> SQL> select * from TestTable   2 SQL> SQL> -- REGR_INTERCEPT(expr1, expr2): For the y-intercept of the line SQL> SQL> -- REGR_INTERCEPT(expr1, expr2) SQL> SQL> SELECT REGR_INTERCEPT(y, x) FROM TestTable; REGR_INTERCEPT(Y,X) -------------------          -20.361111 SQL> SQL> drop table TestTable; Table dropped. SQL> SQL> SQL> SQL> SQL>