Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

PERCENTILE_CONT windowing function

Declaration

PERCENTILE_CONT ( numeric_literal ) WITHIN GROUP ( order_by_clause) OVER ( [ partition_by_clause ] )

Description

The window function PERCENTILE_CONT assumes a continuous distribution of the values in the window and takes a percentile value to calculate a value. The value is interpolated, and while it will fall within the range of the window, the value itself may not exist within the result set.

• The argument numeric_literal must be a value between 0.0 and 1.0 .

• WITHIN GROUP specifies a set of numeric values which will be ordered, possibly partitioned, and then used to compute the percentile result.

• The OVER clause of the PERCENTILE_CONT function supports only the partition_by_clause. An ORDER BY clause may NOT be specified within the OVER clause.

Example

select c1, c3, percentile_cont(0.6) within group (order by c1) over (partition by c3) from pc2;


C1 C3 PERCENTILE_CONT(0.600000)

-- -- -------------------------

1 1.6000000000000000000

1 1 1.6000000000000000000

2 1 1.6000000000000000000

4 2 4.6000000000000000000

5 2 4.6000000000000000000

3

6 records selected

TOCIndex