Oracle® OLAP DML Reference 11g Release 2 (11.2) E17122-08 |
|
|
PDF · Mobi · ePub |
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".
Note:
Do not confuse the RELATION command with the RELATION statements in AGGMAP or ALLOCMAP.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.The name of a previously-defined relation that Oracle OLAP uses as the default relation for the dimension specified by dimension-name.
Specifies removal of previously-specified default relation information.
Removes all previously-defined default relation information.
How Oracle OLAP Chooses Between Multiple Relations
When there are multiple relations 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:
Uses the relation specified in the statement, if any.
Uses the default relation for the dimension. Oracle OLAP determines the default relation as follows:
When you have specified a default relation using the RELATION command, Oracle OLAP recognizes that relation as the default relation.
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.
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.
Example 10-95 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, the city_district
relation is the default relation between city
and district
because the city_district
relation was the first relation defined between city
and district
t 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