Oracle9i OLAP Developer's Guide to the OLAP DML Release 2 (9.2) Part Number A95298-01 |
|
Developing Programs, 2 of 12
An OLAP DML program is written in the OLAP DML. It acts on data in the analytic workspace and helps you accomplish some workspace management or analysis task. You can write OLAP DML programs to perform tasks that you must do repeatedly in the analytic workspace, or you can write them as part of an application that you are developing.
There are two main types of OLAP DML programs: programs that do not return values, and programs that return values. A program that returns a value is called a user-defined function.
You can use an OLAP DML program that does not return a value as a standalone program or as the main program or subprogram of a multiprogram application. These programs behave like OLAP DML commands.
You can use a user-defined function in commands and expressions in the same way that you use built-in OLAP DML functions.
In contrast to the form of a program, the content is related to the job it was created to do, and it is the individual lines of a program that provide its content. Program lines that accomplish specific purposes are discussed in other chapters in this guide.
You can invoke a program that does not return a value by using the CALL
command. You enclose arguments in parentheses, and they are passed by value.
For example, suppose you create a simple program named addit
to add two integers. You can use the CALL
command in the main program of your application to invoke the program.
CALL addit (3, 4)
The syntax for using the CALL
command to invoke a program is shown below.
CALL program-name [(arg1 [arg2 ...])]
The program-name argument is the name of the program to be called.
The arg1... arguments are optional and specify any arguments that are expected by the called program. Specify the arguments so that they match the order in which they are defined in the program.
A user-defined function is a program that returns a value. You invoke user-defined functions in the same way as you use built-in functions. You merely use the program's name in an expression and enclose the program's arguments, if any, in parentheses.
For example:
The following REPORT
command uses the value that is returned by the user-defined function isrecent
that has a single argument, actual
.
REPORT isrecent(actual)
The following command assigns the return value of the user-defined function named tempsales
to a temporary variable called mytempsales
.
mytempsales = tempsales
|
Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved. |
|