Oracle® OLAP DML Reference 11g Release 2 (11.2) E17122-08 |
|
|
PDF · Mobi · ePub |
The CONTEXT command lets you create and use a context during your Oracle OLAP session. A context is a means of preserving object values. After you create a context, you can save the current status of dimensions and the values of options, single-cell variables, valuesets, and single-cell relations in the context. You can then restore some or all of the object values from the context. A context exists only for the duration of an Oracle OLAP session. It is not an analytic workspace object and therefore cannot be saved as part of any analytic workspace. When a context contains saved values for objects in a particular analytic workspace, and you detach that analytic workspace, Oracle OLAP removes those objects from the context. That context retains any saved values for Oracle OLAP options and objects from other analytic workspaces that are still attached.
You can use the CONTEXT function to obtain information about a context.
The CONTEXT command and function provide an alternative to the PUSH and POP statements. With contexts, you can access and update the saved object values, whereas PUSH and POP simply allow you to save and restore values.
A text expression that contains the name of the context.
Creates a context with the name specified by context-name, which must be unique.
Stores the values of the objects specified in objects in the context. You may save the values of single-cell variables and relations in a context. You cannot use the CONTEXT command to save the values of dimensioned variables, dimensioned relations, or the NAME dimension. If you try to save values from these objects, Oracle OLAP produces an error message.
Sets the appropriate objects to the values of all corresponding objects saved in the context.
Deletes the context.
Stores the values of the objects specified in objects in the context.
Drops the values of the objects specified in objects from the context.
Note:
When you delete an Oracle OLAP object during the session, it is also removed from the context.Sets whatever objects you specify in objects to the values of the corresponding objects saved in the context.
One or more object names. Each object name must be separated by a space. When you are listing several name(s) that do not fit on a single line, you may use the continuation character to continue the CONTEXT command on additional lines.
A suggested programming practice is to name the context after the analytic workspace with which it is associated.
Example 9-72 Saving Dimension Status
This example shows how you can use the CONTEXT command to save and restore the status of a dimension. The following statements create a context that includes a subset of the values in the product
dimension.
LIMIT product TO 'Tents' 'Canoes' CONTEXT 'democontext1' CREATE CONTEXT 'democontext1' SAVE product
The following statements limit product
to all its values and produce a report that lists them all.
LIMIT product TO ALL REPORT product
This is the report.
PRODUCT ----------- Tents Canoes Racquets Sportswear Footwear
The following statements apply the saved context and produce a report that lists only the values included in the context.
CONTEXT 'democontext1' APPLY REPORT product
This is the new report.
PRODUCT ----------- Tents Canoes