Definition:
In Oracle PL/SQL, the function REGR_COUNT is a linear regression analytic function which takes two numeric inputs and counts the number of pairs in which the value of both of the arguments is NOT NULLNULL.
Example Syntax:
REGR_COUNT(x,y)
In the syntax, 'x' is referred to as the dependent variable and 'y' is referred to as the independent variable of the Regression Line.
Example Usage:
The SQL query below uses REGR_COUNT to count the NOT NULL pairs of SAL and DEPTNO in the EMPLOYEE table.
sql> SELECT deptno, sal, regr_count(sal, deptno) OVER (partition by deptno) "REGR_COUNT"
FROM employee
/
DEPTNO SAL REGR_COUNT
----------- ---------- ----------
100 2300 5
100 3810 5
100 3810 5
100 8300 5
100 5
100 2300 5
110 3900 3
110 8210 3
110 2900 3
120 4500 4
120 8300 4
120 1200 4
120 3200 4
13 rows selected.
Related Links:
Related Code Snippets:
- REGR_COUNT - REGR_COUNT Returns the number of non-null numbers used to fit the regression line.
...
