Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 Oracle PL/SQL: REGR_SLOPE Jump to:  
Category: >> Oracle PL/SQL >> REGR_SLOPE Bookmark and Share

<< 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
*/


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 218 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?