Oracle® OLAP DML Reference 10g Release 2 (10.2) Part Number B14346-03 |
|
|
PDF · Mobi · ePub |
The STATLAST function returns the last value in the current status list of a dimension or a dimension surrogate, or in a valueset.
The data type returned by STATLAST is either the data type of the dimension or dimension surrogate value or an INTEGER
that indicates its position in the default status list of the dimension. See "Automatic Data Conversion of Returned Dimension Values".
STATLAST(dimension)
A text expression whose value is the name of a dimension, a dimension surrogate, or a valueset.
Automatic Data Conversion of Returned Dimension Values
The dimension value returned by STATLAST is converted to a number or a text value, as appropriate to the context. Suppose, for example, that jun95
is the sixth month
value but the last value in the current status list. The value of STATLAST(month)
can be assigned either to a text variable or a numeric variable.
The following statements
DEFINE textvar TEXT TEXTVAR = statlast(MONTH) SHOW textvar
produce this output.
Jun95
In contrast, these statements
DEFINE intvar INTEGER INTVAR = STATLAST(month) SHOW INTVAR
produce this output.
6
Example 24-29 Setting Status with STATLAST
The following line from a program uses STATLAST to limit month
to the values in the status, beginning with a month that has been stored previously in a variable called onemonth
, and ending with the last value in the status.
LIMIT month KEEP onemonth TO STATLAST(month)
STATLAST is used here, rather than a particular month
value, so that the limit can work on any status list.