Oracle / PLSQL: COVAR_SAMP Function

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

Description

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

Syntax

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

COVAR_SAMP( expression1, expression2 )

expression1

A numeric expression that is used in the calculation.

expression2

A numeric expression that is used in the calculation.

Returns

The COVAR_SAMP function returns a numeric value.

Note

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

Example

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;