Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Help with REGR_SLOPE function

Posted on 2013-01-22
4
Medium Priority
?
1,085 Views
Last Modified: 2013-01-27
I am trying to use the REGR_SLOPE function, but I am getting null values back from the function. I am probably making a simple mistake, but could do with some help understanding where I am going wrong:

SQL> select * from test_slope;

   SL_AGE    SL_MEAN
---------- ----------
         0      56.67
        20     292.33
        40        548
        60        713
        80     943.67

SQL> select sl_age, sl_mean, regr_slope(sl_age, sl_mean) 
over (partition by sl_age) "SLOPE" from test_slope;

   SL_AGE    SL_MEAN      SLOPE
---------- ---------- ----------
         0      56.67 
        20     292.33 
        40        548 
        60        713 
        80     943.67 

 

Open in new window


I am expecting to get the following SLOPE values:

 SL_AGE    SL_MEAN      SLOPE
---------- ---------- ----------
         0      56.67       
        20     292.33      11.78
        40        548      12.28
        60        713      11.12
        80     943.67      10.97

Open in new window

0
Comment
Question by:theskintman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 38805056
check the below one..

select sl_age, sl_mean, regr_slope(100-sl_age, sl_mean)
over (partition by sl_age) "SLOPE" from test_slope;
0
 

Author Comment

by:theskintman
ID: 38805073
That produces the same NULL outcome. What is your logic to doing "100-sl_age"?
0
 

Accepted Solution

by:
theskintman earned 0 total points
ID: 38805288
Solved:
select sl_age, sl_mean, regr_slope(sl_mean, sl_age) over (order by sl_age) "SLOPE" from test_slope;

Open in new window

0
 

Author Closing Comment

by:theskintman
ID: 38823769
I eventually worked it out for myself.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to take different types of Oracle backups using RMAN.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question