Skip Headers
Oracle® OLAP DML Reference
10g Release 2 (10.2)

Part Number B14346-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

RELATION command

The RELATION command identifies a relation as the default relation for a specified dimension of the current object; or removes the default relation information from the current object. For more information on default relations, see "Using Related Dimensions in Expressions".

Syntax

RELATION {dimension-name relation-name }| DELETE { ALL | dimension-name}

Arguments

dimension-name

The name of a previously-defined dimension. The dimension specified by the dimension-name argument must be a dimension of the currently considered object for which you want to specify or delete a default relation.


Note:

The dimension specified by the dimension-name argument must be a dimension of the currently considered object. The current object is the object that has been most recently defined or considered during the current session. To make an object definition the current definition, use a CONSIDER statement.

relation-name

The name of a previously-defined relation that Oracle OLAP uses as the default relation for the dimension specified by dimension-name.

DELETE

Specifies removal of previously-specified default relation information.

ALL

Removes all previously-defined default relation information.

Notes

How Oracle OLAP Chooses Between Multiple Relations

When there is more than one relation between the two dimensions and you attempt to perform calculation on one of those dimension based on related dimensions, Oracle OLAP chooses the relation to use when executing the statement as follows:

  1. Uses the relation specified in the statement, if any.

  2. Uses the default relation for the dimension. Oracle OLAP determines the default relation as follows:

    1. When you have specified a default relation using the RELATION command, Oracle OLAP recognizes that relation as the default relation.

    2. When you have not specified a default relation using the RELATION command, Oracle OLAP recognizes the first relation that you defined as the default relation.

Identifying Default Relations

Use the OBJ function with the RELATION keyword to identify the default relation information for an object.

Multiple RELATION Commands Against the Same Object

Unlike other statements that operate against the most recently considered object (for example, an LD statement), a new RELATION command does not replace previously-issued RELATION commands. Instead, issuing multiple RELATION commands against the same object has a cumulative effect.

Examples

Example 20-12 Specifying a Default Relation Using the Relation Command

Assume that you defined the following analytic workspace objects (in the following order).

DEFINE CITY DIMENSION TEXT
DEFINE DISTRICT DIMENSION TEXT
DEFINE CITY_DISTRICT RELATION DISTRICT <CITY>
DEFINE CITY_REDISTRICT_1 RELATION DISTRICT <CITY>

REPORT city_district
CITY                    CITY_DISTRICT
-------------------- --------------------
Annapolis            Southern
Bethesda             Southern
Charlotte            Southern
Gettysburg           Southern
Greensboro           Southern
Raleigh              Southern
Reston               Southern
Rochester            Southern
Virginia Beach       Southern
Washington           Capital
 
 
REPORT city_redistrict_1
CITY                  CITY_REDISTRICT_1
-------------------- --------------------
Annapolis            Capital
Bethesda             Capital
Charlotte            Southern
Gettysburg           Southern
Greensboro           Southern
Raleigh              Southern
Reston               Southern
Rochester            Southern
Virginia Beach       Capital
Washington           Capital

As the following OBJ statements illustrate, at this time the city_district relation is the default relation between city and district since the city_district relation was the first relation defined between city and districtt and a default relation has not been specified using a RELATION statement.

SHOW OBJ (RELATION ACTUAL 'city' 'district')
CITY_DISTRICT
 
SHOW OBJ (RELATION SPECIFIED 'city' 'district')
NA
 

Assume that you now issue the following statements to limit district to Washington and make the city_redistrict_1 relation the default relation.

LIMIT city TO district
CONSIDER city
RELATION city city_redistrict_1
 

As the following OBJ statements illustrate, now the city_redistrict_1 relation that you specified with the RELATION statement is the default relation between city and district.

SHOW OBJ (RELATION ACTUAL 'city' 'district')
CITY_REDISTRICT_1
SHOW OBJ (RELATION SPECIFIED 'city' 'district')
CITY_REDISTRICT_1
 

Also, as the following statements illustrate, when you limit city to district, you get the same results as limiting city to the city_redistrict_1 relation

LIMIT city TO district
 
REPORT city
CITY
--------------------
Annapolis
Bethesda
Virginia Beach
Washington
 
 
LIMIT city to ALL
LIMIT city to city_redistrict_1
 
REPORT city
CITY
--------------------
Annapolis
Bethesda
Virginia Beach
Washington