Oracle® OLAP DML Reference 10g Release 1 (10.1) Part Number B1033902 


View PDF 
For a given expression, the WIDTH_BUCKET function returns the bucket number into which the value of this expression would fall after being evaluated.
Return Value
An INTEGER.
Syntax
WIDTH_BUCKET (expr , min_value , max_value , num_buckets)
Arguments
The expression for which the histogram is being created. This expression must evaluate to a number or a datetime value. When expr evaluates to NA
, then the expression returns NA
.
An expression that resolves to the minimum end point of the acceptable range for expr. This expression must evaluate to number or datetime values, and cannot evaluate to NA
.
An expression that resolves to the maximum end point of the acceptable range for expr. This expression must evaluate to number or datetime values, and cannot evaluate to NA
.
An expression that resolves to a constant indicating the number of buckets. This expression must evaluate to a positive INTEGER.
Notes
The function also creates (when needed) an underflow bucket numbered 0
and an overflow bucket numbered num_buckets+1
. These buckets handle values less than min_value and more than max_value and are helpful in checking the reasonableness of endpoints.
Notes
WIDTH_BUCKET lets you construct equiwidth histograms, in which the histogram range is divided into intervals that have identical size. (Compare this function with NTILE, which creates equiheight histograms.) Ideally each bucket is a "closedopen" interval of the real number line. For example, a bucket can be assigned to cores between 10.00
and 19.999...
to indicate that 10
is included in the interval and 20
is excluded. This is sometimes denoted (10,
20)
.