Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

VAR windowing function

Declaration

VAR ( { numeric_expression } ) OVER ( [ partition_by_clause ] order_by_clause )

Description

VAR returns the statistical variance of all values in the specified expression.

• The argument numeric_expression can be of any numeric type except BIT. Aggregate functions and subqueries are not allowed.

• The result is of type float.

• The result can have a null value.

Example

select c1, c3, var(c1) over (order by c3) from pc2;


C1 C3 VAR(C1)

-- -- -------

1 1 0.50000000000

2 1 0.50000000000

1 0.50000000000

4 2 3.33333300000

5 2 3.33333300000

3 3.33333300000

6 records selected

See also

VARP

TOCIndex