Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

PERCENTILE_DISC windowing function

Declaration

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

Description

The window function PERCENTILE_DISC computes a percentile for the sorted values

within a window. The result is a column value that exists within the window which represents the value with the

smallest CUME_DIST value that is greater than or equal to the percentile value specified by the numeric_literal

argument.

• 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_disc(0.6) within group (order by c1) over (partition by c3) from pc2;


C1 C3 PERCENTILE_D

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

1 2

1 1 2

2 1 2

4 2 5

5 2 5

3

6 records selected

TOCIndex