Oracle® OLAP DML Reference 10g Release 1 (10.1) Part Number B10339-02 |
|
|
View PDF |
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.
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 commands. With contexts, you can access and update the saved object values, whereas PUSH and POP simply allow you to save and restore values.
Syntax
CONTEXT context-name [ CREATE | APPLY | DISCARD | {SAVE |DROP|RESTORE} objects]
Arguments
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.
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.
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.
Notes
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 you delete an Oracle OLAP object during the session, it is also removed from the context.
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, as well as objects from other analytic workspaces that are still attached.
You cannot use the CONTEXT command to save the values of the NAME dimension. When you include NAME in the list of name(s) that you specify with the SAVE keyword, Oracle OLAP produces an error message.
When you are listing several name(s) that will not fit on a single line, you may use the continuation character to continue the CONTEXT command on additional lines.
You may save the values of single-cell variables and relations in a context. When you try to save a dimensioned variable or relation, Oracle OLAP produces an error message.
A suggested programming practice is to name the context after the analytic workspace with which it is associated.
Examples
Example 9-16 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