Local Temporary Views

Note that an MDX statement results in a sequence of SQL SELECT statements. As mentioned before, the result of each such statement is a virtual table that is used in the FROM clause of one or more subsequent statements. To do this, you need to give a name to the result of a SELECT statement, which can be used for the duration of that session as a table in any subsequent SELECT statement.

The CREATE LOCAL TEMPORARY VIEW statement is used for this purpose. The syntax is:

CREATE LOCAL TEMPORARY VIEW <view_name>
   AS <query_expression>

This statement creates a temporary view that is visible within the module for the duration of the session. It is assumed that these views are destroyed when the session terminates, so explicit DROP VIEW statements are not shown.