|Oracle9i OLAP Services Developer's Guide to the OLAP DML
Release 1 (9.0.1)
Part Number A86720-01
Designing Programs, 12 of 13
You can explicitly compile a program by using the COMPILE command. If you do not explicitly compile a program, then it is compiled when you run the program for the first time after you have edited it.
The following is an example of a COMPILE command that compiles the MYPROG program.
For the syntax of the COMPILE commands, see the entry for the command in OLAP DML Reference.
Suppose you misspell the dimension MONTH in a LIMIT command in the MYPROG program.
When the COMPILE command encounters this command, it produces the following message.
You can edit the program to correct the error and then try to compile it again.
When a program is compiled, it translates the program commands into efficient processed code that executes much more rapidly than the original text of the program. If errors are encountered in the program, then the compilation is not completed, and the program is considered to be uncompiled.
Note: Program lines that include ampersand substitution will not be compiled. However, the presence of such lines does not constitute an error. A program whose other lines compiled correctly is considered to be a compiled program.
After you compile a program, the compiled code is used each time you run the program in the current OLAP Services session. When you update your analytic workspace after compiling a program, the compiled code is saved in your analytic workspace and uses it when you run the program in future sessions. Therefore, you should be sure to update your analytic workspace after compiling a program.
After you export a program from a source analytic workspace, if you import the program to a target analytic workspace, then the compiled code is not exported or imported. Therefore, after you import a program to a target analytic workspace, you need to compile the program and update the target analytic workspace.
To keep an application analytic workspace compact and uncluttered, application builders often define and test objects in a test analytic workspace, and then import the tested objects to the final analytic workspace. When you follow this procedure, remember to compile your programs in the final analytic workspace.
When your program defines an object and then uses the object in the program, the program will not compile. When COMPILE encounters the reference to the object, it treats the reference as a misspelling because the object does not yet exist in the analytic workspace.
You can use the ISCOMPILED choice of the OBJ function to determine whether a specific program in your analytic workspace has been compiled since the last time it was modified. The function returns a Boolean value.
For the syntax of the OBJ function, see the entry for the function in OLAP DML Reference.