Oracle9i OLAP Developer's Guide to the OLAP DML Release 2 (9.2) Part Number A95298-01 |
|
Selecting Data, 13 of 13
A valueset is a workspace object that contains a list of dimension values for a particular dimension. You use a valueset to save a dimension status list for later use. The values in a valueset can be saved across OLAP sessions. When you attach an analytic workspace, each dimension has all of the values in the default status list. You can then limit a dimension to the values stored in the valueset for that dimension. When you first define a valueset, its value is null. After defining a valueset, you use the LIMIT
command to assign values from the dimension to the valueset. You can use the LIMIT
command with valuesets in many of the ways that you use it with dimensions. For example, you can use the LIMIT
command to expand, reduce, and replace values in the list of values of a valueset.
To create a valueset, take the following steps.
DEFINE
command with the VALUESET
keyword.This example defines a valueset named lineset
. It is dimensioned by line
and, therefore, it can be limited by the current values of the line
dimension.
The following commands limit the line
dimension to the first two values, then show the current status of line
.
LIMIT line TO FIRST 2 STATUS line The current status of LINE is: REVENUE, COGS
These commands define a valueset names lineset
, set it to the current status list of the line
dimension, and show its values. The LD
command attaches a description to the object.
DEFINE lineset VALUESET line LD Valueset for LINE dimension values LIMIT lineset TO line SHOW VALUES(lineset) REVENUE COGS
After you have defined a valueset, you can use it to limit a dimension with a single LIMIT
command.
For example, the following commands limit the line
dimension to the values stored in the lineset
valueset and display the new status of line
.
LIMIT line TO lineset STATUS line The current status of LINE is: REVENUE, COGS
The following commands limit district
to the districts in which sportswear sales exceeded $1,000,000 in 1996. The current status list for the district
dimension is saved in the valueset SPORTS.DISTRICT
. Once you have created the valueset, you can limit the district
dimension to the same values with one LIMIT
command.
DEFINE sports.district VALUESET district LIMIT product TO 'SPORTSWEAR' LIMIT month TO year 'YR96' LIMIT sports.district TO TOTAL(sales district) GT 1000000 LIMIT district TO sports.district
The STATUS
command shows the new status of district
.
STATUS district The current status of DISTRICT is: ATLANTA TO DENVER
You can use the LIMIT
command to change the values in a valueset. The simplified syntax for using the LIMIT
command in this way is shown below:
LIMIT valueset keyword selection
The valueset
argument specifies the name of the valueset you want to change.
The keyword
that you specify determines how the command affects the values that are currently in the valueset. The following table outlines the use of the keywords.
The selection
argument specifies the selection criteria that you want to be used to determine what values to assign to the valueset. In general, you can use the same arguments when you are using the LIMIT
command to select values for a valueset that you can use when you use the LIMIT
command to limit a dimension.
You can use the following commands and functions to identify and retrieve dimension values that are in a valueset.
Suppose an analytic workspace contains a valueset called monthset
that has the values JAN95
, MAY95
, and DEC95
. You can use the VALUES
function to list the values in that valueset.
The following OLAP DML command produces the output shown below it.
SHOW VALUES(monthset) JAN95 MAY95 DEC95
Suppose that you want to retrieve the position of the values in the monthset
valueset, rather than retrieve the actual values themselves. To retrieve the position of values, you use the VALUES
function with the INTEGER
keyword. When you use this keyword, the position numbers are returned instead of the actual dimension values that are included in a valueset. The position numbers that are returned do not represent positions in the valueset; they represent positions in the dimension on which the valueset is based.
The following OLAP DML command produces the output shown below it.
SHOW VALUES(monthset INTEGER) 61 65 72
The value JAN95
is shown as the sixty-first value in the month
dimension, MAY95
as the sixty-fifth value, and DEC95
as the seventy-second value, although they are the first, second, and third values in monthset
.
|
Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved. |
|