Oracle / PLSQL: COVAR_SAMP Function

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


The Oracle/PLSQL COVAR_SAMP function returns the sample covariance of a set of number pairs.


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

COVAR_SAMP( expression1, expression2 )


A numeric expression that is used in the calculation.


A numeric expression that is used in the calculation.


The COVAR_SAMP function returns a numeric value.


The COVAR_SAMP function eliminates all pairs where expression1 or expression2 has a null value.

Applies To

The COVAR_SAMP 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 COVAR_SAMP function examples and explore how to use the COVAR_SAMP function in Oracle/PLSQL.

For example:

select owner, COVAR_SAMP(avg_row_len, avg_space)
from all_tables
group by owner;