Oracle / PLSQL: CORR Function

This article is written about how to use the Oracle/PLSQL CORR function with syntax and examples.


The Oracle/PLSQL CORR function returns the coefficient of correlation of a set of number pairs.


The syntax for the CORR function in Oracle/PLSQL is:

CORR( n ,m ) [ over (analytic_clause) ]

Parameters or Arguments

n and m

The numbers to use to calculate the cofficient of correlation.


The CORR function requires at least two rows.


The CORR function returns a numeric value.

Applies To

The CORR function can be used in the following versions of Oracle/PLSQL:

Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i


Let’s look at some Oracle CORR function examples and explore how to use the CORR function in Oracle/PLSQL.

For example:

select CORR(quantity, commission)
from sales;

Here is an example using the GROUP BY clause:

select max_entents, CORR(max_trans, initial_extent)
from data
group by max_extents;