|Oracle® OLAP DML Reference
11g Release 1 (11.1)
|PDF · Mobi · ePub|
The data type of the expression. It can be INTEGER, LONGINT, DECIMAL, or DATE.
SMALLEST(expression [CACHE] [dimension...])
The expression whose smallest value is to be returned.
Specifies slightly different internal behavior. Specify this keyword only when the original performance is extrememly slow.
The name of a dimension of the result; or, the name of a relation between one of the dimensions of expression and another dimension that you want as a dimension of the result.
By default, SMALLEST returns a single value. When you indicate one or more dimensions for the result, SMALLEST tests for values along the dimensions that are specified and returns an array of values. Each dimension must be either a dimension of expression or related to one of its dimensions.
Tip:When you specify a dimension that is not an actual dimension of expression, but, instead, is dimension that is related to a dimension of expression and when there is more than one relation between the two dimensions, Oracle OLAP uses the default relation between the dimensions to perform the calculation. (See the RELATION command for more information on default relations.) When you do not want Oracle OLAP to use this default relation, specify the related dimension by specifying the name of a specify relation.
SMALLEST is affected by the NASKIP option in the same manner as other aggregate functions. When NASKIP is set to
YES (the default), SMALLEST ignores
NA values and returns the smallest value or values that are not
NA. When NASKIP is set to
NO, SMALLEST returns
NA when any value of the expression is
NA. When all the values of the expression are
NA, SMALLEST returns
NA for either setting of NASKIP.
This example uses the SMALLEST function to find the smallest monthly sportswear sales for three districts during the first half of 1996. To see the smallest sales figure for each district, specify
district as the dimension of the results.
LIMIT product TO 'Sportswear' LIMIT district TO FIRST 3 LIMIT month TO 'Jan96' TO 'Jun96' REPORT HEADING 'Smallest Sales' SMALLEST(sales district)
The preceding statements produce the following output.
Smallest DISTRICT Sales -------------- ---------- Boston 57,079.10 Atlanta 129,616.08 Chicago 77,489.51