totn Oracle Functions

Oracle / PLSQL: CORR Function

This Oracle tutorial explains how to use the Oracle/PLSQL CORR function with syntax and examples.

Description

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

Syntax

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.

Note

  • The CORR function requires at least two rows.

Returns

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

Example

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;