|Oracle® OLAP DML Reference
11g Release 1 (11.1)
|PDF · Mobi · ePub|
Within an OLAP DML program, the ARGS function lets you reference the arguments that are passed to a program. The function returns all the arguments as a single text value. You can use the ARGS function only within a program that is be invoked as a command, not as a user-defined function or with a CALL statement.
Note:Typically, programmers use an ARGUMENT statement to define arguments in a program, thereby negating the need for using the ARGS function to reference arguments passed to the program. For more information on how to use ARGUMENT to define arguments that are passed to a program, see "Declaring Arguments that Will be Passed Into a Program" .
When no arguments have been specified for the program, ARGS returns a null value
Assume you have a program that produces a simple sales report. You want to be able to produce this report for any month, so you do not want to limit the
month dimension to any fixed month in the program. You can use the ARGS function in your LIMIT command so that the months for the report can be supplied as an argument when the program is run.
When ARGS is included in the LIMIT command preceded by an ampersand (
&), Oracle OLAP substitutes the values of
&ARGS before the command is executed and, as a result, treats the whole argument as a phrase of the LIMIT command. The
salesreport program has a LIMIT command that includes
DEFINE salesrpt PROGRAM PROGRAM PUSH month product district TRAP ON cleanup LIMIT month TO &ARGS LIMIT product TO 'CANOES' LIMIT district TO ALL REPORT grandtotals DOWN district sales cleanup: POP month product district END
When you execute the following statement, the LIMIT command will use the values
Feb96 for the
salesrpt 'Jan96' 'Feb96'
PRODUCT: CANOES --------SALES-------- --------MONTH-------- DISTRICT Jan96 Feb96 ---------------------------------- Boston 70,489.44 82,237.68 Atlanta 56,271.40 61,828.33 Chicago 48,661.74 54,424.94 Dallas 35,244.72 40,218.43 Denver 44,456.41 50,623.19 Seattle 67,085.12 74,834.29 ---------- ---------- -- 322,208.83 364,166.86 ========== ========== ==