Quick Search:
 
 Oracle PL/SQL: REGR_SLOPE Jump to:  
Category: >> Oracle PL/SQL >> REGR_SLOPE  

<< lastnext >>

Snippet Name: REGR_SLOPE

Description: REGR_SLOPE returns the slope of the line. After the elimination of null (expr1, expr2) pairs, it makes the following computation:

COVAR_POP(expr1, expr2) / VAR_POP(expr2)

expr1 – Number expression.
expr2 – Number expression.

The function returns a value of type NUMERIC. If the function is applied to an empty set, then it returns null.

Also see:
» RANK
» VARIANCE
» VAR_SAMP
» VAR_POP
» SUM
» STDDEV_SAMP
» STDDEV_POP
» STDDEV
» ROW_NUMBER
» REGR_SYY
» REGR_SXY
» REGR_SXX
» REGR_R2
» REGR_INTERCEPT
» REGR_COUNT
» REGR_AVGY
» REGR_AVGX
» Number Functions: RATIO_TO_REPORT
» Number Functions: RANK
» PERCENTILE_DISC
» PERCENTILE_CONT
» PERCENT_RANK
» OVER PARTITION BY
» NTILE
» MIN
» MAX
» LEAD
» LAST_VALUE
» LAST
» LAG

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 04th, 2009

REGR_SLOPE   (IN expr1 ANY, IN expr2 ANY); 
 
SELECT s_year, 
   REGR_SLOPE(s_amount, s_profit),
   REGR_INTERCEPT(s_amount, s_profit) 
FROM sales GROUP BY s_year;
 
/*
 S_YEAR     REGR_SLOPE REGR_INTER
---------- ---------- ----------
      1998 128.401558 -2277.5684
      1999  55.618655 226.855296
*/


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org