Skip Headers

Oracle9i OLAP Developer's Guide to the OLAP DML
Release 2 (9.2)

Part Number A95298-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Selecting Data, 13 of 13


Working with Valuesets

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.

Creating a Valueset

To create a valueset, take the following steps.

  1. Define a valueset for the dimension values. Use the DEFINE command with the VALUESET keyword.
  2. Limit the dimension for which you want to create a valueset to the values you want to save.
  3. Limit the valueset you created in Step 1 to the dimension you limited in Step 2.

Example 6-10 Creating a Valueset

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

Limiting Using a Valueset

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

Example 6-11 Limiting Using a Valueset

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

Changing the Values of a Valueset

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.

IF you want to . . . THEN use the LIMIT command with . . .

replace the values that are currently in the valueset with new values,

either the TO or COMPLEMENT keyword.

remove values from the current valueset,

either the REMOVE or KEEP keyword.

expand the valueset,

either the ADD or INSERT keyword.

sort the values in the valueset,

the SORT keyword.



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.

Identifying and Retrieving the Values in a Valueset

You can use the following commands and functions to identify and retrieve dimension values that are in a valueset.

Command or function

Description

INSTAT function

Checks whether a dimension value is in a valueset.

STATFIRST function

Retrieves the first value in a valueset.

STATLAST function

Retrieves the last value in a valueset.

STATUS command

Sends to the current outfile the status of one or more values in a valueset.

VALUES function

Retrieves the values in a valueset. Depending on whether you specify the INTEGER keyword, the function either returns a multiline text value that contains one dimension value per line or returns, as integers, the position numbers of the values in the existing dimension, not in the valueset.



Retrieving the Values 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

Retrieving the Dimension Positions of Values in a Valueset

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.


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2001, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback