EXECUTE Procedure

The EXECUTE procedure executes one or more OLAP DML commands and directs the output to a printer buffer. It is typically used to manipulate analytic workspace data within an interactive SQL session. In contrast to the RUN Procedure, EXECUTE continues to process commands after it gets an error.

When you are using SQL*Plus, you can direct the printer buffer to the screen by issuing the following command:

SET SERVEROUT ON

If you are using a different program, refer to its documentation for the equivalent setting.

Input and output is limited to 4K. For larger values, refer to the INTERP and INTERPCLOB functions in this package.

This procedure does not print the output of the DML commands when you have redirected the output by using the OLAP DML OUTFILE command.

Note:

You cannot execute this procedure from within the OLAP Worksheet. You must execute if in a SQL tool such as SQL*Plus.

Syntax

EXECUTE ( 
          olap_commands     IN    VARCHAR2
          text              OUT   VARCHAR2);

Parameters

Table B-22 EXECUTE Procedure Parameters

Parameter Description

olap-commands

One or more OLAP DML commands separated by semicolons. See "Guidelines for Using Quotation Marks in OLAP DML Commands".

text

Output from the OLAP engine in response to the OLAP commands.


Example

The following example attaches the GLOBAL analytic workspace and shows the object definition of TIME.

EXECUTE dbms_aw.aw_attach('global');
EXECUTE dbms_aw.execute('DESCRIBE time');

DEFINE TIME DIMENSION TEXT 

The next example shows how EXECUTE continues to process commands after encountering an error:

EXECUTE dbms_aw.execute('SHOW DECIMALS');
2
 
EXECUTE dbms_aw.execute('CALL nothing; DECIMALS=0');
BEGIN dbms_aw.execute('CALL nothing; DECIMALS=0'); END;
 
*
ERROR at line 1:
ORA-34492: Analytic workspace object NOTHING does not exist. 
ORA-06512: at "SYS.DBMS_AW", line 93 
ORA-06512: at "SYS.DBMS_AW", line 122 
ORA-06512: at line 1 
 
EXECUTE dbms_aw.execute('SHOW DECIMALS');
0

The next example show how EXECUTE continues to process commands after encountering an error:

SQL> execute dbms_aw.execute('call nothing; colwidth=20');
BEGIN dbms_aw.execute('call nothing; colwidth=20'); END;
 
*
ERROR at line 1:
ORA-34492: Analytic workspace object NOTHING does not exist.
ORA-06512: at "SYS.DBMS_AW", line 90
ORA-06512: at "SYS.DBMS_AW", line 119
ORA-06512: at line 1
 
 
SQL> execute dbms_aw.execute('show colwidth');
20
 
PL/SQL procedure successfully completed.