11g DML Reference
11g DML Reference
DML Reference
11g Release 1 (11.1)
B28126-03
August 2008
Oracle OLAP DML Reference, 11g Release 1 (11.1)
B28126-03
The Programs (which include both the software and documentation) contain proprietary information; they
are provided under a license agreement containing restrictions on use and disclosure and are also protected
by copyright, patent, and other intellectual and industrial property laws. Reverse engineering, disassembly,
or decompilation of the Programs, except to the extent required to obtain interoperability with other
independently created software or as specified by law, is prohibited.
The information contained in this document is subject to change without notice. If you find any problems in
the documentation, please report them to us in writing. This document is not warranted to be error-free.
Except as may be expressly permitted in your license agreement for these Programs, no part of these
Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any
purpose.
If the Programs are delivered to the United States Government or anyone licensing or using the Programs on
behalf of the United States Government, the following notice is applicable:
U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data
delivered to U.S. Government customers are "commercial computer software" or "commercial technical data"
pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As
such, use, duplication, disclosure, modification, and adaptation of the Programs, including documentation
and technical data, shall be subject to the licensing restrictions set forth in the applicable Oracle license
agreement, and, to the extent applicable, the additional rights set forth in FAR 52.227-19, Commercial
Computer Software--Restricted Rights (June 1987). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA
94065.
The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently
dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup,
redundancy and other measures to ensure the safe use of such applications if the Programs are used for such
purposes, and we disclaim liability for any damages caused by such use of the Programs.
Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.
The Programs may provide links to Web sites and access to content, products, and services from third
parties. Oracle is not responsible for the availability of, or any content provided on, third-party Web sites.
You bear all risks associated with the use of such content. If you choose to purchase any products or services
from a third party, the relationship is directly between you and the third party. Oracle is not responsible for:
(a) the quality of third-party products or services; or (b) fulfilling any of the terms of the agreement with the
third party, including delivery of products or services and warranty obligations related to purchased
products or services. Oracle is not responsible for any loss or damage of any sort that you may incur from
dealing with any third party.
Contents
iii
Inhier Valueset or Variable..................................................................................................... 1-14
Levelrel Relation ...................................................................................................................... 1-15
Familyrel Relation.................................................................................................................... 1-17
Gidrel Relation ......................................................................................................................... 1-18
OLAP DML Statements Apply to All of the Values of a Data Object ........................................ 1-19
Changing the Default Looping Behavior of Statements............................................................ 1-19
How to Specify the Set of Data that OLAP DML Operations Work Against............................ 1-20
About Status Lists ........................................................................................................................... 1-20
Default Status Lists .................................................................................................................. 1-20
Current Status Lists ................................................................................................................. 1-20
Changing the Current Status of a Dimension to Work with a Subset of Data....................... 1-21
Saving and Restoring Current Dimension Status....................................................................... 1-21
Using a Subset of Data Without Changing Status...................................................................... 1-21
Populating Multidimensional Hierarchical Data Objects ............................................................ 1-22
iv
Comparison and Logical Operators ............................................................................................. 2-19
Assignment Operator ..................................................................................................................... 2-20
OLAP DML Expressions ..................................................................................................................... 2-20
About OLAP DML Expressions.................................................................................................... 2-21
How the Data Type of an Expression is Determined ......................................................... 2-21
How the Dimensionality of an Expression is Determined ................................................ 2-21
Determining the Dimensions of an Expression............................................................ 2-22
How Dimension Status Affects the Number of Values in the Results of Expressions ......
2-22
Using Workspace Objects in Expressions.................................................................................... 2-23
How OLAP DML Data Objects Behave in Expressions ..................................................... 2-23
Syntax for Specifying an Object in an Expression............................................................... 2-24
Considerations When Creating and Using Qualified Object Names........................ 2-25
Specifying Values of Dimensions and Composites in Expressions.................................. 2-26
Specifying a Value of a Composite................................................................................. 2-27
Specifying a Value of a CONCAT Dimension.............................................................. 2-27
Using Related Dimensions in Expressions.................................................................... 2-27
Using Variables and Relations in Expressions .................................................................... 2-28
Limiting a Dimension to a Single Value Without Changing Status ................................. 2-28
Syntax of a Qualified Data Reference ............................................................................ 2-29
Qualifying a Variable ....................................................................................................... 2-29
Replacing a Dimension in a Variable............................................................................. 2-30
Qualifying a Relation ....................................................................................................... 2-31
Qualifying a Dimension................................................................................................... 2-31
Using Ampersand Substitution with QDRs ................................................................. 2-31
Working with Empty Cells in Expressions ................................................................................. 2-31
Specifying a Value of NA........................................................................................................ 2-32
Controlling how NA values are treated ............................................................................... 2-32
Numeric Expressions...................................................................................................................... 2-32
Mixing Numeric Data Types .................................................................................................. 2-32
Using Text Dimensions in Arithmetic Expressions ............................................................ 2-33
Limitations of Floating Point Calculations........................................................................... 2-33
Controlling Errors During Calculations ............................................................................... 2-33
Text Expressions.............................................................................................................................. 2-34
Language of Text Expressions ............................................................................................... 2-34
Working with DATETIME Values in Text Expressions ..................................................... 2-34
Working with NTEXT Data.................................................................................................... 2-34
Datetime and Interval Expressions............................................................................................... 2-35
Datetime Expressions ............................................................................................................. 2-35
Interval Expressions ............................................................................................................... 2-35
Datetime/Interval Arithmetic ............................................................................................... 2-36
Date-only Expressions .................................................................................................................... 2-37
Boolean Expressions ....................................................................................................................... 2-38
Creating Boolean Expressions................................................................................................ 2-39
Comparing NA Values in Boolean Expressions.................................................................. 2-40
Controlling Errors When Comparing Numeric Data ......................................................... 2-40
Controlling Errors Due to Numerical Precision........................................................... 2-40
v
Controlling Errors When Comparing Floating Point Numbers ................................ 2-40
Controlling Errors When Comparing Different Numeric Data Types ..................... 2-41
Comparing Dimension Values............................................................................................... 2-41
Comparing Dates ..................................................................................................................... 2-42
Comparing Text Data .............................................................................................................. 2-42
Comparing a Text Value to a Text Pattern.................................................................... 2-43
Comparing Text Literals to Relations ............................................................................ 2-43
Conditional Expressions ................................................................................................................ 2-43
IF...THEN...ELSE expression .................................................................................................. 2-43
SWITCH Expressions .............................................................................................................. 2-44
Substitution Expressions ................................................................................................................ 2-45
vi
4 OLAP DML Programs
Programs Provided With the OLAP DML ........................................................................................... 4-1
Creating OLAP DML Programs............................................................................................................. 4-2
Specifying Program Contents ................................................................................................................ 4-3
Creating User-Defined Functions .................................................................................................... 4-3
Passing Arguments ............................................................................................................................ 4-4
Using Multiple Arguments........................................................................................................ 4-4
Handling Arguments Without Converting Values to a Specific Data Type ...................... 4-4
Passing Arguments as Text with Ampersand Substitution.................................................. 4-4
Program Flow-of-Control ................................................................................................................. 4-5
Preserving the Environment Settings.............................................................................................. 4-6
Changing the Program Environment....................................................................................... 4-6
Ways to Save and Restore Environments................................................................................ 4-7
Saving the Status of a Dimension or the Value of an Option ............................................... 4-7
Saving Several Values at Once .................................................................................................. 4-7
Using Level Markers .................................................................................................................. 4-8
Using CONTEXT to Save Several Values at Once ................................................................. 4-8
Handling Errors.................................................................................................................................. 4-8
Trapping an Error ....................................................................................................................... 4-8
Passing an Error to a Calling Program .................................................................................... 4-9
Passing an Error: Method One........................................................................................... 4-9
Passing an Error: Method Two .......................................................................................... 4-9
Suppressing Error Messages .................................................................................................. 4-10
Creating Your Own Error Messages ..................................................................................... 4-10
Handling Errors in Nested Programs ................................................................................... 4-10
Handling Errors While Saving the Session Environment.................................................. 4-11
Compiling Programs............................................................................................................................. 4-11
Finding Out If a Program Has Been Compiled .......................................................................... 4-11
Programming Methods That Prevent Compilation ................................................................... 4-12
Testing and Debugging Programs...................................................................................................... 4-12
Generating Diagnostic Messages .................................................................................................. 4-12
Identifying Bad Lines of Code....................................................................................................... 4-12
Sending Output to a Debugging File ........................................................................................... 4-12
Executing Programs............................................................................................................................... 4-13
Common Types of OLAP DML Programs ....................................................................................... 4-13
Startup Programs ............................................................................................................................ 4-14
Permission Programs............................................................................................................... 4-14
AUTOGO Programs and ONATTACH Programs ............................................................. 4-15
Data Import and Export Programs ............................................................................................... 4-15
Importing Data to and Exporting Data from Relational Tables........................................ 4-15
Importing Data From Relational Tables to Workspace Objects................................. 4-15
Exporting Data from OLAP DML Objects to Relational Tables ................................ 4-16
Importing Data to and Exporting Data from Flat Files ...................................................... 4-16
Importing Data to and Exporting Data from Spreadsheets............................................... 4-16
Trigger Programs ............................................................................................................................ 4-16
Creating an Object Trigger Program..................................................................................... 4-17
Characteristics of Object Trigger Programs ......................................................................... 4-17
vii
Aggregation, Allocation, and Modeling Programs.................................................................... 4-20
Forecasting Programs ..................................................................................................................... 4-20
Programs to Export and Import Workspace Objects ................................................................. 4-21
User-Written Programs that OLAP Looks For.................................................................................. 4-21
User-Written Programs Looked For by Oracle OLAP .................................................................... 4-22
ONATTACH .................................................................................................................................... 4-23
ONDETACH .................................................................................................................................... 4-24
PERMIT_READ ............................................................................................................................... 4-25
PERMIT_WRITE.............................................................................................................................. 4-26
TRIGGER_AFTER_UPDATE ........................................................................................................ 4-27
TRIGGER_AW................................................................................................................................. 4-28
TRIGGER_BEFORE_UPDATE ...................................................................................................... 4-29
TRIGGER_DEFINE ......................................................................................................................... 4-31
viii
COMMAS ............................................................................................................................................... 6-17
COMPILEMESSAGE............................................................................................................................ 6-18
COMPILEWARN................................................................................................................................... 6-19
DATEFORMAT...................................................................................................................................... 6-20
DATEORDER......................................................................................................................................... 6-24
DAYABBRLEN....................................................................................................................................... 6-26
DAYNAMES........................................................................................................................................... 6-28
DECIMALCHAR................................................................................................................................... 6-29
DECIMALOVERFLOW ....................................................................................................................... 6-30
DECIMALS............................................................................................................................................. 6-31
DEFAULTAWSEGSIZE ........................................................................................................................ 6-33
DIVIDEBYZERO................................................................................................................................... 6-34
DSECONDS ........................................................................................................................................... 6-35
ECHOPROMPT ..................................................................................................................................... 6-36
EIFBYTES................................................................................................................................................ 6-37
EIFEXTENSIONPATH.......................................................................................................................... 6-38
EIFNAMES ............................................................................................................................................. 6-39
EIFSHORTNAMES............................................................................................................................... 6-40
EIFTYPES ................................................................................................................................................ 6-41
EIFUPDBYTES ....................................................................................................................................... 6-42
EIFVERSION.......................................................................................................................................... 6-43
ERRNAMES ........................................................................................................................................... 6-44
ERRORNAME........................................................................................................................................ 6-45
ERRORTEXT .......................................................................................................................................... 6-46
ESCAPEBASE ........................................................................................................................................ 6-47
EXPTRACE.............................................................................................................................................. 6-48
INF_STOP_ON_ERROR...................................................................................................................... 6-49
LCOLWIDTH ......................................................................................................................................... 6-50
LIKECASE .............................................................................................................................................. 6-52
LIKEESCAPE.......................................................................................................................................... 6-53
LIKENL.................................................................................................................................................... 6-56
LIMIT.SORTREL ................................................................................................................................... 6-58
LIMITSTRICT........................................................................................................................................ 6-59
LINENUM............................................................................................................................................... 6-62
LINESLEFT ............................................................................................................................................. 6-64
LOCK_LANGUAGE_DIMS................................................................................................................ 6-66
LSIZE ....................................................................................................................................................... 6-68
MAXFETCH............................................................................................................................................ 6-70
MODDAMP ........................................................................................................................................... 6-71
MODERROR.......................................................................................................................................... 6-74
MODGAMMA....................................................................................................................................... 6-76
MODINPUTORDER ............................................................................................................................ 6-79
MODMAXITERS .................................................................................................................................. 6-81
MODOVERFLOW ................................................................................................................................ 6-82
MODSIMULTYPE................................................................................................................................. 6-84
MODTOLERANCE............................................................................................................................... 6-87
MODTRACE .......................................................................................................................................... 6-90
ix
MONTHABBRLEN............................................................................................................................... 6-93
MONTHNAMES................................................................................................................................... 6-95
MULTIPATHHIER ................................................................................................................................ 6-97
NASKIP................................................................................................................................................. 6-100
NASKIP2............................................................................................................................................... 6-103
NASPELL .............................................................................................................................................. 6-107
NLS_CALENDAR ............................................................................................................................... 6-109
NLS_CURRENCY................................................................................................................................ 6-110
NLS_DATE_FORMAT........................................................................................................................ 6-111
NLS_DATE_LANGUAGE ................................................................................................................. 6-112
NLS_DUAL_CURRENCY.................................................................................................................. 6-113
NLS_ISO_CURRENCY ...................................................................................................................... 6-114
NLS_LANG .......................................................................................................................................... 6-115
NLS_LANGUAGE .............................................................................................................................. 6-116
NLS_NUMERIC_CHARACTERS.................................................................................................... 6-117
NLS_SORT............................................................................................................................................ 6-118
NLS_TERRITORY............................................................................................................................... 6-119
NOSPELL .............................................................................................................................................. 6-120
OKFORLIMIT...................................................................................................................................... 6-121
OKNULLSTATUS ............................................................................................................................... 6-122
OUTFILEUNIT .................................................................................................................................... 6-123
PAGENUM ........................................................................................................................................... 6-124
PAGEPRG ............................................................................................................................................. 6-126
PAGESIZE............................................................................................................................................. 6-129
PAGING ................................................................................................................................................ 6-131
PARENS................................................................................................................................................. 6-133
PERMITERROR .................................................................................................................................. 6-135
POUTFILEUNIT .................................................................................................................................. 6-137
PRGTRACE .......................................................................................................................................... 6-139
RANDOM.SEED.1 and RANDOM.SEED.2................................................................................... 6-141
RECURSIVE ......................................................................................................................................... 6-144
ROLE...................................................................................................................................................... 6-145
ROOTOFNEGATIVE ......................................................................................................................... 6-146
SECONDS............................................................................................................................................. 6-147
SESSCACHE ........................................................................................................................................ 6-148
SESSION_NLS_LANGUAGE .......................................................................................................... 6-150
SORTCOMPOSITE............................................................................................................................. 6-152
SPARSEINDEX .................................................................................................................................... 6-154
SQLBLOCKMAX ................................................................................................................................ 6-155
SQLCODE............................................................................................................................................. 6-156
SQLERRM ............................................................................................................................................ 6-157
SQLMESSAGES .................................................................................................................................. 6-158
STATIC_SESSION_LANGUAGE .................................................................................................... 6-159
THIS_AW .............................................................................................................................................. 6-161
THOUSANDSCHAR.......................................................................................................................... 6-162
TMARGIN ............................................................................................................................................ 6-163
TRACEFILEUNIT................................................................................................................................ 6-164
x
TRIGGERMAXDEPTH ...................................................................................................................... 6-165
TRIGGERSTOREOK.......................................................................................................................... 6-167
USERID ................................................................................................................................................. 6-169
USETRIGGERS ................................................................................................................................... 6-170
VARCACHE.......................................................................................................................................... 6-171
WEEKDAYSNEWYEAR ..................................................................................................................... 6-172
WRAPERRORS.................................................................................................................................... 6-173
YESSPELL ............................................................................................................................................. 6-174
YRABSTART ........................................................................................................................................ 6-175
ZEROROW ........................................................................................................................................... 6-176
ZSPELL .................................................................................................................................................. 6-178
xi
CEIL.......................................................................................................................................................... 7-69
CHANGEBYTES.................................................................................................................................... 7-70
CHANGECHARS.................................................................................................................................. 7-71
CHANGEDRELATIONS ..................................................................................................................... 7-72
CHANGEDVALUES ............................................................................................................................. 7-73
CHARLIST.............................................................................................................................................. 7-74
CHARTOROWID.................................................................................................................................. 7-75
CHGDIMS .............................................................................................................................................. 7-76
CHR.......................................................................................................................................................... 7-78
COALESCE ............................................................................................................................................. 7-79
COLVAL .................................................................................................................................................. 7-80
CONTEXT function .............................................................................................................................. 7-81
CONVERT .............................................................................................................................................. 7-82
CORRELATION .................................................................................................................................... 7-90
COS .......................................................................................................................................................... 7-93
COSH....................................................................................................................................................... 7-94
COUNT.................................................................................................................................................... 7-95
CUMSUM ............................................................................................................................................... 7-97
CURRENT_DATE ............................................................................................................................... 7-100
CURRENT_TIMESTAMP.................................................................................................................. 7-101
DAYOF................................................................................................................................................... 7-102
DBTIMEZONE .................................................................................................................................... 7-103
DDOF..................................................................................................................................................... 7-104
DECODE ............................................................................................................................................... 7-105
DEPRDECL........................................................................................................................................... 7-108
DEPRDECLSW .................................................................................................................................... 7-112
DEPRSL................................................................................................................................................. 7-117
DEPRSOYD .......................................................................................................................................... 7-120
ENDDATE............................................................................................................................................. 7-124
ENDOF .................................................................................................................................................. 7-125
EVERY.................................................................................................................................................... 7-126
EXISTS................................................................................................................................................... 7-128
EXP ......................................................................................................................................................... 7-129
EVERSION ........................................................................................................................................... 7-130
EXTBYTES ............................................................................................................................................ 7-131
EXTCHARS .......................................................................................................................................... 7-132
EXTCOLS .............................................................................................................................................. 7-133
EXTLINES............................................................................................................................................. 7-135
EXTRACT.............................................................................................................................................. 7-136
FCOPEN ................................................................................................................................................ 7-138
FCQUERY.............................................................................................................................................. 7-139
FILEERROR.......................................................................................................................................... 7-144
FILEGET................................................................................................................................................ 7-147
FILENEXT ............................................................................................................................................. 7-149
FILEOPEN............................................................................................................................................. 7-151
FILEQUERY .......................................................................................................................................... 7-153
FILTERLINES....................................................................................................................................... 7-156
xii
FINDBYTES.......................................................................................................................................... 7-158
FINDCHARS........................................................................................................................................ 7-160
FINDLINES .......................................................................................................................................... 7-162
FINTSCHED......................................................................................................................................... 7-163
FLOOR................................................................................................................................................... 7-166
FPMTSCHED ....................................................................................................................................... 7-167
FROM_TZ ............................................................................................................................................. 7-170
GET ........................................................................................................................................................ 7-171
GREATEST ........................................................................................................................................... 7-175
GROUPINGID function .................................................................................................................... 7-176
GROWRATE......................................................................................................................................... 7-177
HIERCHECK ........................................................................................................................................ 7-179
HIERHEIGHT function ..................................................................................................................... 7-182
INFO ...................................................................................................................................................... 7-186
INFO (FORECAST) ....................................................................................................................... 7-187
INFO (MODEL) ............................................................................................................................. 7-190
INFO (PARSE) ............................................................................................................................... 7-197
INFO (REGRESS) .......................................................................................................................... 7-199
INITCAP ............................................................................................................................................... 7-201
INLIST................................................................................................................................................... 7-202
INSBYTES............................................................................................................................................. 7-203
INSCHARS ........................................................................................................................................... 7-204
INSCOLS .............................................................................................................................................. 7-205
INSLINES ............................................................................................................................................. 7-207
INSTAT.................................................................................................................................................. 7-208
INSTR functions.................................................................................................................................. 7-211
INTPART............................................................................................................................................... 7-213
IRR.......................................................................................................................................................... 7-214
ISDATE.................................................................................................................................................. 7-216
ISEMPTY............................................................................................................................................... 7-217
ISSESSION ........................................................................................................................................... 7-218
ISVALUE ............................................................................................................................................... 7-219
JOINBYTES .......................................................................................................................................... 7-220
JOINCHARS ........................................................................................................................................ 7-221
JOINCOLS ............................................................................................................................................ 7-223
JOINLINES........................................................................................................................................... 7-225
KEY......................................................................................................................................................... 7-226
xiii
LENGTH functions ............................................................................................................................... 8-19
LIMIT function ...................................................................................................................................... 8-20
LIMITMAPINFO................................................................................................................................... 8-24
LNNVL .................................................................................................................................................... 8-25
LOCALTIMESTAMP ............................................................................................................................ 8-26
LOG function ......................................................................................................................................... 8-27
LOG10...................................................................................................................................................... 8-28
LOWCASE .............................................................................................................................................. 8-29
LPAD........................................................................................................................................................ 8-30
LTRIM...................................................................................................................................................... 8-31
MAKEDATE ........................................................................................................................................... 8-32
MAX ......................................................................................................................................................... 8-34
MAXBYTES ............................................................................................................................................ 8-35
MAXCHARS .......................................................................................................................................... 8-36
MEDIAN ................................................................................................................................................. 8-37
MIN .......................................................................................................................................................... 8-39
MMOF ..................................................................................................................................................... 8-40
MODE...................................................................................................................................................... 8-41
MODULO ............................................................................................................................................... 8-43
MONTHS_BETWEEN.......................................................................................................................... 8-44
MOVINGAVERAGE ............................................................................................................................ 8-45
MOVINGMAX ...................................................................................................................................... 8-48
MOVINGMIN ....................................................................................................................................... 8-50
MOVINGTOTAL .................................................................................................................................. 8-52
NA2 .......................................................................................................................................................... 8-54
NAFILL.................................................................................................................................................... 8-55
NAFLAG ................................................................................................................................................. 8-56
NEW_TIME ............................................................................................................................................ 8-57
NEXT_DAY ............................................................................................................................................. 8-59
NLSSORT................................................................................................................................................ 8-60
NONE ...................................................................................................................................................... 8-61
NORMAL................................................................................................................................................ 8-63
NPV .......................................................................................................................................................... 8-64
NULLIF.................................................................................................................................................... 8-66
NUMBYTES............................................................................................................................................ 8-67
NUMCHARS.......................................................................................................................................... 8-68
NUMLINES ............................................................................................................................................ 8-69
NUMTODSINTERVAL ........................................................................................................................ 8-70
NUMTOYMINTERVAL ....................................................................................................................... 8-71
NVL .......................................................................................................................................................... 8-72
NVL2 ........................................................................................................................................................ 8-73
OBJ ........................................................................................................................................................... 8-74
OBJLIST .................................................................................................................................................. 8-88
OBSCURE ............................................................................................................................................... 8-90
PARTITION............................................................................................................................................ 8-92
PARTITIONCHECK ............................................................................................................................. 8-94
PERCENTAGE ....................................................................................................................................... 8-95
xiv
QUAL....................................................................................................................................................... 8-97
RANDOM............................................................................................................................................. 8-100
RANK .................................................................................................................................................... 8-101
RECNO .................................................................................................................................................. 8-106
REM........................................................................................................................................................ 8-107
REMAINDER....................................................................................................................................... 8-108
REMBYTES........................................................................................................................................... 8-109
REMCHARS ......................................................................................................................................... 8-110
REMCOLS ............................................................................................................................................ 8-111
REMLINES ........................................................................................................................................... 8-113
REPLBYTES.......................................................................................................................................... 8-114
REPLCHARS ........................................................................................................................................ 8-116
REPLCOLS............................................................................................................................................ 8-118
REPLLINES .......................................................................................................................................... 8-120
RESERVED ........................................................................................................................................... 8-121
ROUND ................................................................................................................................................. 8-123
ROUND (datetime) ....................................................................................................................... 8-124
ROUND (number)......................................................................................................................... 8-127
ROW function ...................................................................................................................................... 8-130
ROWIDTOCHAR................................................................................................................................ 8-132
ROWIDTONCHAR ............................................................................................................................ 8-133
RPAD ..................................................................................................................................................... 8-134
RTRIM ................................................................................................................................................... 8-135
RUNTOTAL.......................................................................................................................................... 8-136
SESSIONTIMEZONE ........................................................................................................................ 8-138
SIGN ...................................................................................................................................................... 8-139
SIN.......................................................................................................................................................... 8-140
SINH ...................................................................................................................................................... 8-141
SMALLEST........................................................................................................................................... 8-142
SMOOTH.............................................................................................................................................. 8-144
SORT function ..................................................................................................................................... 8-147
SORTLINES.......................................................................................................................................... 8-148
SQLFETCH ........................................................................................................................................... 8-149
SQRT...................................................................................................................................................... 8-150
STARTOF .............................................................................................................................................. 8-151
STATALL ............................................................................................................................................... 8-153
STATDEPTH......................................................................................................................................... 8-154
STATEQUAL ........................................................................................................................................ 8-155
STATFIRST ........................................................................................................................................... 8-156
STATLAST ............................................................................................................................................ 8-157
STATLEN .............................................................................................................................................. 8-158
STATLIST.............................................................................................................................................. 8-159
STATMAX ............................................................................................................................................. 8-161
STATMIN.............................................................................................................................................. 8-163
STATRANK .......................................................................................................................................... 8-165
STATVAL............................................................................................................................................... 8-168
STDDEV................................................................................................................................................ 8-171
xv
SUBSTR functions .............................................................................................................................. 8-173
SUBTOTAL........................................................................................................................................... 8-175
SYS_CONTEXT ................................................................................................................................... 8-177
SYSDATE .............................................................................................................................................. 8-178
SYSINFO............................................................................................................................................... 8-179
SYSTEM ................................................................................................................................................ 8-181
SYSTIMESTAMP ................................................................................................................................ 8-182
TALLY .................................................................................................................................................... 8-183
TAN ........................................................................................................................................................ 8-185
TANH..................................................................................................................................................... 8-186
TCONVERT.......................................................................................................................................... 8-187
TEXTFILL.............................................................................................................................................. 8-194
TO_CHAR............................................................................................................................................. 8-196
TO_DATE.............................................................................................................................................. 8-199
TO_DSINTERVAL .............................................................................................................................. 8-201
TO_NCHAR ......................................................................................................................................... 8-202
TO_NUMBER ...................................................................................................................................... 8-205
TO_TIMESTAMP ................................................................................................................................ 8-207
TO_TIMESTAMP_TZ......................................................................................................................... 8-209
TO_YMINTERVAL ............................................................................................................................. 8-210
TOD........................................................................................................................................................ 8-211
TODAY .................................................................................................................................................. 8-212
TOTAL ................................................................................................................................................... 8-213
TRANSLATE ........................................................................................................................................ 8-215
TRIGGER function ............................................................................................................................. 8-216
TRIM...................................................................................................................................................... 8-218
TRUNCATE .......................................................................................................................................... 8-219
TRUNCATE (datetime) ................................................................................................................ 8-220
TRUNCATE (number).................................................................................................................. 8-221
TZ_OFFSET .......................................................................................................................................... 8-222
UNIQUELINES.................................................................................................................................... 8-223
UNRAVEL ............................................................................................................................................. 8-224
UPCASE ................................................................................................................................................ 8-227
VALSPERPAGE ................................................................................................................................... 8-228
VALUES................................................................................................................................................. 8-229
VINTSCHED........................................................................................................................................ 8-232
VPMTSCHED ...................................................................................................................................... 8-235
WEEKOF ............................................................................................................................................... 8-238
WIDTH_BUCKET ........................................................................................................................... 8-239
WKSDATA............................................................................................................................................ 8-241
WRITABLE ........................................................................................................................................... 8-243
YYOF ...................................................................................................................................................... 8-244
xvi
ACQUIRE................................................................................................................................................... 9-9
ACROSS.................................................................................................................................................. 9-13
AGGMAP................................................................................................................................................ 9-14
AGGINDEX...................................................................................................................................... 9-32
BREAKOUT DIMENSION ............................................................................................................ 9-35
CACHE ............................................................................................................................................. 9-37
DIMENSION (for aggregation)..................................................................................................... 9-40
DROP DIMENSION ....................................................................................................................... 9-41
MEASUREDIM (for aggregation)................................................................................................. 9-43
MODEL (in an aggregation) .......................................................................................................... 9-44
PRECOMPUTE ................................................................................................................................ 9-45
RELATION (for aggregation)........................................................................................................ 9-46
AGGMAP ADD or REMOVE model ................................................................................................ 9-57
AGGMAP SET ....................................................................................................................................... 9-59
AGGREGATE command...................................................................................................................... 9-60
ALLCOMPILE........................................................................................................................................ 9-69
ALLOCATE............................................................................................................................................. 9-70
ALLOCMAP ........................................................................................................................................... 9-77
CHILDLOCK ................................................................................................................................... 9-82
DEADLOCK..................................................................................................................................... 9-83
DIMENSION (for allocation)......................................................................................................... 9-84
ERRORLOG ..................................................................................................................................... 9-85
ERRORMASK .................................................................................................................................. 9-86
MEASUREDIM (for allocation)..................................................................................................... 9-87
RELATION (for allocation)............................................................................................................ 9-88
SOURCEVAL ................................................................................................................................... 9-94
VALUESET....................................................................................................................................... 9-95
ALLSTAT................................................................................................................................................. 9-98
ARGUMENT .......................................................................................................................................... 9-99
AW command ....................................................................................................................................... 9-104
AW ALIASLIST ............................................................................................................................. 9-105
AW ATTACH ................................................................................................................................ 9-106
AW CREATE.................................................................................................................................. 9-114
AW DELETE .................................................................................................................................. 9-116
AW DETACH ................................................................................................................................ 9-117
AW FREEZE................................................................................................................................... 9-119
AW LIST ......................................................................................................................................... 9-120
AW PURGE CACHE .................................................................................................................... 9-122
AW ROLLBACK TO FREEZE ..................................................................................................... 9-123
AW SEGMENTSIZE ..................................................................................................................... 9-124
AW THAW..................................................................................................................................... 9-125
AW TRUNCATE ........................................................................................................................... 9-126
AWDESCRIBE ..................................................................................................................................... 9-127
BLANK .................................................................................................................................................. 9-129
BREAK................................................................................................................................................... 9-130
CALL ...................................................................................................................................................... 9-131
CDA........................................................................................................................................................ 9-135
xvii
CHGDFN .............................................................................................................................................. 9-136
CLEAR ................................................................................................................................................... 9-143
COMMIT .............................................................................................................................................. 9-146
COMPILE.............................................................................................................................................. 9-147
CONSIDER........................................................................................................................................... 9-151
CONTEXT command.......................................................................................................................... 9-152
CONTINUE .......................................................................................................................................... 9-154
COPYDFN............................................................................................................................................. 9-155
DATE_FORMAT.................................................................................................................................. 9-156
DBGOUTFILE...................................................................................................................................... 9-163
DEFINE.................................................................................................................................................. 9-166
DEFINE AGGMAP ....................................................................................................................... 9-168
DEFINE COMPOSITE .................................................................................................................. 9-171
DEFINE DIMENSION.................................................................................................................. 9-175
DEFINE DIMENSION (simple) ........................................................................................... 9-175
DEFINE DIMENSION (DWMQY) ...................................................................................... 9-178
DEFINE DIMENSION (conjoint)......................................................................................... 9-181
DEFINE DIMENSION CONCAT ........................................................................................ 9-184
DEFINE DIMENSION ALIASOF ........................................................................................ 9-186
DEFINE FORMULA ..................................................................................................................... 9-189
DEFINE MODEL........................................................................................................................... 9-191
DEFINE PARTITION TEMPLATE ............................................................................................. 9-193
DEFINE PROGRAM ..................................................................................................................... 9-195
DEFINE RELATION..................................................................................................................... 9-197
DEFINE SURROGATE ................................................................................................................. 9-199
DEFINE VALUESET..................................................................................................................... 9-202
DEFINE VARIABLE ..................................................................................................................... 9-205
DEFINE WORKSHEET ................................................................................................................ 9-224
DELETE ................................................................................................................................................. 9-226
DESCRIBE ............................................................................................................................................ 9-227
DO ... DOEND ..................................................................................................................................... 9-229
EDIT....................................................................................................................................................... 9-231
EQ ........................................................................................................................................................... 9-232
EXPORT................................................................................................................................................. 9-234
EXPORT (EIF) ................................................................................................................................ 9-235
EXPORT (spreadsheet) ................................................................................................................. 9-241
FCCLOSE .............................................................................................................................................. 9-243
FCEXEC ................................................................................................................................................. 9-244
FCSET .................................................................................................................................................... 9-248
FETCH ................................................................................................................................................... 9-254
FILECLOSE........................................................................................................................................... 9-257
FILECOPY............................................................................................................................................. 9-258
FILEDELETE ........................................................................................................................................ 9-259
FILEMOVE ........................................................................................................................................... 9-260
FILEPAGE ............................................................................................................................................. 9-261
FILEPUT ................................................................................................................................................ 9-263
FILEREAD ............................................................................................................................................ 9-265
xviii
FILESET................................................................................................................................................. 9-279
FILEVIEW ............................................................................................................................................. 9-282
FOR ........................................................................................................................................................ 9-290
FORECAST........................................................................................................................................... 9-293
FORECAST.REPORT.......................................................................................................................... 9-299
FULLDSC .............................................................................................................................................. 9-301
GOTO .................................................................................................................................................... 9-303
GROUPINGID command.................................................................................................................. 9-306
xix
MAINTAIN MOVE TO PARTITION.................................................................................. 10-96
MAINTAIN RENAME ................................................................................................................. 10-98
MODEL ................................................................................................................................................. 10-99
DIMENSION (in models)........................................................................................................... 10-104
INCLUDE ..................................................................................................................................... 10-108
MODEL.COMPRPT .......................................................................................................................... 10-111
MODEL.DEPRT................................................................................................................................. 10-112
MODEL.XEQRPT .............................................................................................................................. 10-113
MONITOR.......................................................................................................................................... 10-115
MOVE .................................................................................................................................................. 10-119
OUTFILE ............................................................................................................................................. 10-121
PAGE.................................................................................................................................................... 10-124
PARSE.................................................................................................................................................. 10-126
PERMIT............................................................................................................................................... 10-128
PERMITRESET .................................................................................................................................. 10-135
POP....................................................................................................................................................... 10-137
POPLEVEL.......................................................................................................................................... 10-138
PROGRAM ......................................................................................................................................... 10-139
PROPERTY ......................................................................................................................................... 10-142
PUSH.................................................................................................................................................... 10-144
PUSHLEVEL....................................................................................................................................... 10-146
RECAP ................................................................................................................................................. 10-150
REDO................................................................................................................................................... 10-152
REEDIT................................................................................................................................................ 10-154
REGRESS ............................................................................................................................................ 10-156
REGRESS.REPORT........................................................................................................................... 10-158
RELATION command ...................................................................................................................... 10-159
RELEASE............................................................................................................................................. 10-162
RENAME............................................................................................................................................. 10-165
REPORT .............................................................................................................................................. 10-167
RESYNC .............................................................................................................................................. 10-177
RETURN.............................................................................................................................................. 10-179
REVERT............................................................................................................................................... 10-181
ROW command.................................................................................................................................. 10-183
SET ....................................................................................................................................................... 10-191
SET1 ..................................................................................................................................................... 10-201
SHOW.................................................................................................................................................. 10-202
SIGNAL............................................................................................................................................... 10-204
SLEEP................................................................................................................................................... 10-206
SORT command................................................................................................................................. 10-207
SQL....................................................................................................................................................... 10-214
SQL CLEANUP ........................................................................................................................... 10-218
SQL CLOSE .................................................................................................................................. 10-219
SQL DECLARE CURSOR .......................................................................................................... 10-220
SQL EXECUTE............................................................................................................................. 10-225
SQL FETCH.................................................................................................................................. 10-226
SQL IMPORT ............................................................................................................................... 10-233
xx
SQL OPEN.................................................................................................................................... 10-238
SQL PREPARE............................................................................................................................. 10-239
SQL PROCEDURE ...................................................................................................................... 10-242
SQL SELECT ................................................................................................................................ 10-244
STATUS ............................................................................................................................................... 10-247
STDHDR............................................................................................................................................. 10-249
SWITCH command ........................................................................................................................... 10-251
TEMPSTAT ......................................................................................................................................... 10-254
TRACKPRG........................................................................................................................................ 10-256
TRAP.................................................................................................................................................... 10-260
TRIGGER command......................................................................................................................... 10-263
TRIGGERASSIGN............................................................................................................................ 10-274
UNHIDE.............................................................................................................................................. 10-278
UPDATE .............................................................................................................................................. 10-279
VARIABLE .......................................................................................................................................... 10-281
VNF ...................................................................................................................................................... 10-283
WHILE ................................................................................................................................................. 10-290
ZEROTOTAL...................................................................................................................................... 10-292
xxi
Using the Sparsity Advisor ................................................................................................................... B-4
Data Storage Options in Analytic Workspaces............................................................................. B-4
Selecting the Best Data Storage Method ........................................................................................ B-4
Using the Sparsity Advisor.............................................................................................................. B-5
Example: Evaluating Sparsity in the GLOBAL Schema .............................................................. B-5
Advice from Sample Program.................................................................................................. B-7
Information Stored in AW_SPARSITY_ADVICE Table....................................................... B-7
Using the Aggregate Advisor ................................................................................................................ B-7
Aggregation Facilities within the Workspace............................................................................... B-7
Example: Using the ADVISE_REL Procedure .............................................................................. B-8
Summary of DBMS_AW Subprograms ............................................................................................ B-12
ADD_DIMENSION_SOURCE Procedure ....................................................................................... B-14
ADVISE_CUBE Procedure .................................................................................................................. B-16
ADVISE_DIMENSIONALITY Function .......................................................................................... B-18
ADVISE_DIMENSIONALITY Procedure........................................................................................ B-20
ADVISE_PARTITIONING_DIMENSION Function ..................................................................... B-22
ADVISE_PARTITIONING_LEVEL Function.................................................................................. B-23
ADVISE_REL Procedure...................................................................................................................... B-24
ADVISE_SPARSITY Procedure.......................................................................................................... B-25
AW_ATTACH Procedure...................................................................................................................... B-28
AW_COPY Procedure ........................................................................................................................... B-30
AW_CREATE Procedure....................................................................................................................... B-31
AW_DELETE Procedure....................................................................................................................... B-32
AW_DETACH Procedure ..................................................................................................................... B-33
AW_RENAME Procedure .................................................................................................................... B-34
AW_TABLESPACE Function............................................................................................................... B-35
AW_UPDATE Procedure ...................................................................................................................... B-36
CONVERT Procedure ........................................................................................................................... B-37
EVAL_NUMBER Function................................................................................................................... B-38
EVAL_TEXT Function........................................................................................................................... B-39
EXECUTE Procedure............................................................................................................................. B-40
GETLOG Function ................................................................................................................................ B-42
INFILE Procedure.................................................................................................................................. B-43
INTERP Function .................................................................................................................................. B-44
INTERPCLOB Function ....................................................................................................................... B-45
INTERP_SILENT Procedure ............................................................................................................... B-46
OLAP_ON Function.............................................................................................................................. B-47
OLAP_RUNNING Function ............................................................................................................... B-48
PRINTLOG Procedure ......................................................................................................................... B-49
RUN Procedure ...................................................................................................................................... B-50
SHUTDOWN Procedure ...................................................................................................................... B-52
SPARSITY_ADVICE_TABLE Procedure .......................................................................................... B-53
STARTUP Procedure............................................................................................................................. B-54
C OLAP_API_SESSION_INIT
Initialization Parameters for the OLAP API ...................................................................................... C-1
Viewing the Configuration Table......................................................................................................... C-1
xxii
ALL_OLAP_ALTER_SESSION View............................................................................................. C-1
Summary of OLAP_API_SESSION_INIT Subprograms ................................................................ C-3
ADD_ALTER_SESSION Procedure ............................................................................................... C-4
CLEAN_ALTER_SESSION Procedure........................................................................................... C-5
DELETE_ALTER_SESSION Procedure ......................................................................................... C-6
Index
xxiii
xxiv
Preface
The Oracle OLAP DML Reference provides a complete description of the OLAP Data
Manipulation Language (OLAP DML) used to create analytic workspace definitions
that are stored within an analytic workspace and to manipulate these object.
Audience
Oracle OLAP DML Reference is intended for programmers and database administrators
who write OLAP DML programs and who create analytic workspaces and analytic
workspace objects using the OLAP DML.
Documentation Accessibility
Our goal is to make Oracle products, services, and supporting documentation
accessible, with good usability, to the disabled community. To that end, our
documentation includes features that make information available to users of assistive
technology. This documentation is available in HTML format, and contains markup to
facilitate access by the disabled community. Accessibility standards will continue to
evolve over time, and Oracle is actively engaged with other market-leading
technology vendors to address technical obstacles so that our documentation can be
accessible to all of our customers. For more information, visit the Oracle Accessibility
Program Web site at http://www.oracle.com/accessibility/.
xxv
Related Documents
For more information about working with Oracle OLAP, see these Oracle resources:
■ Oracle OLAP User's Guide
■ Oracle OLAP Java API Reference
■ Oracle OLAP Java API Developer's Guide
Conventions
The following text conventions are used in this reference:
Convention Meaning
boldface Boldface type indicates graphical user interface elements associated
with an action, or terms defined in text or the glossary.
italic Italic type indicates book titles, emphasis, or placeholder variables for
which you supply particular values.
monospace Monospace type indicates URLs, code in examples, text that appears on
the screen, or text that you enter.
This reference presents OLAP DML syntax in a simple variant of Backus-Naur Form
(BNF) that includes the following symbols and conventions.
xxvi
What's New in the OLAP DML?
This section identifies the new features of the Oracle Database 11g that relate to the
OLAP DML and lists the Oracle OLAP DML statements that were added, changed,
renamed, or deleted in Oracle9i and Oracle10g.
■ New Features in the OLAP DML
■ OLAP DML Statement Changes for Oracle11g
■ OLAP DML Statement Changes for Oracle10g
■ OLAP DML Statement Changes for Oracle9i
xxvii
■ A new GROUPINGID function
■ New ROLLUP and GROUPSET keywords in the GROUPINGID command
■ New $GID_DEPTH, $GID_LIST, and $GID_TYPE system properties
Aggregation Improvements
In Oracle11g, the following changes have been made to enhance aggregation:
■ Aggregation by partition. See AGGREGATE command for details
■ Clearing variables based on different aggmap objects. See the CLEAR command
for details.
■ Checking to see if there are any changes in an aggmap since the last time a
variable was aggregated using that aggmap. See the CHANGEDRELATIONS
function for details.
■ Checking to see any value in a variable has changed (or the number of values that
have changed) since the last time a variable was aggregated. See the
CHANGEDVALUES function for details.
■ Checking to see if a variable or one or more of its partitions has values. See the
ISEMPTY function for details.
■ Identifying the depth of a hierarchy. See the HIERDEPTH command for details.
xxviii
■ Datetime and interval data types.You can define dimensions and surrogates with
datetime data types. You can define variables, formulas, and programs with both
datetime and interval data types. For more information, see "Datetime and
Interval Data Types" on page 2-8, "Datetime and Interval Expressions" on
page 2-35, and the following OLAP DML statements:
■ RAW data type. For more information, see "RAW Data Type" on page 2-16.
■ Row identifier data types. more information, see "Row Identifier Data Types" on
page 2-16.:
The addition of these data types impacted the following OLAP DML statements:
CHARTOROWID function
CONVERT function
CURRENT_DATE function
CURRENT_TIMESTAMP function
DATE_FORMAT command
DBTIMEZONE function
DEFINE DIMENSION command
DEFINE VARIABLE command
EXTRACT function
FROM_TZ function
NUMTODSINTERVAL function
NUMTOYMINTERVAL function
LENGTH functions
LOCALTIMESTAMP function
ROUND (datetime) function
ROWIDTOCHAR function
ROWIDTONCHAR function
SESSIONTIMEZONE function
SYS_CONTEXT function
TO_DSINTERVAL function
TO_TIMESTAMP function
TO_TIMESTAMP_TZ function
TO_YMINTERVAL function
TRUNCATE (datetime) function
TZ_OFFSET function (11.0.0.0)
Additionally, the LOG function was modified so that it corresponds more exactly to its
SQL counterpart.
xxix
OLAP uses to insure that it optimally handles OLAP data cells which correspond to
relational null facts:
■ The DEFINE VARIABLE command now has a WITH NULLTRACKING phrase.
■ Two new functions, NA2 and NAFLAG, return values that Oracle OLAP uses to
identify how an OLAP data value corresponds to a relational fact.
■ The CHGDFN command now includes syntax that adds or removes NA2 bits from
a variable.
Typically, these OLAP DML statements are automatically generated during the
process of creating a materialized view using the Analytic Workspace Manager; you
will not explicitly write DML code that uses these new features. These changes are
documented in this manual so that you can understand the automatically-generated
DML statements.
xxx
$LOOP_VAR system property (11.0.0.0)
AW FREEZE command (11.0.0.0)
AW PURGE CACHE command (11.0.0.0)
AW THAW command (11.0.0.0)
BIN_TO_NUM function (11.0.0.0)
CHANGEDRELATIONS function (11.0.0.0)
CHANGEDVALUES function (11.0.0.0)
CHARTOROWID function (11.0.0.0)
CURRENT_DATE function (11.0.0.0)
CURRENT_TIMESTAMP function (11.0.0.0)
DATE_FORMAT command (11.0.0.0)
DBTIMEZONE function (11.0.0.0)
EXTRACT function (11.0.0.0)
FROM_TZ function (11.0.0.0)
GROUPINGID function (11.0.0.0)
HIERDEPTH command (11.0.0.0)
INSTR functions (11.0.0.0)
ISEMPTY function (11.0.0.0)
LENGTH functions (11.0.0.0)
LNNVL function (11.0.0.0)
LOCALTIMESTAMP function (11.0.0.0)
NLSSORT function (11.0.0.0)
MODULO function (11.0.0.0)
NA2 function (11.0.0.0)
NAFLAG function (11.0.0.0)
NUMTODSINTERVAL function
NUMTOYMINTERVAL function
PARTITION function (11.0.0.0)
REMAINDER function (11.0.0.0)
ROWIDTOCHAR function (11.0.0.0)
ROWIDTONCHAR function (11.0.0.0)
SESSIONTIMEZONE function (11.0.0.0)
SYS_CONTEXT function (11.0.0.0)
SYSTIMESTAMP function (11.0.0.0)
TO_DSINTERVAL function (11.0.0.0)
TO_TIMESTAMP function (11.0.0.0)
TO_TIMESTAMP_TZ function (11.0.0.0)
TO_YMINTERVAL function (11.0.0.0)
TZ_OFFSET function (11.0.0.0)
xxxi
CLEAR command (11.0.0.0)
CONVERT function (11.0.0.0)
DEFINE COMPOSITE (11.0.0.0)
DEFINE DIMENSION command (11.0.0.0)
DEFINE PARTITION TEMPLATE (11.0.0.0)
DEFINE VARIABLE command (11.0.0.0)
GROUPINGID command (11.0.0.0)
LOG function (11.0.0.0)
OBJ function (11.0.0.0)
xxxii
INF_STOP_ON_ERROR option (10.1.0.0)
INITCAP function (10.1.0.0)
INSTR functions (INSTR and INSTRB) (10.1.0.0)
LEAST function (10.1.0.0)
LPAD function (10.1.0.0)
LIMIT BASEDIMS command (10.2.0.0)
LOCK_LANGUAGE_DIMS option (10.2.0.0)
LTRIM function (10.1.0.0)
MAXFETCH option (10.1.0.0)
NULLIF function (10.1.0.0)
NVL function (10.1.0.0)
NVL2 function (10.1.0.0)
ONATTACH program (10.1.0.0)
PARTITIONCHECK function (10.1.0.0)
PRECOMPUTE statement in AGGMAP command (10.2.0.0)
RANK_CALLS option (10.2.0.0)
RANK_CELLS option (10.2.0.0)
RANK_SORTS option (10.2.0.0)
RELATION command (10.2.0.0)
RELEASE command (10.1.0.0)
RESYNC command (10.1.0.0)
REVERT command (10.1.0.0)
RPAD function (10.1.0.0)
RTRIM function (10.1.0.0)
SESSION_NLS_LANGUAGE option (10.2.0.0)
SET1 command (10.1.0.0)
SIGN function (10.1.0.0)
SORT function (10.2.0.0)
SQLFETCH function (10.2.0.0)
STATDEPTH function (10.2.0.0)
STATEQUAL function (10.2.0.2)
STATIC_SESSION_LANGUAGE option (10.2.0.0)
SUBSTR functions, SUBSTR and SUBTRB (10.1.0.0)
SUBSTR functions, SUBSTRC, SUBSTR2, and SUBSTR4 (10.2.0.4)
TRANSLATE function (10.2.0.4)
TRIGGER command (10.1.0.0)
TRIGGER function (10.1.0.0)
TRIGGER_DEFINE program (10.1.0.0)
TRIGGER_AFTER_UPDATE program (10.1.0.0)
TRIGGER_BEFORE_UPDATE program (10.1.0.0)
TRIGGERASSIGN command (10.1.0.0)
TRIM function (10.1.0.0)
USETRIGGERS option(10.1.0.0)
VALUESET statement in ALLOCMAP command (10.1.0.0)
WIDTH_BUCKET function (10.1.0.0)
WRAPERRORS option (10.2.0.0)
WRITABLE function (10.2.0.0)
xxxiii
Statements Changed in Oracle10g
The following OLAP DML statements were significantly changed in Oracle10g.
Examples of significant changes are the addition of a new keyword or a change in a
default value. The number in parentheses indicates the last release in which the
statement was significantly changed.
AGGMAPINFO (10.1.0.0)
AGGREGATE command (10.2.0.0)
AGGREGATE function (10.2.0.0)
ARGUMENT (10.1.0.0)
ANY (10.2.0.0)
AVERAGE (10.2.0.0)
AW function (10.2.0.0)
AW ATTACH (10.1.0.0)
CACHE (10.2.0.0)
CHGDFN (10.2.0.0)
CHGDIMS (10.1.0.3)
COUNT (10.2.0.0)
DEFINE COMPOSITE (10.1.0.0)
DEFINE VARIABLE (10.2.0.0)
DEPRDECL (10.2.0.0)
DEPRDECLSW (10.2.0.0)
DEPRSL (10.2.0.0)
DEPRSOYD (10.2.0.0)
EVERY (10.2.0.0)
FINTSCHED (10.2.0.0)
FPMTSCHED (10.2.0.0)
HIERCHECK (10.2.0.2)
LARGEST (10.2.0.0)
LIMIT command (10.2.0.0)
LIMIT function (10.2.0.0)
MAINTAIN ADD SESSION (10.1.0.0)
MAINTAIN ADD TO PARTITION (10.1.0.0)
NONE (10.2.0.0)
OBJ (10.2.0.3)
RANK (10.2.0.0)
RELATION (for aggregation) (10.2.0.0)
SMALLEST (10.2.0.0)
SORT command (10.1.0.3)
SQL (10.1.0.0)
STDDEV (10.2.0.0)
TALLY (10.2.0.0)
TOTAL (10.2.0.0)
UPDATE (10.1.0.0)
VARIABLE (10.1.0.0)
VALSPERPAGE (10.1.0.0)
VINTSCHED (10.2.0.0)
VPMTSCHED (10.2.0.0)
xxxiv
■ Statements Added in Oracle9i
■ Statements Deleted in Oracle9i
■ Statements Changed in Oracle9i
■ Statements Renamed in Oracle9i
xxxv
NLS_TERRITORY (9.0.0.0)
NULLIF (9.0.0.0)
POUTFILEUNIT (9.2.0.0)
REMBYTES (9.0.0.0)
REPLBYTES (9.0.0.0)
ROLE (9.0.0.0)
SOURCEVAL (9.2.0.0)
SYSDATE (9.0.0.0)
TO_CHAR (9.0.0.0)
TO_DATE (9.0.0.0)
TO_NCHAR (9.2.0.0)
TO_NUMBER (9.0.0.0)
TRACEFILEUNIT (9.2.0.0)
TRIM (9.0.0.0)
USERID (9.0.0.0)
xxxvi
IFCOPY (9.2.0.0)
LONGOBJNAMES (9.0.0.0)
MAXFETCH (9.0.0.0)
MKDIR (9.0.0.0)
NAPAGEFREE (9.2.0.0)
ODBC.CONNECTION (9.0.0.0)
ODBC.CONNLIST (9.0.0.0)
ODBC.DISCONN (9.0.0.0)
ODBC.SOURCE (9.0.0.0)
ODBC.SOURCELIST (9.0.0.0)
PGCACHEHITS (9.2.0.0)
PGCACHEMISSES (9.2.0.0)
PAGEPAUSE (9.2.0.0)
PAGEPROMPT (9.2.0.0)
PAUSE (9.2.0.0)
RETRIEVE (9.0.0.0)
RMDIR (9.0.0.0)
SESSIONQUERY (9.0.0.0)
SHARESESSION (9.0.0.0)
SHELL (9.0.0.0)
SQL CONNECT (9.0.0.0)
SQL DISCONNECT (9.0.0.0)
SQL.DMBS (9.0.0.0)
SQL.DMBSLIST (9.0.0.0)
STRIP (9.2.0.0)
THREADEXTCALL (9.0.0.0)
TRACE (9.2.0.0)
TRANSLATE (9.0.0.0)
TRANSPORT (9.0.0.0)
WATCH (9.2.0.0)
XABORT (9.0.0.0)
XCAPORTNUMBER (9.0.0.0)
XCLOSE (9.0.0.0)
XOPEN (9.0.0.0)
xxxvii
LAGDIF (9.2.0.2)
LAGPCT (9.2.0.2)
LEAD (9.2.0.2)
MODEL (9.2.0.2)
MOVINGAVERAGE (9.2.0.2)
MOVINGMAX (9.2.0.2)
MOVINGMIN (9.2.0.2)
MOVINGTOTAL (9.2.0.2)
NOSPELL (9.2.0.0)
OUTFILE (9.0.0.0)
PROGRAM (9.2.0.0)
PROPERTY (9.0.0.0)
RECURSIVE (9.0.0.0)
RELATION (for aggregation) (9.2.0.2)
RELATION (for allocation) (9.2.0.2)
ROUND (9.0.0.0)
SYSDATE (9.2.0.0)
SYSINFO (9.2.0.2)
SYSTEM (9.2.0.0)
TALLY (10.2.0.0)
THOUSANDSCHAR (9.2.0.0)
YESSPELL (9.2.0.0)
xxxviii
1
1 OLAP DML Basic Concepts
The built-in OLAP DML commands are documented as reference topics in Chapter 8,
Chapter 9, "OLAP DML Commands: A-G" and Chapter 10, "OLAP DML Commands:
H-Z".
An analytic workspace also contains the following types of objects and the OLAP
DML definitions for these objects:
■ Multidimensional data objects that contain the data that you want to analyze and
the results of the analysis.
■ Calculation objects (that is, formulas, models, aggregations, and allocations) that
contain OLAP DML statements that specify the analysis that you want.
■ OLAP DML programs that perform complex analysis.
See also: "About OLAP DML Data Objects" on page 1-6, Chapter 3,
"Formulas, Models, Aggregations, and Allocations" and Chapter 4,
"OLAP DML Programs"
■ When you are not the owner of the schema, you need SQL GRANT privileges to
create an analytic workspace, to attach an analytic workspace in ASOF mode, to
drop an analytic workspace, and to truncate an analytic workspace as shown in
the following table.
Note that Oracle Database does not turn on roles when you are running a named
PL/SQL procedure. In this case, the you must have the CREATE TABLE privilege
directly.
Table 1–1 (Cont.) Statements for Viewing Information About an Analytic Workspace
Statement Description
FULLDSC program Lists the complete definition of one or more workspace objects,
including the properties and triggers of the object(s).
Variables
The most important data object is the variable. A variable is an object that stores data.
All of the data in a variable must have the same data type. Typically, you use variables
to contain data values that quantify a particular aspect of your business For example,
your business might have several categories of transactions (measured in dollars,
units, percentages, and so on) and each category is stored in its own variable. For
example, you might record sales data in dollars (a sales variable) and units (a units
variable).
Since the OLAP DML is a multidimensional programming language, variables are
multidimensional and correspond to what other OLAP languages sometimes call
measures. Conceptually, you can think of a variable with two dimensions as a table, a
variable with three dimensions as a cube, and so on. Physically, variables are stored as
multidimensional arrays with the actual structure of the arrays determined by the
object by which the variable is dimensioned.
The scope and permanence of a variable can vary. A permanent variable is a variable
for which both the variable values and definitions are stored in an analytic workspace.
Temporary variables have values only during the current session. When you update
and commit the analytic workspace, only the definitions of temporary variables are
saved. When you exit from the analytic workspace, the data values are discarded. You
can also define variables in programs.
You can define scalar variables (and frequently do in programs), but most variables
that you define using the OLAP DML are dimensioned variables. Dimensioned
variables are arrays that hold more than one value. The indexes or dimensions of the
variable provide the organization for the variable. The values of the dimension are
similar to keys in a relational table; in that they uniquely identify a data value. For
example, if you have sales variable that is dimensioned by time, geography, and
product dimensions, then each combination of the values of time, geography, and
product identifies a value in sales. (Note that the indexes of variable s are not actually
the values of the dimension, but, instead, are the INTEGER positions of the values in
the dimension.)
Variables can be dimensioned by either flat or hierarchical dimensions. A flat
dimension exists when the values within a dimension are all at the same. level; no
value is the child or parent of another value. A hierarchical dimension exists when the
values with a single dimension are in a one-to-many (parent-to-child) relationship
with each other.
A hierarchical dimension is a means of organizing and structuring this type of data
within a single dimension. You can then use it to dimension a variable that contains
data for all the levels. Some dimensions have multiple hierarchies. You specify the
parent-to-child relationships of the dimension values by creating a self-relation.You
use a hierarchical dimension to define a variable that contains data of varying levels of
aggregation within a single variable. This type of storage affords a quicker response
time for users who want to view the data, particularly when the variable is large.
Frequently, the cells in the variable that correspond to upper level values in the
hierarchical dimension contain the sum or total of the values in the cells of the variable
that correspond to the lower level dimension values. For example, in a sales variable
that is defined with a hierarchical dimension representing time, the cells of the
variable for each quarter might represent the total sales for the months in the quarter.
After you have defined a variable with hierarchical dimensions, you can add variable
data to the lowest level of the hierarchy, and then calculate or aggregate the values for
the higher levels of the hierarchy. Conversely, you can distribute or allocate data from
higher levels to lower levels of the hierarchy.
Simple Dimensions
The members of a simple dimension are data values that all have the same data type.
When a variable is dimensioned by a simple dimension, there is one cell in the variable
for every member of the dimension. When there is a dimension member for which the
variable has no data, Oracle OLAP stores NA values in the variable for that empty
value. (Note that if storing these NA values would result in a full page of NA values
that Oracle OLAP does not actually store the values.) Oracle OLAP does not store NA
values when there is a range.)
Concat Dimensions
You define concat dimensions over previously-defined simple dimensions or conjoint
dimensions. Consequently, the base dimensions of a concat dimension can be of
different data types. You can represent a hierarchy with a concat dimension that is has
two or more simple flat dimensions among its base dimensions. You can use concat
dimensions to easily map dimensions in an analytic workspace to columns in
relational tables and thereby promote more efficient loading of data from the relational
structures into the analytic workspace structures.
Composites
You define composites over previously-defined dimensions or other composites.
Conceptually, you can think of a composite consisting of two structures:
■ The composite object itself. The composite contains the dimension-value
combinations (that is, a composite tuples) that Oracle OLAP uses to determine the
structure of any variables dimensioned by the composite.
■ An index between the composite values and its base dimension values.
For a variable that is dimensioned by composite, Oracle OLAP does not create a cell
for every value in the base dimensions as it would if the variable was dimensioned by
a simple dimension. Instead, it creates array elements (that is, variable cells) only for
those dimension values that are stored in the tuples of the composite; Data for the
variable is stored in order, cell by cell, for each tuple in the composite. From the
perspective of data storage, each combination of base dimension values in a composite
is treated like the value of a regular dimension. This means that when you define a
variable with one regular dimension and one composite, the data for the variable is
stored as though it was a two-dimensional variable. Using composites to reduce the
number of elements created for a variable results in more efficient data storage.
Partition Template
You define a partition template over previously-defined dimensions or composites. A
partition template is a specification for the partitions of a partitioned variable. A
partitioned variable is stored as multiple rows in the relational table of LOBs that is the
analytic workspace—each partition is a row in the table.
Alias Dimension
An alias dimension is merely an alias for a simple dimension. An alias dimension has
the same type and values as its base dimension. Typically, you define an alias
dimension when you want to dimension a variable by the same dimension twice.
Relations
A relation is an object that establishes a correspondence between the values of a given
dimension and the values of that same dimension or other dimensions in the analytic
workspace. Relations are dimensioned arrays. Each cell in a relation holds the index of
the value of a dimension. You can define relations between two or more dimensions,
multiple relations between a set of dimensions, or a dimension with itself (a
self-relation).
Most frequently, a relation is a self-relation for a hierarchical dimension. By creating a
relation between values in a dimension that participate in a one-to-many
(parent-to-child) relationship, you can organize your data by the child values and view
aggregates of data by the parent values. For example, you can create a geog.parent
relation for a geography dimension to define the relationships between the city and
state values in geography. In this way you can organize the data by city and view the
aggregates of data by state.
Valueset Objects
A valueset is a list of dimension values for one or more previously-defined
dimensions. You use a valueset to save dimension status lists across sessions.
Surrogates
A dimension surrogate is an alternative set of values for a previously-defined
dimension. You cannot dimension a variable by a surrogate, but you can use a
surrogate rather than a dimension in a model, in a LIMIT command, in a qualified
data reference, or in data loading with statements such as FILEREAD, FILEVIEW, SQL
FETCH, and SQL IMPORT.
REPORT geog
GEOG
--------------
Boston
Springfield
Hartford
Mansfield
Montreal
Walla Walla
Portland
Oakland
San Diego
MA
CT
WA
CA
Quebec
East
West
All Regions
USA
Canada
All Country
Typically, after you define a hierarchical dimension, you define the following objects
for that dimension:
■ hierlist dimension that lists the names of the hierarchies for the dimension. See
"Hierlist Dimension" on page 1-11 for more information and an example.
■ parentrel relation that defines the hierarchies. A dimension is only a hierarchical
dimension when it has a parentrel defined for it. See "Parentrel Relation" on
page 1-11 for more information and an example.
■ levellist relation that lists the names of all of the levels of all of the hierarchies. See
"Levellist Dimension" on page 1-12 for more information and an example.
■ hierlevels valueset that is the values of the levels of each hierarchy. See "Hierlevels
Valueset" on page 1-13 for more information and an example.
■ inhier valueset or variable that identifies the values of each hierarchy. See "Inhier
Valueset or Variable" on page 1-13 for more information and examples.
■ levelrel relation that relates each value of the hierarchical dimension to its level in
the hierarchy. See "Levelrel Relation" on page 1-15 for more information and an
example.
■ familyrel relation that is each hierarchical dimension value and its related values.
See "Familyrel Relation" on page 1-17 for more information and an example.
■ gidrel relation that is the grouping ids of each value within each hierarchy. See
"Gidrel Relation" on page 1-18 for more information and an example.
Hierlist Dimension
A hierlist dimension is a TEXT dimension in the analytic workspace that has as values
the names of the hierarchies of a hierarchical dimension. For example, if the company
has a different calendar and fiscal year, the time dimension for that company would
have two hierarchies: one for calendar and another for year. The hierlist dimension
that supported that time hierarchy would have two values: Calendar and Fiscal.
For consistency's sake, analytic workspaces include a hierlist dimension for every
hierarchical dimension -- even when that hierarchical dimension has only one
hierarchy.
Example 1–2, "Defining and Populating a hierlist Dimension Named geog_hierlist" on
page 1-11 illustrates defining and populating this type of dimension.
GEOG_HIERLIST
--------------
Political_Geog
Sales_Geog
Parentrel Relation
A parentrel relation is a relation between the hierarchical dimension and itself (a
self-relation) and the hierlist dimension. It identifies the parent of each dimension
member within a hierarchy.
Example 1–3, "Defining and Populating a parentrel Relation named geog_parentrel" on
page 1-11 illustrates defining and populating this type of relation.
Levellist Dimension
A levellist dimension is a TEXT dimension that has as values the names all of the
levels of the hierarchies of a hierarchical dimension.
Example 1–4, "Defining and Populating a levellist Dimension Named geog_levellist"
on page 1-12 illustrates defining and populating this type of dimension.
"Populate the geog_levellist dimension with the names of the levels of both the
"Political_Geog and Sales_Geog hierarchies
MAINTAIN geog_levellist ADD 'All Country' 'Country' 'All Regions' 'Region'
MAINTAIN geog_levellist ADD 'State-Prov' 'City'
"Display the values of the geog_levellist dimension
REPORT geog_levellist
GEOG_LEVELLIST
--------------
All Country
Country
All Regions
Region
State-Prov
City
Hierlevels Valueset
A hierlevels valueset is those values of the hierlevels dimension (typically ordered
from bottom to top) that are included in each hierarchy of the hierarchical dimension.
Example 1–5, "Defining and Populating a hierlevels Valueset named geog_hierlevels"
on page 1-13 illustrates defining and populating this type of valueset.
GEOG_HIERLIST GEOG_HIERLEVELS
-------------- ----------------------
Political_Geog City
State-Prov
Country
All Country
Sales_Geog City
State-Prov
Region
All Regions
REPORT W 20 geog_inhier
GEOG_HIERLIST GEOG_INHIER
-------------- --------------------
Political_Geog Boston
Springfield
Hartford
Mansfield
Montreal
Walla Walla
Portland
Oakland
San Diego
MA
CT
WA
CA
Quebec
USA
Canada
All Country
Sales_Geog Boston
Springfield
Hartford
Mansfield
Montreal
Walla Walla
Portland
Oakland
San Diego
MA
CT
WA
CA
Quebec
East
West
All Regions
geog_inhiervar = TRUE
LIMIT geog_hierlist TO ALL
LIMIT geog_hierlist TO 'Sales_Geog'
LIMIT geog TO ALL
LIMIT geog TO 'Canada' 'USA' 'All Country'
geog_inhiervar = FALSE
LIMIT geog COMPLEMENT
geog_inhiervar = TRUE
LIMIT geog TO ALL
LIMIT geog_hierlist TO ALL
---GEOG_INHIERVAR----
----GEOG_HIERLIST----
Political_
GEOG Geog Sales_Geog
-------------- ---------- ----------
Boston yes yes
Springfield yes yes
Hartford yes yes
Mansfield yes yes
Montreal yes yes
Walla Walla yes yes
Portland yes yes
Oakland yes yes
San Diego yes yes
MA yes yes
CT yes yes
WA yes yes
CA yes yes
Quebec yes yes
East no yes
West no yes
All Regions no yes
USA yes no
Canada yes no
All Country yes no
Levelrel Relation
A levelrel relation is a relation between the levellist and hierlist dimensions that
records the level for each member of the hierarchical dimension
Example 1–8, "Defining and Populating a levelrel Relation named geog_levelrel" on
page 1-15 illustrates defining and populating this type of relation.
--------------GEOG_LEVELREL--------------
--------------GEOG_HIERLIST--------------
GEOG Political_Geog Sales_Geog
-------------- -------------------- --------------------
Boston City City
Springfield City City
Hartford City City
Mansfield City City
Montreal City City
Walla Walla City City
Portland City City
Oakland City City
San Diego City City
MA State-Prov State-Prov
CT State-Prov State-Prov
WA State-Prov State-Prov
CA State-Prov State-Prov
Quebec State-Prov State-Prov
East NA Region
West NA Region
All Regions NA All Regions
USA Country NA
Canada Country NA
All Country All Country NA
Familyrel Relation
The familyrel relation is a relation between the hierarchical dimension and the levellist
and hierlist dimensions that provides the full parentage of each dimension member in
the hierarchy.
Example 1–9, "Defining and Populating a familyrel Relation named geog_familyrel" on
page 1-17 illustrates defining and populating this type of relation.
GEOG_HIERLIST: Political_Geog
-------------------------------GEOG_FAMILYREL--------------------------------
-------------------------------GEOG_LEVELLIST--------------------------------
GEOG All Country Country All Regions Region State-Prov City
-------------- ------------ ------------ ------------ ------------ ------------ ------------
Boston All Country USA NA NA MA Boston
Springfield All Country USA NA NA MA Springfield
Hartford All Country USA NA NA CT Hartford
Mansfield All Country USA NA NA CT Mansfield
Montreal All Country Canada NA NA Quebec Montreal
Walla Walla All Country USA NA NA WA Walla Walla
Portland All Country USA NA NA WA Portland
Oakland All Country USA NA NA CA Oakland
San Diego All Country USA NA NA CA San Diego
MA All Country USA NA NA MA NA
CT All Country USA NA NA CT NA
WA All Country USA NA NA WA NA
CA All Country USA NA NA CA NA
Quebec All Canada NA NA Quebec NA
Countries
East NA NA NA NA NA NA
West NA NA NA NA NA NA
All Regions NA NA NA NA NA NA
USA All Country USA NA NA NA NA
Canada All Country Canada NA NA NA NA
All Country All Country NA NA NA NA NA
GEOG_HIERLIST: Sales_Geog
-------------------------------GEOG_FAMILYREL--------------------------------
-------------------------------GEOG_LEVELLIST--------------------------------
GEOG All Country Country All Regions Region State-Prov City
-------------- ------------ ------------ ------------ ------------ ------------ ------------
Boston NA NA All Regions East MA Boston
Springfield NA NA All Regions East MA Springfield
Hartford NA NA All Regions East CT Hartford
Mansfield NA NA All Regions East CT Mansfield
Montreal NA NA All Regions East Quebec Montreal
Walla Walla NA NA All Regions West WA Walla Walla
Gidrel Relation
A gidrel relation is a relation between a NUMBER dimension, the hierarchical
dimension, and the hierlist dimension that contains the grouping ID of each dimension
member in each hierarchy of the hierarchical dimension. It also has a $GID_DEPTH
property that identifies the depth within a hierarchy of each dimension member.
Example 1–10, "Defining and Populating a gidrel Relation named geog_gidrel" on
page 1-18 illustrates defining and populating this type of relation.
---------------GEOG_GIDREL---------------
--------------GEOG_HIERLIST--------------
GEOG Political_Geog Sales_Geog
-------------- -------------------- --------------------
Boston 0 0
Springfield 0 0
Hartford 0 0
Mansfield 0 0
Montreal 0 0
Walla Walla 0 0
Portland 0 0
Oakland 0 0
San Diego 0 0
MA 1 1
CT 1 1
WA 1 1
CA 1 1
Quebec 1 1
East NA 3
West NA 3
All Regions NA 7
USA 3 NA
Canada 3 NA
All Country 7 NA
PRODID QUANTITY
-------------- ----------
PROD01 3.00
PROD02 3.00
PROD03 3.00
Other OLAP DML statements (for example, REPORT, ROW, and FOR) also loop
through all of the in status elements of a dimensioned object when they execute.
How to Specify the Set of Data that OLAP DML Operations Work Against
Oracle OLAP keeps track of the values of a dimension that are accessible to the user
using lists, called "status lists", for each defined dimension.
Which OLAP DML Data Objects Can Have Which Data Type?
Different objects support the use of different data types for their values:
■ For variables, all of the data types are supported.
For data entry, a value for any of these data types can begin with a plus (+) or minus
(-) sign; it cannot contain commas. Note, however, that a comma is required before a
negative number that follows another numeric expression, or the minus sign is
interpreted as a subtraction operator. Additionally, a decimal value can contain a
decimal point. For data display, thousands and decimal markers are controlled by the
NLS_NUMERIC_CHARACTERS option.
high degree of precision. When deciding whether to assign the NUMBER data type to a
variable, keep the following facts in mind in order to maximize performance:
■ Analytic workspace calculations on NUMBER variables is slower than other
numerical data types because NUMBER values are calculated in software (for
accuracy) rather than in hardware (for speed).
■ When data is fetched from an analytic workspace to a relational column that has
the NUMBER data type, performance is best when the data already has the NUMBER
data type in the analytic workspace because a conversion step is not required.
Text Literals
Enclose text literals in single quotes. Oracle OLAP recognizes unquoted alpha-numeric
values as object names and double quotes as the beginning of a comment.
You can embed quoted strings within a quoted string, which is necessary when you
want to specify the base dimension value of a composite or conjoint dimension or
when a value includes an apostrophe. Since a single quotation mark is used in Oracle
OLAP to indicate a text string, it is considered a special character when used within
such a string. Consequently, to specify the literal value of a single quotation mark
within a text string, precede the quotation mark with a backslash.
For example, suppose you want to find out if New York and Apple Sauce are a valid
combination of base dimension values in the markprod conjoint dimension. The
following statement produces the answer YES or NO.
SHOW ISVALUE(markprod, '<\'New York\' \'Apple Sauce\'>')
When embedded quoted strings have a further level of embedding, you must use
backslashes before each special character, such as the apostrophe and the backslash
that must precede it in "Joe's Deli," as shown in the following statement.
SHOW ISVALUE(markprod, '<\'Joe\\\'s Deli\' \'Apple Sauce\'>')
Escape Sequences
Table 2–4, " Recognized Escape Sequences" shows escape sequences that are
recognized by Oracle OLAP.
Tip: The Oracle OLAP DML data type that corresponds to the SQL
DATE data type is named DATETIME. See DATETIME Data Type on
page 2-11 for more information.
Numeric style
Specify the day, month, and year as three INTEGER values with one or more
separators between them, using these rules:
■ The day and month components can have one digit or two digits.
■ For any year, the year component can have four digits (for example, 1997). For
years in the range 1950 to 2049, the year component can, alternatively, have two
digits (50 represents 1950, and so on).
■ To separate the components, you can use a space, dash (-), slash (/), colon (:), or
comma (,).
Examples: '24/4/97' or '24-04-1997'
DATE-only values have independent input and output formats. You can enter
DATE-only values in one style and report them in a different style.
Table 2–6 OLAP DML Datetime and Interval Data Types and the Corresponding SQL
Data Types
OLAP DML Data Type Corresponding SQL Data Type
DATETIME DATE
TIMESTAMP TIMESTAMP
TIMESTAMP_TZ TIMESTAMP WITH TIMEZONE
TIMESTAMP_LTZ TIMESTAMP WITH LOCAL TIME ZONE
DSINTERVAL INTERVAL DAY TO SECOND
YMINTERVAL INTERVAL YEAR TO MONTH
In the OLAP DML, the datetime data types are DATETIME, TIMESTAMP, TIMESTAMP_
TZ, and TIMESTAMP_LTZ. The interval data types are YMINTERVAL and DSINTERVAL.
Both datetimes and intervals are made up of fields as discussed in "Datetime and
Interval Fields" on page 2-9.
Note: The Oracle OLAP DML has a date data type named DATE that
does not correspond to the SQL data type of that name. (The OLAP
DML DATE data type was implement before the SQL datetime and
interval data types were implemented in the OLAP DML.) The OLAP
DML DATE data type stores only date values (no time values) and is
therefore sometimes referred to as the DATE-only data type.
Note: The Oracle OLAP DML has a date data type named DATE that
does not correspond to the SQL data type of that name. The OLAP
DML DATE data type stores only date values (no time values) and is
therefore sometimes referred to as the DATE-only data type. The
DATEORDER, DATEFORMAT, and MONTHNAMES options, which
control the formatting of DATE values, have no effect on DATETIME
values. However, DATETIME and DATE values can be used
interchangeably in most DML statements.
You can specify a DATETIME value as a string literal, or you can convert a character or
numeric value to a date value with the TO_DATE function.
To specify a DATETIME value as a literal, you must use the Gregorian calendar. You
can specify an ANSI literal, as shown in this example:
DATETIME '1998-12-25'
The ANSI date literal contains no time portion, and must be specified in exactly this
format ('YYYY-MM-DD').
Alternatively you can specify a DATETIME value us the TO_DATE function and
include, as in the following example:
TO_DATE('98-DEC-25 17:30','YY-MON-DD HH24:MI')
The default date format template for an Oracle DATETIME value is specified by the
initialization parameter NLS_DATE_FORMAT. This example date format includes a
two-digit number for the day of the month, an abbreviation of the month name, the
last two digits of the year, and a 24-hour time designation.
Oracle automatically converts character values that are in the default datetime format
into datetime values when they are used in datetime expressions.
If you specify a datetime value without a time component, then the default time is
midnight (00:00:00 or 12:00:00 for 24-hour and 12-hour clock time, respectively). If you
specify a datetime value without a date, then the default date is the first day of the
current month.
Values of DATETIME always contain both the date and time fields. Therefore, if you
use DATETIME values in an expression, you must either specify the time field in your
query or ensure that the time fields in the DATETIME values are set to midnight.
Otherwise, Oracle may not return the results you expect. You can use the TRUNC (date)
function to set the time field to midnight, or you can include a greater-than or
less-than condition in the query instead of an equality or inequality condition.
However, if the expression contains DATETIME values other than midnight, then you
must filter out the time fields in the query to get the correct result.
The date function SYSDATE returns the current system date and time. The function
CURRENT_DATE returns the current session date. For information on SYSDATE, the
TO_* datetime functions, and the default date format, see "Datetime functions" on
page 7-9 and the DATE_FORMAT command.
Two TIMESTAMP_TZ values are considered identical if they represent the same
instant in UTC, regardless of the TIME ZONE offsets stored in the data. For example,
TIMESTAMP '1999-04-15 8:00:00 -8:00'
is the same as
TIMESTAMP '1999-04-15 11:00:00 -5:00'
That is, 8:00 a.m. Pacific Standard Time is the same as 11:00 a.m. Eastern Standard
Time.
You can replace the UTC offset with the TZR (time zone region) format element. For
example, the following example has the same value as the preceding example:
TIMESTAMP '1999-04-15 8:00:00 US/Pacific'
To eliminate the ambiguity of boundary cases when the daylight saving time switches,
use both the TZR and a corresponding TZD format element. The following example
ensures that the preceding example will return a daylight saving time value:
TIMESTAMP '1999-10-29 01:30:00 US/Pacific PDT'
You can also express the time zone offset using a datetime expression.
If you do not add the TZD format element, and the datetime value is ambiguous, then
Oracle returns an error if you have the ERROR_ON_OVERLAP_TIME session parameter
set to TRUE. If that parameter is set to FALSE, then Oracle interprets the ambiguous
datetime as standard time in the specified region.
Notice that if the value specified does not include a time component (either explicitly
or implicitly, then the value returned defaults to midnight.
where
■ 'integer [-integer]' specifies integer values for the leading and optional
trailing field of the literal. If the leading field is YEAR and the trailing field is
MONTH, then the range of integer values for the month field is 0 to 11.
■ precision is the maximum number of digits in the leading field. The valid range
of the leading field precision is 0 to 9 and its default value is 2.
If you specify a trailing field, it must be less significant than the leading field. For
example, INTERVAL '0-1' MONTH TO YEAR is not valid.
The following YMINTERVAL literal indicates an interval of 123 years, 2 months:
INTERVAL '123-2' YEAR(3) TO MONTH
Examples of the other forms of the literal follow, including some abbreviated versions:
You can add or subtract one INTERVAL YEAR TO MONTH literal to or from another to
yield another INTERVAL YEAR TO MONTH literal. For example:
INTERVAL '5-3' YEAR TO MONTH + INTERVAL'20' MONTH =
INTERVAL '6-11' YEAR TO MONTH
You can add or subtract one DAY TO SECOND interval literal from another DAY TO
SECOND literal. For example.
INTERVAL'20' DAY - INTERVAL'240' HOUR = INTERVAL'10-0' DAY TO SECOND
Note: Although you can create relational tables and clusters that
contain actual columns having the ROWID data type. Oracle Database
does not guarantee that the values of such columns are valid rowids
The extended ROWID data type stored in a user column includes the data in the
restricted rowid plus a data object number. The data object number is an identification
number assigned to every database segment. You can retrieve the data object number
from the data dictionary views USER_OBJECTS, DBA_OBJECTS, and ALL_OBJECTS.
Objects that share the same segment (clustered tables in the same cluster, for example)
have the same object number.
Extended rowids are stored as base 64 values that can contain the characters A-Z, a-z,
0-9, and the plus sign (+) and forward slash (/). Extended rowids are not available
directly. You can use a supplied package, DBMS_ROWID, to interpret extended rowid
contents. The package functions extract and provide information that would be
available directly from a restricted rowid as well as information specific to extended
rowids.
See also: For more information on the ROWID data type and
pseudocolumns, see the discussions of those topics in Oracle Database
SQL Language Reference.
See also: For more information on the UROWID data type, see the
discussions of that data type in Oracle Database SQL Language
Reference.
than 127 or less than -128. However, when you try to assign the result to a
SHORTINTEGER variable or a 1-byte INTEGER variable respectively, then the variable
is set to NA.
Oracle OLAP automatically converts numeric data types according to the following
rules:
■ When you use a value with the SHORTINTEGER or SHORTDECIMAL data type in
an expression, then the value is converted to its long counterpart before using it.
See "Boolean Expressions" on page 2-38 for information about problems that can
occur when you mix SHORTDECIMAL and DECIMAL data types in a comparison
expression.
■ When you save the results of a calculation as a value with the SHORTINTEGER
data type, then NA is stored when the result is outside the range of a
SHORTINTEGER (-32768 to 32767).
■ When you assign the value of a DECIMAL expression to an object with the
INTEGER data type, then the value is rounded before storing or using it.
■ When you use a decimal value where a value with the INTEGER data type is
required, then the value is rounded before storing or using it.
■ When you assign the value of a decimal expression to a variable with the
SHORTDECIMAL data type, then only the first 7 significant digits are stored.
■ When you combine NUMBER values with other numeric data types, then all values
are converted to NUMBER.
When these conversion are not what you want, then you can use the CONVERT, TO_
CHAR, TO_NCHAR, TO_NUMBER, or TO_DATE functions to get different results.
Arithmetic Operators
Table 2–10, " Arithmetic Operators" shows the OLAP DML arithmetic operators, their
operations, and priority where priority is the order in which that operator is evaluated.
Operators of the same priority are evaluated from left to right. When you use two or
more operators in a numeric expression, the expression is evaluated according to
standard rules of arithmetic. You must code a comma before a negative number that
follows another numeric expression, or the minus sign is interpreted as a subtraction
operator. For example, intvar,-4
Assignment Operator
In the OLAP DML, as in many other programming languages, the = (equal) sign is
used as an assignment operator.
An expression creates temporary data; you can display the resulting values, but these
values are not automatically stored in your analytic workspace for future reference
during a session. You use an assignment statement to store the result of an expression
in an object that has the same data type and dimensions as the expression. If you
update and commit the object, then the values are available to you in future sessions.
Like other programming languages, an assignment statement in the OLAP DML sets
the value of the target expression equal to the results of the source expression.
However, an OLAP DML assignment statement does not work exactly as it does in
other programming languages. Like many other OLAP DML statements it does not
assign a value to a single cell, instead, when the target-expression is a
multidimensional object, Oracle OLAP loops through the cells of the target object
setting each one to the results of the source-expression. Additionally, you can use
UNRAVEL to copy the values of an expression into the cells of a target object when
the dimensions of the expression are not the same as the dimensions of the target
object.
For more information on using assignment statements in the OLAP DML, see SET and
SET1.
product, and district (even though the dimensions of the price variable are
month and product only).
■ Qualified data references (QDRs) are dimensioned by all of the dimensions of the
associated object, except for the dimensions being qualified. (For more information
about qualified data references, see "Limiting a Dimension to a Single Value
Without Changing Status" on page 2-28.)
■ The return values of most OLAP DML functions are, in most cases, dimensioned
by the union of the dimensions of the input arguments. However, some functions
(such as aggregation functions) have fewer dimensions than the input arguments.
In these cases, the dimensionality of the return value is documented in the topic
for the function in Chapter 7, "OLAP DML Functions: A - K".
Determining the Dimensions of an Expression You can find out the dimensions of an
expression by issuing a PARSE statement, followed by the INFO function. PARSE
evaluates the text of an expression; the INFO indicates how the expression is
interpreted.
This example illustrates the use of the DIMENSION keyword with the INFO function
to retrieve the dimensions of the expression just analyzed by PARSE. Assume that you
issue the following statement.
PARSE 'TOTAL(sales region)'
How Dimension Status Affects the Number of Values in the Results of Expressions The number
of values an expression yields depends on the dimensions of the expression and the
status of those dimensions. An expression yields one data value for each combination
of dimension values in the current status. For example, when three dimension values
are in status for month, and two for product, then the expression price GT 100
results in six values (3 times 2).
Thus, to get the desired results, you must ensure that the dimensions of an expression
are limited to the range of data you want to consider. In addition, you must consider
any PERMIT statements that might limit access to the dimensions of the data.
When you want to specify a single value without changing the current status you can
use a qualified data reference (QDR). Using a QDR, you can qualify a dimension
(which enables you to specify one dimension value in an expression) or one or more
dimensions of a variable or relation. For more information on dimension status, see
"How to Specify the Set of Data that OLAP DML Operations Work Against" on
page 1-20; for more information on QDRs, see "Limiting a Dimension to a Single Value
Without Changing Status" on page 2-28.
schema-name
The name of the schema in which the analytic workspace was defined when it was
created. By default, an analytic workspace is created in the schema for the database
user ID of the user issuing the AW CREATE statement. In almost any DML statement,
you can specify the full name of an analytic workspace (for example, Scott.demo).
analytic-workspace-name
The name of the workspace that contains the desired object. By specify the analytic
workspace name along with the object name you create a qualified object name
(QON) for the object. Using a qualified object name for an object is recommended
except in those situations described in "When Not to Use Qualified Object Names" on
page 2-26.
You can specify the value for analytic-workspace-name in any of the following ways:
■ The name of an analytic workspace. A workspace name is assigned when an
analytic workspace is created with an AW CREATE statement.
■ The alias name of an analytic workspace. An analytic workspace alias is an
alternative name for an attached analytic workspace. You can assign or delete an
alias with an AW ALIAS LIST statement. An alias is in effect from the time it is
assigned to the time that the workspace is detached (or until the alias is deleted).
Therefore, each time you attach an unattached workspace, you must reassign its
aliases.
One reason for assigning an alias is to have a short way to reference an analytic
workspace that belongs to a schema that is not yours. For example, you can use
the alias in qualified object names and statements that reference such an analytic
workspace. Another reason for assigning an alias is to write generic code that
includes a reference to an analytic workspace but does not hard-code its name.
With the alias providing a generic reference, you can assign the alias and run the
code on different workspaces at different times.
object-name
The name of the object unless the object is an unnamed composite. When the object is
an unnamed composite, use the following syntax.
SPARSE <basedims....>
For the basedims argument, specify the names of the dimensions, separated by spaces,
for which the unnamed composite was created. For an example of using an unnamed
composite in an OLAP DML statement, see Example 10–104, "Reporting Data
Dimensioned by Composites" on page 10-175.
Objects with the same name in different workspaces are treated as completely separate
objects, and no similarity or relationship is assumed to exist between them. Any OLAP
DML language restrictions that apply between objects in different workspaces apply
even when the objects have the same name. For example, you cannot dimension an
object in one workspace by a dimension that resides in another workspace, even when
both workspaces have dimensions with the same name.
Considerations When Creating and Using Qualified Object Names Although the use of
qualified object names for objects is typical, there are a number of considerations to
keep in mind:
■ There are some situations where you cannot use a qualified object name or do not
need to use a qualified object name. See "When Not to Use Qualified Object
Names" on page 2-26 for more information
■ Before you use ampersand substitution when creating a qualified object name you
need to understand how and when the substitution occurs. See "Using Ampersand
Substitution for Workspace and Object Names" on page 2-26 for more information.
■ Special considerations apply when passing a qualified object name as an argument
to a program. See "Passing Qualified Object Names to Programs" on page 2-26 for
more information.
Note, however, that when you use a TEXT dimension value in a numeric expression or
compare values in a non-numeric dimension, Oracle OLAP uses the INTEGER position
number of the value in the array (as based on the default status list) rather than the
value itself.
Specifying a Value of a Composite You can specify a value of a composite in the following
ways:
■ By specifying a set of values of the base dimensions of the composite using the
following syntax.
{composite_name | SPARSE} {<base_dimension_name base_dimension_value }, ...>
■ (Named composites only) By specifying just the values of the composite using the
following syntax.
composite_name <base_dimension_value ...>
where base_dimension_value is a set of values of the base dimensions, in the order in
which they were defined in the composite, separated by spaces.
Specifying a Value of a CONCAT Dimension Once you have defined a unique CONCAT
dimension, you can refer to its values simply by specifying the values of the base
dimensions.
However, you must specify a value of a nonunique CONCAT dimension as a
concatenation of the name of the base dimension and the base dimension value
separated by a colon (:) and a space and enclosed in angle brackets(<>). In an
expression, use the following format.
<BASE_DIMENSION_NAME: base_dimension value>
For example, assume that you have defined the base dimensions named city and
state and, a CONCAT dimension for them named geog. When you report on the
geog dimension, the values of geog include the names of the base dimensions along
with the values.
DEFINE city DIMENSION TEXT
DEFINE state DIMENSION TEXT
DEFINE geog DIMENSION CONCAT(city state)
MAINTAIN city ADD 'New York'
MAINTAIN state ADD 'New York'
REPORT geog
GEOG
-----------------------------------
<CITY: New York>
<STATE: New York>
Using Related Dimensions in Expressions The syntax of some OLAP DML statements (for
example, some variations of the LIMIT command) include two dimension arguments
referred to as a dimension, and a related dimension. Other OLAP DML statements (for
example, AVERAGE, ANY, COUNT, CUMSUM, NONE, LARGEST, SMALLEST, and
TOTAL) allow you to specify the dimensionality of the result in terms of a related
dimension. In these contexts, the related dimension is any dimension that shares a
relation with another dimension.
Even though the value that you specify for the arguments in these statements is the
name of a dimension, in actuality Oracle OLAP uses a relation between the dimensions
to perform its calculations. When the two dimensions share only one relation, the
behavior is clear. Oracle OLAP performs the calculation based on the values in that
relation.
However, when two dimensions share more than one relation, then the behavior is
less clear. In some cases, as with a LIMIT using LEVELREL command, you can specify
the shared relation you want Oracle OLAP to use. In other cases, the statement syntax
does not allow you to specify the name of a relation. In this case, Oracle OLAP chooses
among the multiple relations as described in "How Oracle OLAP Chooses Between
Multiple Relations" on page 10-159.
MARKET: EAST
------------COUPONS-------------
-------------MONTH--------------
PRODUCT Jan02 Feb02 Mar02
-------------- ---------- ---------- ----------
Sportswear 1,000 1,000 NA
However, for performance reasons, you can change the default looping behavior for
statements such as REPORT, ROW, and the assignment statement (SET) so that they
loop over the values in the composite rather than all of the base dimension values.
Syntax of a Qualified Data Reference You specify a qualified data reference using the
following syntax
expression(dimname1 dimexp1 [, dimname2 dimexp2. . .])
The dimname argument is the name of one of the dimensions, or a dimension surrogate
of the dimension, of the expression and the dimexp argument is one of the following:
■ A value of dimname.
Qualifying a Variable You can qualify any or all of a dimensions of a variable using either
of the following techniques:
■ The QDR can temporarily limit a dimension of the variable by selecting one
specified value of the dimension. This value can be outside the current status.
■ The QDR can replace a dimension of the variable with a less aggregate related
dimension when you supply the name of an appropriate relation as the qualifier.
The dimension is temporarily replaced by the dimension(s) of the relation.
For example, the variable sales has three dimensions, month, product, and
district. You might want to compare total sales in Boston to the total sales in all
cities. In a single statement, you want district to be limited to two different values:
■ For the numerator of the expression, you want the status of district to be
Boston.
■ For the denominator of the expression, you want the status of district to be
ALL.
The following statement lets you calculate this result by using a QDR.
SHOW sales(district 'Boston')/TOTAL(sales)
You can qualify more than one of the dimensions of a variable. For example, when you
qualify all the dimensions of the sales variable by specifying one dimension value of
each dimension, then you narrow sales down to a single–cell value.
To fetch sales for Jun02, Tents, and Seattle, use the following QDR.
SHOW sales(month 'Jun02', product 'Tents', district 'Seattle')
You can use a qualified data reference with the target expression of an assignment
(SET) statement. This lets you assign a value to a specific cell in a data object.
The following example assigns the value 10200 to the data cell of the sales composite
that is specified in the qualified data reference. When the composite named sales
does not already have a value for the combination Boston and Tents, then this value
combination is added to the composite, thus adding the data cell.
sales(market 'Boston' product 'Tents' month 'Jan99')= 10200
Replacing a Dimension in a Variable When you use a relation as the qualifier in the QDR,
you replace a dimension of the variable with the dimension or dimensions of the
relation. The relation must be related to the dimension that you are qualifying, and it
must be dimensioned by the replacement dimension.
-------------------DIVISION.MGR----------------------
----------------------MONTH--------------------------
DIVISION JAn02 Feb02 Mar02 Apr02 May02 Jun02
-------- -------- -------- -------- -------- -------- --------
Camping Hawley Hawley Jones Jones Jones Jones
Sporting Carey Carey Carey Carey Carey Musgrave
Clothing Musgrave Musgrave Musgrave Musgrave Musgrave Wong
Suppose you want to obtain a report that shows the fraction by which sales have
exceeded quota and you want to include the appropriate division manager for each
product. You can show the division manager for each product by using the relation
division.product, which is related to division and dimensioned by product, as
the qualifier. The QDR replaces the division dimension with product, so that it has
the same dimensions as the other expression in the report sales / quota. The
following statement produces the report following it.
REPORT DOWN month sales W 6 sales/quota W 8 HEADING -
'MANAGER' division.mgr(division division.product)
DISTRICT: BOSTON
-----------------------------PRODUCT------------------------------------
----TEnts---- ---canoes---- --racquets--- --sportswear-- ---footwear---
Sales/ Sales/ Sales/ Sales/ Sales/
Month Quota Manager Quota Manager Quota Manager Quota Manager Quota Manager
------ ----- ------- ----- ------- ----- ------- ----- -------- ----- --------
Jan02 1.00 Hawley 0.82 Hawley 1.02 Carey 0.91 Musgrave 0.92 Musgrave
Feb02 0.84 Hawley 0.96 Hawley 1.00 Carey 0.80 Musgrave 1.07 Musgrave
Mar02 0.87 Jones 0.95 Jones 0.87 Carey 0.88 Musgrave 0.91 Musgrave
Apr02 0.91 Jones 0.93 Jones 0.99 Carey 0.94 Musgrave 0.95 Musgrave
...
Qualifying a Relation You can also use a QDR to qualify a relation (which is really a
special kind of variable).
Suppose the region.district relation is dimensioned by district. When you
qualify district with the value Seattle, then the value of the expression is the
value of the relation for Seattle. Because the QDR specifies one value of district,
the expression has a single–cell result.
The definition of region.district is as follows.
DEFINE region.district RELATION region <district>
LD The region for each district
Qualifying a Dimension You can use a QDR to qualify the dimension itself, which enables
you to specify one dimension value in an expression. The following expression
specifies one value of district, the one contained in the single-cell variable
mydistrict.
district(district mydistrict)
For a concat dimension, you can use a QDR to qualify the dimension by specifying a
value from one of the base dimensions of the concat dimension. The following
expression specifies one value of reg.dist.ccdim, a concat dimension that has
region and district as its base dimensions. The costs variable is dimensioned by
the division and reg.dist.ccdim dimensions.
SHOW reg.dist.ccdim(district 'Boston')
Using Ampersand Substitution with QDRs An ampersand character (&) at the beginning of
an expression substitutes the value of the expression for the expression itself in a
statement.When you use an ampersand with a QDR, you must enclose the whole
expression in parentheses when you want the variable to be qualified before the
substitution is made.
Suppose you have a text variable named myvar that is dimensioned by reptype and
that contains the names of variables. Remember that it is myvar that is dimensioned
by reptype, not the variables named by myvar. Therefore, you must use parentheses
so that myvar is qualified and the resulting value is used in a REPORT statement.
REPORT &(myvar(reptype 'actual'))
When you do not use parentheses and the variable that is specified in myvar is sales,
then you get an error message that sales is not dimensioned by reptype.
Specifying a Value of NA
There are cases in which you might specify an operation for which no data is available.
For example, there might be no appropriate value for a given cell in a variable, for the
return value of a function, or for the value of an expression that includes an arithmetic
operator. In these cases, an NA (Not Available) value is automatically supplied.
To set the values of a variable or relation to NA, you can use an assignment statement
(SET), as shown in the following example.
sales = NA
Numeric Expressions
A numeric expression evaluates to any of the numeric data types. The data in a
numeric expression can be any combination of the following:
■ Numeric literals as discussed in "Numeric Data Types" on page 2-4.
■ Numeric variables or formulas
■ Dimensions
■ Functions that yield numeric results
■ Date literals, variables, formulas, or functions
In addition, you can join any of these expressions with the arithmetic operators for a
more complex numeric expression. You use arithmetic operators in numeric
expressions with numeric data, which returns a numeric result. You can also use some
arithmetic operators in date expressions with a mix of date and numeric data, to
retrieve either a date or numeric result.
A number of options determine how Oracle OLAP handles numeric expressions.
■ When all the data in the expression is INTEGER or SHORTINTEGER, and the only
operations are addition, subtraction, and multiplication, then the result is
INTEGER.
■ When any of the data is NUMBER, then the result is NUMBER.
■ When any of the data is DECIMAL or SHORTDECIMAL, and no data is NUMBER, then
the result is DECIMAL.
■ When you perform any division or exponentiation operations, then the result is
DECIMAL.
When you want to suppress the divide-by-zero error, then you can change the
value of the DIVIDEBYZERO option to YES. This means that the result of any
division by zero is NA and no error occurs. This allows the calculation of the other
values of a dimensioned expression to continue.
■ Root of negative numbers. It is normally an error to try to take the root of a
negative number (which includes raising a number to a non-integer power). When
you want to suppress the error message and allow the calculation of roots for
non-negative values of the expression to continue, then set the
ROOTOFNEGATIVE option to YES.
■ Overflow errors. The DECIMALOVERFLOW option works in a similar manner to
DIVIDEBYZERO. It lets you control whether an error is generated when a
calculation produces a decimal result larger than it can handle.
Text Expressions
A text expression evaluates to data with the TEXT, NTEXT, or ID data type. Text
expressions can be any combination of the following:
■ Text literals. For example, 'Boston' or 'Current Sales Report'
■ Text dimensions. For example, district or month
■ Text variables or formulas. For example, product.name
■ Functions that yield text results. For example, JOINLINES('Product: '
product.name)
Datetime Expressions
A datetime expression yields a value of one of the datetime data types. A datetime
expression has the following syntax.
datetime_value_expr AT LOCAL |
TIME ZONE { ' [ + | - ] hh:mm' | DBTIMEZONE | 'time_zone_name' | expr }
A datetime_value_expr can be a datetime value or a compound expression that
yields a datetime value. Datetimes and intervals can be combined according to the
rules defined in Table 2–7, " Datetime Fields and Values" on page 2-9. The three
combinations that yield datetime values are valid in a datetime expression.
If you specify AT LOCAL, Oracle uses the current session time zone.
The settings for AT TIME ZONE are interpreted as follows:
■ The string '(+|-)HH:MM' specifies a time zone as an offset from UTC.
■ DBTIMEZONE: Oracle uses the database time zone established (explicitly or by
default) during Database creation.
■ SESSIONTIMEZONE: Oracle uses the session time zone established by default or in
the most recent ALTER SESSION statement.
■ time_zone_name: Oracle returns the datetime_value_expr in the time zone
indicated by time_zone_name. For a listing of valid time zone names, query the
V$TIMEZONE_NAMES dynamic performance view.
■ expr: If expr returns a character string with a valid time zone format, Oracle
returns the input in that time zone. Otherwise, Oracle returns an error.
Interval Expressions
An interval expression yields a value of DSNTERVAL or MYINTERVAL where the
expression has the following syntax.
interval_value_expr DAY [(leading_field_precision)] TO
SECOND [(fractional_second_precision)]| YEAR [(leading_field_precision)] TO MONTH
Datetime/Interval Arithmetic
You can perform a number of arithmetic operations on date (DATETIME), timestamp
(TIMESTAMP, TIMESTAMP_TZ, and TIMESTAMP_LTZ) and interval (DSINTERVAL and
YMINTERVAL) data. Oracle calculates the results based on the following rules:
■ You can use NUMBER constants in arithmetic operations on date and timestamp
values, but not interval values. Oracle internally converts timestamp values to
date values and interprets NUMBER constants in arithmetic datetime and interval
expressions as numbers of days. For example, SYSDATE + 1 is tomorrow.
SYSDATE - 7 is one week ago. SYSDATE + (10/1440) is ten minutes from now.
Subtracting the hire_date column of the sample table employees from
SYSDATE returns the number of days since each employee was hired. You cannot
multiply or divide date or timestamp values.
■ Oracle implicitly converts BINARY_FLOAT and BINARY_DOUBLE operands to
NUMBER.
■ Each DATETIME value contains a time component, and the result of many date
operations include a fraction. This fraction means a portion of one day. For
example, 1.5 days is 36 hours. These fractions are also returned by Oracle built-in
functions for common operations on DATETIME data. For example, the MONTHS_
BETWEEN function returns the number of months between two dates. The
fractional portion of the result represents that portion of a 31-day month.
■ If one operand is a DATETIME value or a numeric value (neither of which contains
time zone or fractional seconds components), then:
– Oracle implicitly converts the other operand to DATETIME data. (The
exception is multiplication of a numeric value times an interval, which returns
an interval.)
– If the other operand has a time zone value, then Oracle uses the session time
zone in the returned value.
– If the other operand has a fractional seconds value, then the fractional seconds
value is lost.
■ When you pass a timestamp, interval, or numeric value to a built-in function that
was designed only for the DATETIME data type, Oracle implicitly converts the
non-DATETIME value to a DATETIME value.
■ When interval calculations return a datetime value, the result must be an actual
datetime value or the Database returns an error.
Examples You can add an interval value expression to a start time. Consider the
sample table oe.orders with a column order_date.
Date-only Expressions
A date-only expression is an expression that evaluates to the OLAP DML DATE data
type as discussed in "Date-only Data Type" on page 2-6. The expression might be a
function that returns a date-only value, a date-only literal, or a more complex
expression.
Boolean Expressions
A Boolean expression is a logical statement that is either TRUE or FALSE. Boolean
expressions can compare data of any type as long as both parts of the expression have
the same basic data type. You can test data to see if it is equal to, greater than, or less
than other data.
A Boolean expression can consist of Boolean data, such as the following:
■ BOOLEAN values (YES and NO, and their synonyms, ON and OFF, and TRUE and
FALSE)
■ BOOLEAN variables or formulas
■ Functions that yield BOOLEAN results
■ BOOLEAN values calculated by comparison operators
For example, assume that your code contains the following Boolean expression.
actual GT 20000
When processing this expression, Oracle OLAP compares each value of the variable
actual to the constant 20,000. When the value is greater than 20,000, then the
statement is TRUE; when the value is less than or equal to 20,000, then the statement is
FALSE.
When you are supplying a Boolean value, you can type either YES, ON, or TRUE for a
true value, and NO, OFF, or FALSE for a false value. When the result of a Boolean
calculation is produced, the defaults are YES and NO in the language specified by the
NLS_LANGUAGE option. The read-only YESSPELL and NOSPELL options record the
YES and NO values.
Table 2–11, " Comparison and Logical Operators" on page 2-20 shows the comparison
and logical operators. Each operator has a priority that determines its order of
evaluation. Operators of equal priority are evaluated left to right, unless parentheses
change the order of evaluation. However, the evaluation is halted when the truth
value is already decided. For example, in the following expression, the TOTAL
function is never executed because the first phrase determines that the whole
expression is true.
yes EQ yes OR TOTAL(sales) GT 20000
In the next expression, both parts are complete so the expression is valid.
sales GT 50000 AND sales LE 20000
When you combine several Boolean expressions, the whole expression must be valid
even when the truth value can be determined by the first part of the expression. The
whole expression is compiled before it is evaluated, so when there are undefined
variables in the second part of a Boolean expression, you get an error.
Use the NOT operator, with parentheses around the expression, to reverse the sense of
a Boolean expression.
The following two expressions are equivalent.
district NE 'BOSTON'
NOT(district EQ 'BOSTON')
Table 2–15 Boolean Expressions with NA Values that Result in non-NA Values
Expressions Result
NA EQ NA YES
NA NE NA NO
NA EQ non-NA NO
NA NE non-NA YES
NA AND NO NO
NA OR YES YES
You can use the ABS or the ROUND function to ignore these slight differences when
making comparisons.
Controlling Errors When Comparing Floating Point Numbers A standard restriction on the
use of floating point numbers in a computer language is that you cannot expect exact
equality in a comparison of two floating point numbers when either number is the
result of an arithmetic operation. For example, on some systems, the following
statement returns a NO instead of the expected YES.
SHOW .1 + .2 EQ .3
When you deal with decimal data, you should not code direct comparisons. Instead,
you can use the ABS or the ROUND function to allow a tolerance for approximate
equality. For example, either of the following two statements produce the desired YES.
SHOW ABS((.1 + .2) - .3) LT .00001
SHOW ROUND(.1 + .2) EQ ROUND(.3, .00001)
Controlling Errors When Comparing Different Numeric Data Types You cannot expect exact
equality between SHORTDECIMAL and DECIMAL or NUMBER representations of a
decimal number with a fractional component, because the DECIMAL and NUMBER data
types have more significant digits to approximate fractional components that cannot
be represented exactly.
Suppose you define a variable with a SHORTDECIMAL data type and set it to a
fractional decimal number, then compare the SHORTDECIMAL number to the fractional
decimal number, as shown here.
DEFINE sdvar SHORTDECIMAL
sdvar = 1.3
SHOW sdvar EQ 1.3
The comparison is likely to return NO. What happens in this situation is that the literal
is automatically typed as DECIMAL and converts the SHORTDECIMAL variable sdvar
to DECIMAL, which extends the decimal places with zeros. A bit-by-bit comparison is
then performed, which fails. The same comparison using a variable with a DECIMAL or
a NUMBER data type is likely to return YES.
There are several ways to avoid this type of comparison failure:
■ Do not mix the SHORTDECIMAL with DECIMAL or NUMBER types in comparisons.
To avoid mixing these two data types, you should generally avoid defining
variables with decimal components as SHORTDECIMAL.
■ Use the ABS or ROUND function to allow for approximate equality. The following
statements both produce YES.
SHOW ABS(sdvar - 1.3) LT .00001
SHOW ROUND(sdvar, .00001) EQ ROUND(.3, .00001)
-------------- ----------------------
Boston YES
Atlanta YES
Chicago YES
Dallas YES
Denver YES
Seattle NO
A more complex example assigns increasing values to the variable quota based on
initial values assigned to the first six months. The comparison depends on the position
of the values in the month dimension. Because it is a time dimension, the values are in
chronological order.
quota = IF month LE 'Jun02' THEN 100 ELSE LAG(quota, 1, month)* 1.15
However, when you compare values from different dimensions, such as in the
expression region lt district, then the only common denominator is TEXT, and
text values are compared, not dimension positions.
Comparing Dates
You can compare two dates with any of the Boolean comparison operators. For dates,
"less" means before and "greater" means after. The expressions being compared can
include any of the date calculations discussed in Table 2–11, " Comparison and Logical
Operators" on page 2-20. For example, in a billing application, you can determine
whether today is 60 or more days after the billing date in order to send out a more
strongly worded bill.
bill.date + 60 LE SYSDATE
Dates also have a numeric value. You can use the TO_NUMBER and TO_DATE
functions to change a value from a DATE to an INTEGER or an INTEGER to a DATE for
comparison.
You can compare TEXT and ID values, but they can only be equal when they are the
same length. When you test whether a text value is greater or less than another, the
ordering is based on the setting of the NLS_SORT option.
You can compare numbers with text by first converting the number to text. Ordering is
based on the values of the characters. This can produce unexpected results because the
text is evaluated from left to right. For example, the text literal 1234 is greater than
100,999.00 because 2, the second character in the first text literal, is greater than 0,
the second character in the second text literal.
Suppose name.label is an ID variable whose value is 3-Person and name.desc is
a TEXT variable whose value is 3-Person Tents.
The result of the following SHOW statement is NO.
SHOW name.desc EQ name.label
name.desc = '3-Person'
SHOW name.desc EQ name.label
Comparing a Text Value to a Text Pattern The Boolean operator LIKE is designed for
comparing a text value to a text pattern. A text value is like another text value or
pattern when corresponding characters match.
Besides literal matching, LIKE lets you use wildcard characters to match more than
one character in a string:
■ An underscore (_) character in a pattern matches any single character.
■ A percent (%) character in a pattern matches zero or more characters in the first
string.
For example, a pattern of %AT_ matches any text that contains zero or more characters,
followed by the characters AT, followed by any other single character. Both DATA and
ERRATA return YES when LIKE is used to compare them with the pattern %AT_.
The results of expressions using the LIKE operator are affected by the settings of the
LIKECASE and LIKENL options.
No negation operator exists for LIKE. To accomplish negation, you must negate the
entire expression. For example, the result of the following statement is NO.
SHOW NOT ('Boston' LIKE 'Bo%')
Comparing Text Literals to Relations You can also compare a text literal to a relation. A
relation contains values of the related dimension and the text literal is compared to a
value of that dimension. For example, region.district holds values of region, so
you can do the following comparison.
region.district EQ 'West'
Conditional Expressions
A conditional expression is an expression you can use to select between values based
on a condition. You can use conditional expression as part of any other expression as
long as the data type is appropriate. Oracle OLAP supports the use of the following
conditional expressions:
■ IF...THEN...ELSE expression
■ SWITCH Expressions
IF...THEN...ELSE expression
An IF expression is an expression you can use to select one of two values based on a
Boolean condition.
In most cases, expression1 and expression2 must be of the same basic data type
(numeric, text, or Boolean) and the data type of the whole expression is determined
using the same rules as those for the binary operators. However, when the data type of
either expression1 or expression2 is DATE, it is possible for the other expression to have
a numeric or text data type. Because Oracle OLAP expects both data types to be DATE,
it will convert the numeric or text value to a DATE. Also, when the value of one
expression is a dimension value then the value of the other expression is converted to
a dimension value as it is for QDRs.
You can nest IF expressions; however, in this case, you might want to use a SWITCH
expression instead as discussed in "SWITCH Expressions" on page 2-44.
An IF expression is processed by first evaluating the Boolean expression; then:
■ When the result of the Boolean expression is TRUE, then expression1 is evaluated
and returns that value.
■ When the result of the Boolean expression is FALSE, then expression2 is evaluated
and returns that value.
The expression1 and expression2 arguments are any valid OLAP DML
expressions that evaluate to the same basic data type. However, when the data type of
either value is DATE, it is possible for the other value to have a numeric or text data
type. Because both data types are expected to be DATE, Oracle OLAP converts the
numeric or text value to a DATE. The data type of the whole expression is the same as
the two expressions. When the result of the Boolean expression is NA, then NA is
returned.
PRODUCT: TENTS
---IF SALES-SALES.PLAN LT 0 THEN 0 ELSE .05*(SALES-SALES.PLAN)---
----------------------MONTH------------------------------
DISTRICT Jan02 Feb02 Mar02 Apr02 May02 Jun02
--------- -------- -------- -------- ------- --------- ----------
Boston 229.53 0.00 0.00 0.00 584.51 749.13
Atlanta 0.00 0.00 0.00 190.34 837.62 1,154.87
Chicago 0.00 0.00 0.00 84.06 504.95 786.81
...
SWITCH Expressions
A SWITCH expression consists of a series of CASE expressions. You can use a
SWITCH expression as an alternative to a complicated, nested IF ... THEN ... ELSE
expression when all the conditions are equality comparisons with a single value.
You could, instead, code the same behavior using a SWITCH expression as shown
below.
testprogram = SWITCH testtype DO -
CASE 0: 'program0', -
CASE 1: 'program1', -
CASE 2: -
CASE 3: 'program2', -
DEFAULT: NA -
DOEND
You could also code the same behavior using a SWITCH statement that spans fewer
lines, omits commas, and omits the DEFAULT case since NA is the default return value
when a match is not found.
testprogram = SWITCH testtype DO CASE 0: 'program0' CASE 1: 'program1' -
CASE 2: CASE 3: 'program2' DOEND
Substitution Expressions
To construct a substitution expression, use an ampersand character (&) at the
beginning of an expression. Using an ampersand (that is, the substitution operator)
this way is also called ampersand substitution. The ampersand specifies that Oracle
OLAP should evaluate an expression containing a substitution expression as follows:
1. Evaluate the expression following the ampersand (the substitution expression).
2. Evaluate the rest of the expression using the result of step 1 (that is, the result of
the substitution expression).
Ampersand substitution gives you a level of indirection when you are specifying an
expression. For example, when you specify an ampersand followed by a variable that
holds the name of another variable, the value of the expression becomes the data in the
second variable. Ampersand substitution lets you write more general programs that
can operate on data that is chosen when the program is run. Note, however, that,
Oracle OLAP does not compile program lines with ampersand substitution; instead
these lines are interpreted when the program runs. To avoid ampersand substitution
in a program, you can often use an IF or SWITCH command instead.
You cannot use ampersand substitution in model equations.
CURNAME
----------
PRODUCT
However, when you execute the following statement, then REPORT produces the
values of the dimension product.
REPORT &curname
PRODUCT
--------------
Tents
Canoes
Racquets
Sportswear
Footwear
When you do not use parentheses and the variable that is specified in myvar is sales,
then you get an error message that sales is not dimensioned by reptype.
Calculation objects are OLAP DML objects that contain OLAP DML statements that
specify analysis that you want performed. Calculation objects include: formulas,
models, aggregation specifications, allocation specifications, and programs.
This chapter contains information on the following
■ Creating Calculation Objects
■ OLAP DML Formulas
■ OLAP DML Model Objects
■ OLAP DML Aggregation Objects
■ OLAP DML Allocation Objects
For information on creating OLAP DML programs, see Chapter 4, "OLAP DML
Programs".
Table 3–1 outlines the OLAP DML statements that you use to create each type of
calculation specification.
Creating Models
To create an OLAP DML model, take the following steps:
1. Issue a DEFINE MODEL command to define the program object.
2. Issue a MODEL command which adds a specification to the model to specify the
processing that you want performed.
3. Compile the model as described in "Compiling Models" on page 3-6.
4. (Optional) If necessary, change the settings of model options listed in "Model
Options" on page 6-5.
5. Execute the model as described in "Running a Model" on page 3-10.
6. Debug the model as described in "Debugging a Model" on page 3-12.
7. When you want the model to be a permanent part of the analytic workspace, save
the model using an UPDATE command followed by COMMIT.
For an example of creating a model, see Example 10–58, "Creating a Model" on
page 10-101.
Nesting Models
You can include one model within another model by using an INCLUDE statement
within a MODEL command. The MODEL command that contains the INCLUDE
statement is referred to as the parent model. The included model is referred to as the
base model. You can nest models by placing an INCLUDE statement in a base model.
For example, model myModel1 can include model myModel2, and model myModel2
can include model myModel3. The nested models form a hierarchy. In this example,
myModel1 is at the top of the hierarchy, and myModel3 is at the root.
When a model contains an INCLUDE statement, then it cannot contain any
DIMENSION statements. A parent model inherits its dimensions, if any, from the
DIMENSION statements in the root model of the included hierarchy. In the example
just given, models myModel1 and myModel2 both inherit their dimensions from the
DIMENSION statements in model myModel3.
The INCLUDE statement enables you to create modular models. When certain
equations are common to several models, then you can place these equations in a
separate model and include that model in other models as needed.
The INCLUDE statement also facilitates what-if analyses. An experimental model can
draw equations from a base model and selectively replace them with new equations.
To support what-if analysis, you can use equations in a model to mask previous
equations. The previous equations can come from the same model or from included
models. A masked equation is not executed or shown in the MODEL.COMPRPT
report for a model
If you specify actual as the solution variable when you run the model, then the
following code is constructed and executed.
PUSH line
LIMIT line TO gross.margin
actual = actual(line revenue) - actual(line cogs)
POP line
The relation between detail.line and line is used automatically to aggregate the
detail data into the appropriate line items. The code that is constructed when the
model is run ensures that the appropriate total is assigned to each value of the line
dimension. For example, while the equation for the revenue item is calculated, line
is temporarily limited to revenue, and the TOTAL function returns the total of detail
items for the revenue value of line.
When the month dimension is limited to Apr2004 to Jun2004 when you run the
model, then you must be sure that the solution variable contains revenue data for
Mar96.
When your model contains a LEAD function, then your solution variable must contain
the necessary future data. For example, when you want to calculate data for the
months of April through June of 2004, and when the model retrieves data from one
month in the future, then the solution variable must contain data for July 2004 when
you run the model.
To avoid obtaining NA for the results, you can make sure that the solution variable
does not contain NA values or you can set NASKIP2 to YES before running the model.
Compiling Models
When you finish writing the statements in a model, you can use the COMPILE
command to compile the model. During compilation, COMPILE checks for format
errors, so you can use COMPILE to help debug your code before running a model.
When you do not use COMPILE before you run the model, then the model is compiled
automatically before it is solved.You can use the OBJ function with the ISCOMPILED
choice to test whether a model is compiled.
SHOW OBJ(ISCOMPILED 'myModel')
When you compile a model, either by using a COMPILE statement or by running the
model, the model compiler checks for problems that are unique to models. You receive
an error message when any of the following occurs:
■ The model contains any statements other than DIMENSION, INCLUDE, and
assignment (SET) statements.
that control simultaneous solutions before you run the model. "Model Options" on
page 6-5 lists these options.
An example of a cyclic dependence that does not depend on any dimensional
qualifiers can be illustrated as A>B>C>A. The arrows indicate that A depends on B,
B depends on C, and C depends on A.
An example of a cyclic dependence that is a two-way dimensional dependence can
be illustrated as A>LEAD(B)>LAG(A). The arrows indicate that A depends on the
value of B from a future period, while B depends on the value of A from a previous
period.
Running a Model
When you run a model, you should keep these points in mind:
■ Before you run a model, the input data must be available in the solution variable.
■ Before running a model that contains a block of simultaneous equations, you
might want to check or modify the values of some OLAP DML options that
control the solution of simultaneous blocks. These options are described briefly in
"Model Options" on page 6-5.
■ When your model contains any dimension-based equations, then you must
provide a numeric solution variable that serves both as a source of data and as the
assignment target for equation results. The solution variable is usually
dimensioned by all of the dimensions on which model equations are based and
also by the other dimensions of the solution variable on which you are not basing
equations.
■ When you run a model, a loop is performed automatically over the values in the
current status list of each of the dimensions of the solution variable on which you
have not based equations.
■ When a model equation bases its calculations on data from previous time periods,
then the solution variable must contain data for these previous periods. When it
does not, or when the first value of the dimension of type DAY, WEEK, MONTH,
QUARTER, or YEAR is in status, then the results of the calculation are NA.
Debugging a Model
The following tools are available for debugging models:
■ To see the order in which the equations in a model are solved, you can set the
MODTRACE option to YES before you run the model.When you set MODTRACE
to YES, you can use a DBGOUTFILE statement to send debugging information to a
file. The file produced by DBGOUTFILE interweaves each line of your model with
its corresponding output.
■ You can use the MODEL.COMPRPT, MODEL.DEPRT, and MODEL.XEQRPT
programs and the INFO function to obtain information about the structure of a
compiled model and the solution status of a model you have run.
■ When you aggregate the data using an AGGREGATE command, include the
FUNCDATA phrase in the statement.
When you use the FUNCDATA phrase in an AGGREGATE command, Oracle
OLAP compiles the aggmap before it aggregates the data. For example, this
statement compiles and precalculates the aggregate data.
AGGREGATE sales USING gpct.aggmap FUNCDATA
Important: When some of the data is calculated on the fly, then you
must compile and save the aggmap after executing the AGGREGATE
command.
Allocating Data
To allocate data using an aggmap object, use the following OLAP DML statements in
the order indicated:
1. Issue a DEFINE AGGMAP statement to define the aggmap object.
Note: When using the OLAP Worksheet, at the command line level,
immediately after the DEFINE AGGMAP statement, enter an "empty"
allocation specification by coding an ALLOCMAP statement. For
example:
DEFINE myaggmap AGGMAP
ALLOCMAP 'END'
2. Add a specification to the aggmap object that specifies the allocation that you
want performed. See ALLOCMAP for more information.
3. When you want the aggmap object to be a permanent part of the analytic
workspace, save the aggmap object using an UPDATE statement followed by
COMMIT.
4. (Optional) Set the POUTFILEUNIT option so that you can monitor the progress of
the allocation.
5. (Optional) Redesign the allocation error log by setting the
ALLOCERRLOGFORMAT and ALLOCERRLOGHEADER options to nondefault
values.
6. (Optional) Set the $ALLOCMAP property on one or more variables to specify that
the aggmap is the default allocation specification for the variables.
7. (Recommended, but optional) Limit the variable to the target cells (that is, the cells
into which you want to allocate data).
8. Issue an ALLOCATE statement to allocate the data.
■ Handling NA data with hierarchical operators—To allocate data to target cells that
currently have NA values, use a hierarchical operator in a RELATION statement in
the allocation specification. The hierarchical operators use the hierarchy of the
dimension rather than existing data as the allocation basis. A danger in using
hierarchical operators is the possibility of densely populating your detail level
data, which can result in a much larger analytic workspace and require much
more time to aggregate the data.
To continue the example of allocating the advertising cost for the new product,
you could use the hierarchical last operator HLAST to specify allocating the cost to
the new (and presumably the last) product in the product dimension hierarchy.
when it does not. (Note that, ISDATE does not actually make the conversion. You
must use CONVERT to make the conversion.)
■ LISTBY produces a report of the names of all objects in an analytic workspace that
are dimensioned by or related to one or more specified dimensions or composites.
You can use LISTBY with a dimension or composite in any attached workspace.
■ LISTNAMES produces a report that lists the names of the objects in an analytic
workspace. You can limit the list to particular types of objects, and you can have
the names for each type of object listed in alphabetical order.
■ MODEL.COMPRPT produces a report that shows how model equations are
grouped into blocks. For step blocks and for simultaneous blocks with a
cross-dimensional dependence, the report lists the dimensions involved in the
dependence.
■ MODEL.DEPRT produces a report that lists the variables and dimension values on
which each model equation depends. When a dependence is dimensional, the
report gives the name of the dimension.
■ MODEL.XEQRPT produces a report about the execution of the model. The report
specifies the block where the solution failed and shows the values of the model
options that were used in solving simultaneous blocks.
■ PAGE, commonly used in report programs or with LISTNAMES, forces a page
break in output when PAGING is set to YES. An optional argument to PAGE
specifies a conditional page break based on how many lines are left on the page.
■ REGRESS.REPORT produces a standard report of a regression performed using
the REGRESS command.
■ STATUS sends to the current outfile the status of one or more dimensions,
dimension surrogates, or valuesets, or the status of all dimensions in an analytic
workspace.
■ STDHDR generates the standard Oracle OLAP heading at the top of every page of
report output.
■ VALSPERPAGE calculates the maximum number of values for a variable of a
specified width that will fit on one page. Pages are units of storage in the
workspace.
Since the ISDATE and VALSPERPAGE programs are like simple functions because
they return a single value, they are documented in alphabetical sequence along with
OLAP DML functions in Chapter 7, "OLAP DML Functions: A - K" and Chapter 8,
"OLAP DML Functions: L - Z". The other programs provided with the OLAP DML, are
documented in alphabetical sequence along with the OLAP DML commands in
Chapter 9, "OLAP DML Commands: A-G" and Chapter 10, "OLAP DML Commands:
H-Z".
1. Issue a DEFINE PROGRAM statement to define the program object. When the
program that you are defining will be used is a function, include the datatype or the
dimension argument.
2. Add contents to the program that specify the processing that you want performed
as described in "Specifying Program Contents" on page 4-3.
3. Compile the program as described in "Compiling Programs" on page 4-11.
4. Test and debug the program as described in "Testing and Debugging Programs" on
page 4-12.
5. Execute the program as described in "Executing Programs" on page 4-13.
When you create a user-defined function, you use a DEFINE PROGRAM statement
that includes the datatype and dimension arguments. Within the program, you include a
RETURN statement that returns a value. The return expression in the program should
match the data type that is specified in its definition. When the data type of the return
value does not match the data type that is specified in its definition, then the value is
converted to the data type in the definition.
User-defined functions can accept arguments. A user-defined function returns only a
single value. However, when you supply an argument to a user-defined function in a
context that loops over a dimension (for example, in a REPORT statement), then the
function returns results with the same dimensions as its argument.
You must declare the arguments using an ARGUMENT statement within the program,
and you must specify the arguments in parentheses following the name of the
program.
Passing Arguments
Use ARGUMENT statements to declare both simple and complex arguments (such as
expressions). ARGUMENT statement also make it convenient to pass arguments from
one program to another, or to create your own user-defined functions since using
these statements you can declare an argument of any data type, dimension, or
valueset. Any ARGUMENT statements must precede the first executable line in the
program. When you run the program, these declared arguments are initialized with
the values you provided as arguments to the program. The program can then use
these arguments in the same way it would use local variables.
Note: You cannot compile and save any program line that contains
an ampersand. Instead, the line is evaluated at run time, which can
reduce the speed of your programs. Therefore, to maximize
performance, avoid using ampersand substitution when another
technique is available.
Program Flow-of-Control
Like most programming languages, the OLAP DML has a number of statements that
you can use to determine the flow-of-control within a program. However, you need to
code explicit loops less frequently in an OLAP DML program because of the intrinsic
looping nature of many OLAP DML statements.
Table 4–1, " Statements For Determining Flow-of-Control" on page 4-5 lists OLAP
DML flow-of-control statements. The looping characteristic of OLAP DML statements
is discussed in "OLAP DML Statements Apply to All of the Values of a Data Object" on
page 1-19.
The OLAP DML contains the flow-of-control statements typically found in a
programming language. Table 4–1, " Statements For Determining Flow-of-Control" on
page 4-5 lists these statements.
OUTFILE monsales.txt
You do not need to know the original value of the option to save it or to restore it later.
You can restore the saved value with a POP statement.
POP DECIMALS
You must make sure a POP statement is executed when errors cause abnormal
termination of the program, as well as when the program ends normally. Therefore,
you should place the POP statement in the normal and abnormal exit sections of the
program.
Handling Errors
When an error occurs anywhere in a program, Oracle OLAP performs the following
actions:
1. Stores the name of the error in the ERRORNAME option, and the text of the error
message in the ERRORTEXT option.
2. When ECHOPROMPT is YES, then Oracle OLAP echoes input lines, error
messages, and output lines, to the current outfile. When you use the OUTFILE or
DBGOUTFILE statement, you can capture the error messages in a file. See
Example 10–70, "Directing Output to a File" on page 10-122 for an example of
directing output to a file.
3. When error trapping is off, then the execution of the program is halted. When
error trapping is on, then the error is trapped.
Trapping an Error
To make sure the program works correctly, you should anticipate errors and set up a
system for handling them. You can use a TRAP statement to turn on an error-trapping
mechanism in a program. When error trapping is on and an error is signaled, then the
execution of the program is not halted. Instead, error trapping does the following:
Passing an Error: Method One Using this method, Oracle OLAP produces the message
immediately and then the error condition is passed through the chain of programs.
Use a TRAP statement with the (default) PRINT option. When an error occurs, Oracle
OLAP produces an error message, and execution branches to the trap label. After the
trap label, perform whatever cleanup you want, and then execute the following
statement.
SIGNAL PRGERR
This creates an error condition that is passed up to the program from which the
current program was run. However, PRGERR does not produce an error message.
PRGERR sets the ERRORNAME option to a blank value.
When the calling program contains a trap label, execution branches to the label. When
each of the programs in a sequence of nested programs uses TRAP and SIGNAL in
this way, you can pass the error condition up through the entire sequence of
programs.
Passing an Error: Method Two Using this method, Oracle OLAP passes the error through
the chain of programs first and then produces the message.
Use a TRAP statement with the NOPRINT option. When an error occurs, execution
branches to the trap label, but the error message is suppressed. After the trap label,
perform whatever cleanup you want, then execute the following statement.
SIGNAL ERRORNAME ERRORTEXT
The options ERRORNAME and ERRORTEXT contain the name and message of the
original error, so this SIGNAL statement reproduces the original error. The error is
then passed up to the program from which the current program was run.
When the calling program also contains a trap label, execution branches to its label.
When each of the programs in a sequence of nested programs uses TRAP...NOPRINT
and SIGNAL ERRORNAME ERRORTEXT in this way, you can pass the error condition
up through the entire sequence of programs. Oracle OLAP produces the error message
at the end of the chain.
When you reach a level where you want to handle the error and continue the
application, omit the SIGNAL statement. You can display your own message with a
SHOW statement.
When you use the NOPRINT keyword with TRAP, control branches to the error label,
and an error message is not issued when an error occurs. The statements following the
error label are then executed.
When you suppress the error message, you might want to produce your own message
in the abnormal exit section. A SHOW statement produces the text you specify but does
not signal an error.
TRAP ON error NOPRINT
...
error:
...
SHOW 'The report will not be produced.'
The program continues with the next statement after producing the message.
■ The error is passed through the chain of programs first, and the error message is
produced at the end of the chain. This approach is illustrated inExample 10–157,
"Producing a Program Error Message at the End of the Chain" on page 10-261.
A SIGNAL statement is used in both methods.
In the abnormal exit section of your program, place the error label (followed by a
colon) and the statements that restore the session environment and handle errors. The
abnormal exit section might look like this.
error:
POPLEVEL 'firstlevel'
OUTFILE EOF
These statements restore saved dimension status and option values and reroute output
to the default outfile.
Compiling Programs
You can explicitly compile a program by using a COMPILE statement. If you do not
explicitly compile a program, then it is compiled when you run the program for the
first time.
When a program is compiled, it translates the program statements into efficient
processed code that executes much more rapidly than the original text of the program.
When errors are encountered in the program, then the compilation is not completed,
and the program is considered to be uncompiled.
After you compile a program, the compiled code is used each time you run the
program in the current session. When you update and commit your analytic
workspace after compiling a program, the compiled code is saved in your analytic
workspace and used to run the program in future sessions. Therefore, you should be
sure to update and commit after compiling a program. This is particularly critical
when the program is part of an application that is run by many users. Unless the
compiled version of the program is saved in the analytic workspace, the program is
recompiled individually in each user session.
Example 9–68, "Compiling a Program" on page 9-149 illustrates using COMPILE to
compile a program
and then examine the file to diagnose any problems in your programs by issuing the
following DML statements:
1. Create a debugging file, by issuing an DBGOUTFILE statement. A V statement
merely creates a file for debugging.
2. Specify that you want each program line to be sent to the debugging file when a
line executes by setting the PRGTRACE option to YES.
3. (Optional) When you want the debugging file to interweave the program lines
with both the program input and error messages, set the ECHOPROMPT option to
YES.
Executing Programs
You can invoke a program that does not return a value by using a CALL statement.
You enclose arguments in parentheses, and they are passed by value. For example,
suppose you create a simple program named addit to add two INTEGER values. You
can use a CALL statement in the main program of your application to invoke the
program.
You can also invoke programs in much the same way as you issue OLAP DML
statements. You invoke user-defined functions in the same way as you use built-in
functions. You merely use the program name in an expression and enclose the
program arguments, if any, in parentheses. For a program that does not return a value
(a user-defined command), you merely use the program name as you would an OLAP
DML command. When you invoke a user-defined program as a function, the program
returns NA.
You can also create programs that execute automatically when Oracle OLAP:
■ Executes an AW ATTACH. AW CREATE, AW DELETE, AW DETACH, DEFINE,
MAINTAIN, PROPERTY, UPDATE, or SET statement as described in "Trigger
Programs" on page 4-16.
■ Encounters an NA value as described in $NATRIGGER.
Startup Programs
Startup programs are programs that you write and that Oracle OLAP checks for by
name when an AW ATTACH statement executes. Startup programs do not exist
within an analytic workspace unless you define and write them. In a startup program
you can execute any OLAP DML statements, or run any of your own programs. For
example, a startup program might set options to values appropriate to your
application.
The types of startup programs that are recognized by Oracle OLAP are discussed in
this topic. The order in which these programs are executed is outlined in "Programs
Executed When Attaching Analytic Workspaces" on page 9-109.
There are two major categories of startup programs:
■ Startup programs that are defined within the same analytic workspace for which
an AW ATTACH statement triggers their execution. Within this category of
startup programs are:
– Permission Programs
– AUTOGO Programs and ONATTACH Programs
■ A program named TRIGGER_AW that is defined in an analytic workspace and
that executes when an AW ATTACH statement is issued for any other analytic
workspace. See TBD for more information.
Permission Programs
Permission programs are programs that you write that give permission to users to
access workspace data. When a user attaches an analytic workspace, Oracle OLAP
checks to see if a permission program that is appropriate for the attachment mode
exists. (The permission program for each attachment mode must have a particular
name as outlined in Table 4–2, " Names of Permission Programs for Different
Attachment Modes".) When an appropriate permission program exists, Oracle OLAP
executes the program. When a user specifies a password when attaching the analytic
workspace, then the password is passed as an argument to the permission program for
processing.
Permission programs allow you to control two levels of access to the analytic
workspace in which they reside.
■ Access at the analytic workspace level—Depending on the return value of the
permission program, the user is or is not granted access to the entire analytic
workspace. You can use the return value to indicate to Oracle OLAP whether or
not the user has the right to attach the workspace.
Importing Data From Relational Tables to Workspace Objects Using the OLAP DML SQL
statement within an OLAP DML program you can copy relational data into analytic
workspace objects using either an implicit cursor or an explicit cursor:
■ To copy data from relational tables into analytic workspace objects using an
implicit cursor, use the SQL SELECT statement. You can use this OLAP DML
statement interactively in the OLAP Worksheet or within an OLAP DML program.
■ To copy data from relational tables into analytic workspace objects using an
explicit cursor, use the following statements in the order indicated. You can only
use these statements within an OLAP DML program. You cannot use them
interactively in the OLAP Worksheet.
1. SQL DECLARE CURSOR defines a SQL cursor by associating it with a
SELECT statement or procedure.
Exporting Data from OLAP DML Objects to Relational Tables Within a program, you can use
an OLAP DML SQL statement with the INSERT keyword to copy data from analytic
workspace objects into relational tables. Typically, you do this by issuing the following
statements in your OLAP DML program:
1. SQL PREPARE statements, to precompile the INSERT and UPDATE statements.
2. SQL EXECUTE statements, to execute the statements that you precompiled in Step
1.
Trigger Programs
DEFINE, MAINTAIN, PROPERTY, SET (=) UPDATE, and AW commands are
recognized by Oracle OLAP as events that can trigger the execution of OLAP DML
programs.
■ Programs triggered by DEFINE, MAINTAIN, PROPERTY, UPDATE, or SET
commands, are called object trigger programs and are discussed in this section
and in the topic for the TRIGGER command.
■ A program named TRIGGER_AW that is defined within one analytic workspace
and which is triggered when another analytic workspace is created, attached,
detached or deleted. See the discussion of the "TRIGGER_AW" on page 4-28 for
more information.
Trigger programs are frequently written to maintain application-specific metadata.
Trigger programs have certain characteristics depending on the statement that triggers
them. Some trigger programs execute before the triggering statement executes; some
after. Oracle OLAP passes arguments to programs triggered by some statements, but
not others. Oracle OLAP does not change dimension status before most trigger
programs execute, but does change dimension status before some MAINTAIN
statements trigger program execution. In most cases, you can give a trigger program
any name that you choose, but some events require a program with a specific name.
"Characteristics of Object Trigger Programs" on page 4-17 discusses these
characteristics.
executes; some after. Oracle OLAP passes arguments to programs triggered by some
statements, but not others. Oracle OLAP does not change dimension status before
most trigger programs execute, but does change dimension status before some
MAINTAIN statements trigger program execution. In most cases, you can give a
trigger program any name that you choose, but some events require a program with a
specific name.
Table 4–3, " Object Trigger Program Characteristics" on page 4-19 lists the OLAP DML
statements that trigger programs, the required name of the program (if any), whether
or not Oracle OLAP uses values returned by the program, and whether or not Oracle
OLAP passes arguments to the program.
Keep the following points in mind when designing trigger programs:
■ Triggers that execute before the DML statement—For trigger programs that execute
before the triggering OLAP DML statement executes, you can define the trigger
program as a user-defined function that returns a BOOLEAN value. The value
returned by the program determines whether or not Oracle OLAP executes the
statement that triggered the execution of the trigger program. When the program
returns FALSE, Oracle OLAP does not execute the triggering statement; when it
returns TRUE or NA, the triggering statement executes.
■ Arguments passed to trigger programs—Oracle OLAP passes arguments to some
trigger programs. These programs are identified in Table 4–3, " Object Trigger
Program Characteristics" on page 4-19. Descriptions of these arguments are
provided in Table 4–4, " Arguments Passed to Trigger Programs" on page 4-19. Use
the ARGUMENT statement to declare these arguments in your program. Use
VARIABLE to define program variables for the values. Use the WKSDATA
function to retrieve the data type of an argument with a WORKSHEET data type.
■ Assign trigger programs—Oracle OLAP executes a program triggered by an
Assign event each time it assigns a value to the object for which the event was
defined. Thus, a program triggered by an Assign event is often executed over and
over again as the assignment statements loops through a object assigning values.
With each execution, the value to be assigned is passed as argument1 to the
Assign trigger program. (See Table 4–4, " Arguments Passed to Trigger Programs"
on page 4-19 for more information and Example 10–162, "An ASSIGN Trigger on a
Variable" on page 10-267 for an example.) Within the Assign trigger program, you
can use a TRIGGER ASSIGN statement to assign a different value than that
specified by the assignment statement that triggered the execution of the Assign
trigger program.
You can only assign values to a formula when the formula has an Assign trigger
defined for it. When you assign a value to a formula with an Assign event, Oracle
OLAP executes the trigger program for the event for assigned value and passes
the assigned value to the trigger program. The Assign trigger does not change
the definition of the formula itself. See Example 10–164, "An ASSIGN Trigger on a
Formula" on page 10-271 for an example of an Assign trigger on a formula.
■ Maintain trigger programs and dimension status —In some cases, Oracle OLAP
changes the status of the dimension being maintained when a Maintain event
triggers the execution of a program. See Table 4–5, " How Programs Triggered by
Maintain Events Effect Dimension Status" on page 4-20 for details.
■ Maintain triggers and dimension surrogates—Maintain triggers for dimension
surrogates are different than Maintain triggers for other objects. You can only
successfully issue a MAINTAIN statement against a dimension surrogate, when
the dimension surrogate has a Maintain trigger. Issuing a MAINTAIN statement
for a surrogate dimension that does not have a Maintain trigger, returns an error.
Also, for Maintain Add and Maintain Merge triggers, whether or not an argument
is passed to the program depends on the object on which the trigger is defined:
■ For dimension surrogates with a Maintain trigger, Oracle OLAP executes the
trigger program one time for each value added or merged and passes that
value into the program.
■ For other objects with a Maintain trigger, Oracle OLAP executes the trigger
program only once after the MAINTAIN statement executes and no values are
passed into the program
Table 4–5 How Programs Triggered by Maintain Events Effect Dimension Status
Event Subevent Dimension Status Before Program Execution
Maintain Add Status set to dimension values just added.
Maintain Delete Status set to dimension values about to be deleted.
Maintain Delete All Current status is not changed.
Maintain Merge Status set to dimension values just merged.
Maintain Move Status set to dimension values about to be moved.
Maintain Rename Current status is not changed.
Forecasting Programs
The OLAP DML has several related statements that allow you to forecast data using
the Geneva Forecasting engine which is a statistical forecasting engine from Roadmap
Technologies that is used extensively in demand planning applications.
To forecast using the Geneva Forecasting engine, take the following steps:
1. Add the future time values to the time dimension.
2. Create a variable to hold the results of the forecast.
3. Write a forecasting program. Within the program, issue the following statements
in the order indicated:
a. FCOPEN function -- Creates a forecasting context.
b. FCSET command -- Specifies the forecast characteristics.
c. FCEXEC command -- Executes a forecast and populates Oracle OLAP
variables with forecasting data.
d. FCQUERY function -- Retrieves information about the characteristics of a
forecast or a trial of a forecast.
e. FCCLOSE command -- Closes a forecasting context.
For examples of using these statements to forecast data see Example 9–118, "A
Forecasting Program" on page 9-245.
ONATTACH
ONDETACH
PERMIT_READ
PERMIT_WRITE
TRIGGER_AFTER_UPDATE
TRIGGER_AW
TRIGGER_BEFORE_UPDATE
TRIGGER_DEFINE
ONATTACH
An ONATTACH program is a program that you can create and that Oracle OLAP
checks for by name when an AW ATTACH command executes. Depending on the
value returned by the program, Oracle OLAP executes the code within the program
immediately after attaching the analytic workspace. Depending on the statements in
the onattach program, the user is granted or denied access to specific objects or sets
of object values.
For multiwriter attachment, you can use ACQUIRE commands to provide access to
individual workspace objects. For read-only and read/write attachment, you can use
PERMIT commands that grant or restrict access to individual workspace objects. All of
the objects referred to in a given onattach program must exist in the same analytic
workspace.
Note: Oracle OLAP checks for other programs when a user attaches
an analytic workspace. See "Programs Executed When Attaching
Analytic Workspaces" on page 9-109 for more information.
Return Value
BOOLEAN
TRUE when Oracle OLAP has successfully set up and attached the analytic workspace;
or FALSE when it has not or when the onattach program has thrown an exception.
Note: You are encouraged to use the normal return values rather
than relying on exceptions to create a return value of FALSE.
Syntax
To define a program with the name ONATTACH use the syntax shown in DEFINE
PROGRAM. Code the actual program as a user-defined function with the following
argument.
ONATTACH ({READ|WRITE|EXCLUSIVE|MULTI} password)
Arguments
See AW ATTACH for explanations of the attachment modes (that is, READ, WRITE,
EXCLUSIVE, and MULTI) and password.
Examples
For examples of how attachment programs behave, see Example 9–49, "Startup
Programs" on page 9-111.
ONDETACH
An ONDETACH program is a program that you can create and that Oracle OLAP
checks for by name when an AW DETACH command executes. Depending on the
value returned by the program, Oracle OLAP executes the code within the program
immediately after detaching the analytic workspace.
Note: Oracle OLAP checks for other programs when a user attaches
an analytic workspace. See "Programs Executed When Attaching
Analytic Workspaces" on page 9-109 for more information.
Return Value
BOOLEAN
TRUE when Oracle OLAP has successfully detached the analytic workspace; or FALSE
when it has not or when the detach program has thrown an exception.
Note: You are encouraged to use the normal return values rather
than relying on exceptions to create a return value of FALSE.
Syntax
To define a program with the name ONDETACH use the syntax shown in DEFINE
PROGRAM.
PERMIT_READ
A PERMIT_READ program is a program that you can create and that Oracle OLAP
checks for by name when an AW ATTACH read-only command executes. Depending
on the value returned by the program, Oracle OLAP executes the code within the
program after attaching the analytic workspace. Depending on the statements in the
permit_read program the user is granted or denied access to specific objects or sets
of object values. Within permit_read program, you can specify PERMIT commands
that grant or restrict access to individual workspace objects. All of the objects referred
to in a given permit_read must exist in the same analytic workspace.
Return Value
BOOLEAN
TRUE when Oracle OLAP has successfully set up and attached the analytic workspace;
or FALSE when it has not or when the permit_read program has thrown an
exception
Note: You are encouraged to use the normal return values rather
than relying on exceptions to create a return value of FALSE.
Syntax
To define a program with the name PERMIT_READ use the syntax shown in DEFINE
PROGRAM. Code the actual program as a user-defined function with the following
argument.
PERMIT_READ (password)
Arguments
See AW ATTACH for an explanation of password. When a user specifies a password
when attaching the analytic workspace, then the password is passed as an argument to
the program for processing.
Examples
To see the order in which permission programs are executed when an analytic
workspace is attached, see Example 9–49, "Startup Programs" on page 9-111.
PERMIT_WRITE
A PERMIT_WRITE program is a program that you can create and that Oracle OLAP
checks for by name when an AW ATTACH read/write command executes. Depending
on the value returned by the program, Oracle OLAP executes the code within the
program after attaching the analytic workspace. Depending on the statements in the
permit_write program, the user is granted or denied access to specific objects or
sets of object values. Within permit_write program, you can specify PERMIT
commands that grant or restrict access to individual workspace object. All of the
objects referred to in a given permit_write program must exist in the same analytic
workspace.
Return Value
BOOLEAN
TRUE when Oracle OLAP has successfully set up and attached the analytic workspace;
or FALSE when it has not or when the permit_write program has thrown an
exception
Note: You are encouraged to use the normal return values rather
than relying on exceptions to create a return value of FALSE.
Syntax
To define a program with the name PERMIT_WRITE use the syntax shown in DEFINE
PROGRAM. Code the actual program as a user-defined function with the following
argument.
PERMIT_WRITE (password)
Arguments
See AW ATTACH for an explanation of password. When a user specifies a password
when attaching the analytic workspace, then the password is passed as an argument to
the program for processing.
Examples
To see the order in which permission programs are executed when an analytic
workspace is attached, see Example 9–49, "Startup Programs" on page 9-111.
TRIGGER_AFTER_UPDATE
Syntax
To create a program with the name TRIGGER_AFTER_UPDATE, follow the guidelines
presented in "Trigger Programs" on page 4-16.
Examples
When you issue an UPDATE statement the program executes and displays the
following output.
calltype = TRIGGER
triggering event = AFTER_UPDATE
triggering subevent = AW
TRIGGER_AW
A TRIGGER_AW program is a program that you can create in one analytic workspace
and that Oracle OLAP checks for by name when that analytic workspace is current
and you create, attach, detach, or delete any other analytic workspace.
Return Value
None.
Syntax
To create a program with the name TRIGGER_AW, follow the guidelines presented
in"How to Create a TRIGGER_AW Program" on page 4-28.
Notes
Note: There is no support for recursive triggers. You must set the
USETRIGGERS option to NO before you issue an AW statement within
an TRIGGER_AW program
TRIGGER_BEFORE_UPDATE
Return Value
You can write the program as a function that returns a BOOLEAN value. In this case,
when the program returns FALSE, Oracle OLAP does not execute the UPDATE
statement that triggered the execution of the TRIGGER_BEFORE_UPDATE program;
when the program returns TRUE or NA, the UPDATE statement executes.
Syntax
To create a program with the name TRIGGER_UPDATE, follow the guidelines
presented in"Trigger Programs" on page 4-16.
Examples
Assume that you define a TEXT variable named myvar and, then, issue an UPDATE
statement. The TRIGGER_BEFORE_UPDSATE program executes.
calltype = TRIGGER
triggering event = BEFORE_UPDATE
triggering subevent = AW
Because the program returned TRUE, the definition for myvar exists after you detach
and reattach the workspace.
AW DETACH myaw
AW ATTACH myaw
DESCRIBE
However, if you modified the program so that it returned FALSE, then when you
detach and reattach the workspace, not only would the myvar definition not in the
workspace, the definition for the TRIGGER_BEFORE_UPDATE program would also
not be in the workspace.
TRIGGER_DEFINE
A TRIGGER_DEFINE program is a program that you create and that Oracle OLAP
checks for by name when a DEFINE command executes. When the program exists in
the same analytic workspace in which you are defining a new object, Oracle OLAP
executes the program.
Syntax
To create a program with the name TRIGGER_DEFINE, follow the guidelines
presented in "Trigger Programs" on page 4-16.
Examples
Assume, as shown in the following statements, that you issue a DEFINE VARIABLE
statement to define a variable named myvar. As shown by the output following the
statement, Oracle OLAP defines the variable and executes the TRIGGER_DEFINE
program.
DEFINE myvar VARIABLE TEXT
calltype = TRIGGER
triggering event = DEFINE
fully-qualified object name =MYAW!MYVAR
type of object = VARIABLE
$STORETRIGGERVAL
$VARCACHE
Aggregation Properties
$AGGMAP
$AGGREGATE_FORCECALC
$AGGREGATE_FORCEORDER
$AGGREGATE_FROM
$AGGREGATE_FROMVAR
$COUNTVAR
$VARCACHE
Allocation Property
$ALLOCMAP
Grouping Id Properties
$GID_DEPTH
$GID_LIST
$GID_TYPE
Formula Properties
$LOOP_AGGMAP
$LOOP_DENSE
$LOOP_VAR
Language Property
$DEFAULT_LANGUAGE
NA Value Properties
$NATRIGGER
$STORETRIGGERVAL
$VARCACHE
$AGGMAP
The $AGGMAP property specifies that Oracle OLAP use the identified aggmap to
automatically aggregate non-precomputed data to substitute for NA values that are in
the dimensioned variable, but not in the session cache for the variable (if any).
Consequently, you do not need to explicitly use the AGGREGATE function to
aggregate nonprecomputed data in a variable that has an $AGGMAP property.
Additionally, the aggmap specified in a variable’s $AGGMAP property, is the aggmap
that Oracle OLAP uses when the variable is the target of an AGGREGATE command
that does not include a USING phrase.
Syntax
You add or delete an $AGGMAP property to the most recently defined or considered
object (see DEFINE and CONSIDER commands) using a PROPERTY statement:
■ To add the property, issue the following statement.
PROPERTY '$AGGMAP' agggmap-name
■ To delete the property, issue the following statement.
PROPERTY DELETE '$AGGMAP'
Arguments
aggmap-name
A TEXT expression that is the name of a previously defined aggmap object.
Examples
Assume that you have a hierarchical dimension named geog,a simple dimension
named year, and the following variable named sales which is dimensioned by both
and which has data only at the detail level.
Assume that you want to explicitly specify the value of 8000 for the sales cell for
Connecticut in 2005. To do this you issue the following assignment statement and a
report of sales shows the value.
sales (geog 'Connecticut' year '2005') = 8000
REPORT sales;
-----------SALES-----------
-----------YEAR------------
GEOG 2004 2005 2006 2007
-------------- ------ ------ ------ ------
Toronto 1,000 1,333 1,954 1,260
Norfolk 1,131 1,867 1,843 1,767
Montreal 1,571 1,754 1,316 1,905
Quebec City 1,914 1,728 1,386 1,847
Hartford 1,870 1,943 1,085 1,335
New Haven 1,684 1,330 1,458 1,402
Springfield 1,630 1,116 1,897 1,690
Boston 1,780 1,310 1,368 1,581
Ontario NA NA NA NA
Quebec NA NA NA NA
Connecticut NA 8,000 NA NA
Massachusetts NA NA NA NA
Canada NA NA NA NA
USA NA NA NA NA
All Geog NA NA NA NA
Now assume that you define an aggmap for sales. The aggmap has the following
definition which specifies that only the upper-level data for Canada and the top level
(All Geog) be aggregated by the AGGREGATE command.
DEFINE MYAGGMAP AGGMAP
AGGMAP
RELATION geogParentrel PRECOMPUTE ('Quebec' 'Ontario' 'Canada' 'All Geog')
END
-----------SALES-----------
-----------YEAR------------
GEOG 2004 2005 2006 2007
-------------- ------ ------ ------ ------
Toronto 1,000 1,333 1,954 1,260
Norfolk 1,131 1,867 1,843 1,767
Montreal 1,571 1,754 1,316 1,905
Quebec City 1,914 1,728 1,386 1,847
Hartford 1,870 1,943 1,085 1,335
New Haven 1,684 1,330 1,458 1,402
Springfield 1,630 1,116 1,897 1,690
Boston 1,780 1,310 1,368 1,581
Ontario NA NA NA NA
Quebec NA NA NA NA
Connecticut 3,554 8,000 2,543 2,737
Massachusetts 3,410 2,426 3,265 3,271
Canada NA NA NA NA
USA 6,964 5,699 5,808 6,008
All Geog NA NA NA NA
Once you aggregate sales using the AGGREGATE command, Oracle OLAP
aggregates values for all of the PRECOMPUTE cells in sales.
REPORT sales
-----------SALES-----------
-----------YEAR------------
GEOG 2004 2005 2006 2007
-------------- ------ ------ ------ ------
Toronto 1,000 1,333 1,954 1,260
Norfolk 1,131 1,867 1,843 1,767
Montreal 1,571 1,754 1,316 1,905
You can further simplify the AGGREGATE command if you place an $AGGMAP
property on the sales_by_revenue variable. To define an $AGGMAP property on
the sales_by_revenue variable, issue the following statements.
CONSIDER sales_by_revenue
PROPERTY '$AGGMAP' 'revenue_aggmap'
Now you can aggregate the data by issuing the following AGGREGATE command
that does not include a USING clause.
AGGREGATE sales_by_revenue
$AGGREGATE_FORCECALC
Syntax
You add or delete an $AGGREGATE_FORCECALC property to the most recently
defined or considered object (see DEFINE and CONSIDER commands) by issuing a
PROPERTY statement:
■ To add the property, issue the following statement.
PROPERTY '$AGGREGATE_FORCECALC'
■ To delete the property, issue the following statement.
PROPERTY DELETE '$AGGREGATE_FORCECALC'
$AGGREGATE_FORCEORDER
Syntax
You add or delete an $AGGREGATE_FORCEORDER property to the most recently
defined or considered object (see DEFINE and CONSIDER commands) by issuing a
PROPERTY statement:
■ To add the property, issue the following statement.
PROPERTY '$AGGREGATE_FORCEORDER'
■ To delete the property, issue the following statement.
PROPERTY DELETE '$AGGREGATE_FORCEORDER'
$AGGREGATE_FROM
Syntax
You add or delete an $AGGREGATE_FROM property to the most recently defined or
considered object (see DEFINE and CONSIDER commands) by issuing a PROPERTY
statement:
■ To add the property, issue the following statement.
PROPERTY '$AGGREGATE_FROM' fromspec
■ To delete the property, issue the following statement.
PROPERTY DELETE '$AGGREGATE_FROM'
Arguments
fromspec
An arbitrarily dimensioned variable, formula, or relation from which the detail data
for the aggregation is obtained.
Examples
Now you can aggregate the data by issuing the following AGGREGATE command
that does not include a FROM clause.
AGGREGATE total_sales_exclud_north USING agg_sales_exclud_north
$AGGREGATE_FROMVAR
Syntax
You add or delete an $AGGREGATE_FROMVAR property to the most recently
defined or considered object (see DEFINE and CONSIDER commands) by issuing a
PROPERTY statement:
■ To add the property, issue the following statement.
PROPERTY '$AGGREGATE_FROMVAR' textvar ACROSS dimname
■ To delete the property, issue the following statement.
PROPERTY DELETE '$AGGREGATE_FROMVAR'
Arguments
textvar
A TEXT expression that specifies an arbitrarily dimensioned variable or formula that
specifies the names of the objects from which to obtain detail data when performing a
capstone aggregation. Specify NA to indicate that a node does not need detail data to
calculate the value.
ACROSS dimname
Specifies the dimension or a named composite that the aggregation loops over to
discover the cells in the objects specified by textvar. Because the objects specified by
textvar can be formulas, you can realize a significant performance advantage by
supplying a looping dimension that eliminates the sparsity.
Examples
As the following statements illustrate, you can omit the FROMVAR clause if you
create the appropriate FROMVAR property on sales-capstone76.
CONSIDER sales_capstone76
PROPERTY '$AGGREGATE_FROMVAR' 'capstone_source'
AGGREGATE sales_capstone76 USING capstone_aggmap
$ALLOCMAP
The $ALLOCMAP property specifies the default aggmap for allocation for a variable.
This is the aggmap that Oracle OLAP uses when the variable is the target variable of
an ALLOCATE statement that does not include a USING phrase.
Syntax
You add or delete an $ALLOCMAP property to the most recently defined or
considered object (see DEFINE and CONSIDER commands) using a PROPERTY
statement:
■ To add the property, issue the following statement.
PROPERTY '$ALLOCMAP' aggmap-name
■ To delete the property, issue the following statement.
PROPERTY DELETE '$AALLOCMAP'
Arguments
aggmap-name
A TEXT expression that specifies the name of a previously defined ALLOCMAP type
aggmap object.
Examples
You can specify that projbudgmap is the default allocation specification for the
projbudget variable by issuing the following statements.
CONSIDER projbudget
PROPERTY '$ALLOCMAP' "projbugmap'
Now, merely by issuing the following statement, you can allocate data in the
projbudget variable using the projbudgmap allocation specification.
ALLOCATE projbudget
$COUNTVAR
Syntax
You add or delete a $COUNTVAR property to the most recently defined or considered
object (see DEFINE and CONSIDER commands) using a PROPERTY statement:
■ To add the property, issue the following statement.
PROPERTY '$COUNTVAR' countvar
■ To delete the property, issue the following statement.
PROPERTY DELETE '$COUNTVAR'
Arguments
countvar
A TEXT expression that specifies the name of a previously defined Countvar variable.
The Countvar variable must be an INTEGER variable with exactly the same
dimensions in exactly the same order as the dimensions as the variable on which you
add the $COUNTVAR property.
Examples
$DEFAULT_LANGUAGE
Syntax
Before you add or delete a $DEFAULT_LANGUAGE property to your language
dimension, you must make that dimension the most recently defined or considered
object (see DEFINE and CONSIDER commands). You add $DEFAULT_LANGUAGE
property using a PROPERTY statement:
■ To add the property, issue the following statement.
PROPERTY '$DEFAULT_LANGUAGE' language
■ To delete the property, issue the following statement.
PROPERTY DELETE '$DEFAULT_LANGUAGE'
Arguments
language
A TEXT expression that is one of the values in your language dimension, or an empty
string.
Notes
Examples
REPORT mylangs
MYLANGS
--------------
FRENCH
AMERICAN
MYLANGS
--------------
FRENCH
AMERICAN
PRODUCTS
--------------
PROD01
PROD02
------PROD_DESC------
------PRODUCTS-------
MYLANGS PROD01 PROD02
-------------- ---------- ----------
FRENCH Pantalons Jupes
AMERICAN Trousers Skirts
Assume that you attach the analytic workspace. By displaying the options for the
analytic workspace and requesting a A report of mylangs and prod_desc, shows
that Oracle OLAP has limited the mylangs dimension to American which is the value
of the SESSION_NLS_LANGUAGE option.
SHOW NLS_LANGUAGE
AMERICAN
AW ATTACH myaw RW
" Get the default language in our language dimension
SHOW OBJ(PROPERTY '$DEFAULT_LANGUAGE' 'mylangs')
AMERICAN
SHOW SESSION_NLS_LANGUAGE
AMERICAN
SHOW LOCK_LANGUAGE_DIMS
yes
SHOW STATIC_SESSION_LANGUAGE
no
REPORT mylangs
MYLANGS
--------------
AMERICAN
REPORT prod_desc
------PROD_DESC------
------PRODUCTS-------
MYLANGS PROD01 PROD02
-------------- ---------- ----------
AMERICAN Trousers Skirts
REPORT mylangs
MYLANGS
--------------
FRENCH
REPORT prod_desc
------PROD_DESC------
------PRODUCTS-------
MYLANGS PROD01 PROD02
-------------- ---------- ----------
FRENCH Pantalons Jupes
SHOW NLS_LANGUAGE
SPANISH
SHOW SESSION_NLS_LANGUAGE
SPANISH
SHOW LOCK_LANGUAGE_DIMS
sí
SHOW STATIC_SESSION_LANGUAGE
no
REPORT mylangs
MYLANGS
--------------
AMERICAN
REPORT prod_desc
------PROD_DESC------
------PRODUCTS-------
MYLANGS PROD01 PROD02
-------------- ---------- ----------
AMERICAN Trousers Skirts
Assume that you had defined the mylangs language dimension without specifying a
default language using the following code.
DEFINE mylangs DIMENSION TEXT
MAINTAIN mylangs ADD 'FRENCH' 'AMERICAN'
CONSIDER mylangs
PROPERTY '$DEFAULT_LANGUAGE' ''
In this case, when you set the value of NLS_LANGUAGE to Spanish, since the
language dimension, mylangs does not have a value specified for its $DEFAULT_
LANGUAGE property, Oracle OLAP limits the mylangs dimension using the first
value in the mylangs dimension which is French.
NLS_LANGUAGE = 'SPANISH'
SHOW OBJ(PROPERTY '$DEFAULT_LANGUAGE' 'mylangs')
SHOW NLS_LANGUAGE
SPANISH
SHOW SESSION_NLS_LANGUAGE
SPANISH
SHOW LOCK_LANGUAGE_DIMS
sí
SHOW STATIC_SESSION_LANGUAGE
no
REPORT mylangs
MYLANGS
--------------
FRENCH
REPORT prod_desc
------PROD_DESC------
------PRODUCTS-------
MYLANGS PROD01 PROD02
-------------- ---------- ----------
FRENCH Pantalons Jupes
$GID_DEPTH
Syntax
You can not explicitly define a $GID_DEPTH property. Oracle OLAP automatically
creates a $GID_DEPTH property on a grouping id relation when the execution of a
GROUPIONGID command creates the relation.
$GID_DEPTH = intlevels
Arguments
intlevels
An INTEGER value that specifies the number of levels of grouping ids.
Examples
See Example 9–144, "Using GROUPINGID Command to Populate a Relation with
Grouping Ids" on page 9-308.
$GID_LIST
The $GID_LIST property contains the names of the levels used to create the grouping
ids in a relation created when the GROUPINGID command with either the ROLLUP
or GROUPSET keyword executes.
Syntax
You can not explicitly define a $GID_LIST property. Oracle OLAP automatically
creates a $GID_LIST property on a grouping id relation when the execution of a
GROUPIONGID command with either the ROLLUP or GROUPSET keyword creates
the relation.
$GID_LIST = levels
Arguments
levels
A TEXT expression which is the levels, sepearated by hypens (-), of the hierarchies of
the dimension for which grouping ids were created.
$GID_TYPE
Syntax
You can not explicitly define a $GID_TYPE property. Oracle OLAP automatically
creates a $GID_TYPE property on a grouping id relation when the execution of a
GROUPIONGID command with either the ROLLUP or GROUPSET keyword creates
the relation.
$GID_TYPE = ROLLUP | GROUPSET
Arguments
ROLLUP
Specifies that the grouping ids are of the rollup type. For more information on this
type of grouping type, see the discussion of ROLLUP in the GROUPBY clause of a
SQL SELECT statement in the Oracle Database SQL Language Reference.
GROUPSET
Specifies that the grouping ids are of the grouping set type. For more information on
this type of grouping type, see the discussion of grouping sets in the GROUPBY clause
of a SQL SELECT statement in the Oracle Database SQL Language Reference.
$LOOP_AGGMAP
Syntax
You add or delete a $LOOP_AGGMAP property to the most recently defined or
considered formula (see DEFINE and CONSIDER commands) using a PROPERTY
statement:
■ To add the property, issue the following statement.
PROPERTY '$LOOP_AGGMAP' agggmap-name
■ To delete the property, issue the following statement.
PROPERTY DELETE '$LOOP_AGGMAP'
Arguments
aggmap_name
The name of an aggmap object.
$LOOP_DENSE
The $LOOP_DENSE property is used to determine how to loop the formula on which
it is assigned when a OLAP_TABLE SQL function with the LOOP OPTIMIZED clause
is executed. It specifies that Oracle OLAP loops densely over the formula (that is, that
it loop over every tuple of the formula—even those member cells that do not have
values). For more information, see the discussion of the LOOP Clause on page A-13.
Syntax
You add or delete a $LOOP_DENSE property to the most recently defined or
considered formula (see DEFINE and CONSIDER commands) using a PROPERTY
statement:
■ To add the property, issue the following statement.
PROPERTY '$LOOP_DENSE' dimension_list
■ To delete the property, issue the following statement.
PROPERTY DELETE '$LOOP_DENSE'
Arguments
dimension_list
One or more names of the dimensions of the formula separated by commas.
$LOOP_VAR
The $LOOP_VAR property specifies that when a OLAP_TABLE SQL function with the
LOOP OPTIMIZED clause is executed, the formula on which it is assigned is looped in
the same manner as the variable or QDR specified in the property. For more
information on looping in OLAP_TABLE, see the discussion of the LOOP Clause on
page A-13.
Syntax
You add or delete a $LOOP_VAR property to the most recently defined or considered
formula (see DEFINE and CONSIDER commands) using a PROPERTY statement:
■ To add the property, issue the following statement.
PROPERTY '$LOOP_VAR' qdr | variable
■ To delete the property, issue the following statement.
PROPERTY DELETE '$LOOP_VAR'
Arguments
qdr
A QDR for one of the dimensions of the formula.
variable
A variable with the same dimensions as the formula.
$NATRIGGER
The $NATRIGGER property specifies values for Oracle OLAP to substitute for NA
values that are in a dimensioned variable, but not in the session cache for the variable
(if any). To calculate the values, Oracle OLAP takes the steps described in "How Oracle
OLAP Calculates Data for a Variable with NA Values" on page 5-24. The results of the
calculation are either stored in the variable or cached in the session cache for the
variable as described in "How Oracle OLAP Determines Whether to Store or Cache
Results of $NATRIGGER" on page 5-29.
Syntax
You add or delete a $NATRIGGER property to the most recently defined or
considered object (see DEFINE and CONSIDER commands) using a PROPERTY
statement:
■ To add the property, issue the following statement.
PROPERTY '$NATRIGGER' value
■ To delete the property, issue the following statement.
PROPERTY DELETE '$NATRIGGER'
Arguments
value
A TEXT expression that is the value of the property. The text can be any expression
that is valid for defining a formula
Notes
■ Yes. Aggregate the variable using the aggmap specified for the $AGGMAP
property and, then, go to step 5.
■ No. Go to step 6.
5. What is the value of the cell after aggregating the variable?
■ NA, go to step 6.
■ Non-NA, go to step 7.
6. Does the variable have a $NATRIGGER property?
■ Yes. Execute the expression specified for the $NATRIGGER property and,
then, go to step 7.
■ No. Go to step 7.
7. Calculate the data.
8. Apply the NAFILL function or the NASKIP, NASKIP2, or NASPELL options, as
appropriate.
Examples
v1(d1 1) = 333.3
REPORT v1
$STORETRIGGERVAL
Syntax
You add or delete a $STORETRIGGERVAL property to the most recently defined or
considered object (see DEFINE and CONSIDER commands) using a PROPERTY
statement:
■ To add the property, issue the following statement.
PROPERTY '$STORETRIGGERVAL' value
■ To delete the property, issue the following statement.
PROPERTY DELETE '$ASTORETRIGGERVAL'
Arguments
value
A BOOLEAN expression that contains the value of the property.
Examples
$VARCACHE
The $VARCACHE property specifies whether Oracle OLAP stores or caches variable
data that is the result of the execution of an AGGREGATE function or a $NATRIGGER
expression.
Syntax
You add or delete a $VARCACHE property to the most recently defined or considered
object (see DEFINE and CONSIDER commands) using a PROPERTY statement:
■ To add the property, issue the following statement.
PROPERTY '$VARCACHE' value
■ To delete the property, issue the following statement.
PROPERTY DELETE '$VARCACHE'
Arguments
value
One of the following TEXT expressions that indicate where Oracle OLAP should place
variable data that is the result of calculations performed when the AGGREGATE
function or $NATRIGGER value executes:
■ VARIABLE specifies that Oracle OLAP populates the variable with data that is the
result of the execution of the AGGREGATE function or $NATRIGGER property.
When you specify this option, the data that is the result of the aggregation is
permanently stored in the variable when the analytic workspace is updated and
committed.
■ SESSION specifies that Oracle OLAP caches data that is the result of the execution
of the AGGREGATE function or $NATRIGGER property in the session cache (See
"What is an Oracle OLAP Session Cache?" on page 6-148). When you specify this
option, the data that is the result of the execution of the AGGREGATE function or
$NATRIGGER property is ignored during updates and commits and is discarded
at the end of the session.
■ NONE specifies that Oracle OLAP calculates new variable data each time the
AGGREGATE function or $NATRIGGER value executes; Oracle OLAP does not
store or cache the data.
■ DEFAULT specifies that you do not want Oracle OLAP to use the $VARCACHE
property when determining what to do with data that is calculated by the
Notes
1. Is there a CACHE statement in the specification for the aggmap that is being used
by the current AGGREGATE function? If there is, then Oracle OLAP goes to step
2. If there is not, then Oracle OLAP goes to step 3.
2. Is the CACHE statement a CACHE DEFAULT statement? If it is, then Oracle
OLAP goes to step 3. If it is not, then Oracle OLAP uses the CACHE statement in
the aggregation specification to determine what to do with variable data that is the
result of the calculation and ends the decision-making process.
3. Does the variable being aggregated have a $VARCACHE property? If it does, then
Oracle OLAP goes to Step 4. If it does not, then Oracle OLAP goes to step 5.
4. Does the $VARCACHE property have a value of DEFAULT? If it does, then
Oracle OLAP goes to step 5. If it does not, then Oracle OLAP uses the value of the
$VARCACHE property determines what happens to the variable data calculated
using the AGGREGATE function, and ends the decision-making process.
5. Use the current setting of the VARCACHE option to determine what happens to
the variable data calculated using the AGGREGATE function. End
decision-making process.
Examples
About Options
An OLAP DML option is a special type of analytic workspace object that specifies the
characteristic of some aspect of how Oracle OLAP calculates or formats data or what
Oracle OLAP operations are activated. Some options are read-only, while others are
read/write options for which you can specify values. Read/write options have default
values.
You can use the SET (=) command to retrieve the value of an option into a predefined
variable and to specify a new value for a read/write option. Use the SHOW command
to display the value of an option.
A
ALLOCERRLOGFORMAT
ALLOCERRLOGHEADER
AWWAITTIME
B
BADLINE
BMARGIN
C
CALENDARWEEK
COLWIDTH
COMMAS
COMPILEMESSAGE
COMPILEWARN
D
DATEFORMAT
DATEORDER
DAYABBRLEN
DAYNAMES
DECIMALCHAR
DECIMALOVERFLOW
DECIMALS
DEFAULTAWSEGSIZE
DIVIDEBYZERO
DSECONDS
E
ECHOPROMPT
EIFBYTES
EIFEXTENSIONPATH
EIFNAMES
EIFSHORTNAMES
EIFTYPES
EIFUPDBYTES
EIFVERSION
ERRNAMES
ERRORNAME
ERRORTEXT
ESCAPEBASE
EXPTRACE
I
INF_STOP_ON_ERROR
L
LCOLWIDTH
LIKECASE
LIKEESCAPE
LIKENL
LIMIT.SORTREL
LIMITSTRICT
LINENUM
LINESLEFT
LOCK_LANGUAGE_DIMS
LSIZE
M
MAXFETCH
MODDAMP
MODERROR
MODGAMMA
MODINPUTORDER
MODMAXITERS
MODOVERFLOW
MODSIMULTYPE
MODTOLERANCE
MODTRACE
MONTHABBRLEN
MONTHNAMES
MULTIPATHHIER
N
NASKIP
NASKIP2
NASPELL
NLS_CALENDAR
NLS_CURRENCY
NLS_DATE_FORMAT
NLS_DATE_LANGUAGE
NLS_DUAL_CURRENCY
NLS_ISO_CURRENCY
NLS_LANG
NLS_LANGUAGE
NLS_NUMERIC_CHARACTERS
NLS_SORT
NLS_TERRITORY
NOSPELL
O
OKFORLIMIT
OKNULLSTATUS
OUTFILEUNIT
P
PAGENUM
PAGEPRG
PAGESIZE
PAGING
PARENS
PERMITERROR
POUTFILEUNIT
PRGTRACE
R
RANDOM.SEED.1 and RANDOM.SEED.2
RECURSIVE
ROLE
ROOTOFNEGATIVE
S
SECONDS
SESSCACHE
SESSION_NLS_LANGUAGE
SORTCOMPOSITE
SPARSEINDEX
SQLBLOCKMAX
SQLCODE
SQLERRM
SQLMESSAGES
STATIC_SESSION_LANGUAGE
T
THIS_AW
THOUSANDSCHAR
TMARGIN
TRACEFILEUNIT
TRIGGERMAXDEPTH
TRIGGERSTOREOK
U
USERID
USETRIGGERS
V
VARCACHE
W
WEEKDAYSNEWYEAR
WRAPERRORS
Y
YESSPELL
YRABSTART
Z
ZEROROW
ZSPELL
Options by Category
Analytic Workspace Options
Globalization Support
Multi-Language Support Options
Aggregation Options
Allocation Options
Model Options
Compilation Options
Error Options
Debugging Options
SQL Embed Options
File Reading and Writing Options
EIF Options
Report Options
NA Values Options
Date-only Data Type Options
Datetime Options
Numeric Options
RANK Function Monitoring Options
Globalization Support
NLS_CALENDAR
NLS_CURRENCY
NLS_DATE_FORMAT
NLS_DATE_LANGUAGE
NLS_DUAL_CURRENCY
NLS_ISO_CURRENCY
NLS_LANG
NLS_LANGUAGE
NLS_NUMERIC_CHARACTERS
NLS_SORT
NLS_TERRITORY
Aggregation Options
MULTIPATHHIER
POUTFILEUNIT
SESSCACHE
VARCACHE
Allocation Options
ALLOCERRLOGFORMAT
ALLOCERRLOGHEADER
POUTFILEUNIT
Model Options
MODDAMP
MODERROR
MODGAMMA
MODINPUTORDER
MODMAXITERS
MODOVERFLOW
MODSIMULTYPE
MODTOLERANCE
MODTRACE
Compilation Options
COMPILEMESSAGE
COMPILEWARN
THIS_AW
Error Options
BADLINE
ERRNAMES
ERRORNAME
ERRORTEXT
INF_STOP_ON_ERROR
MODERROR
PERMITERROR
SQLERRM
SQLMESSAGES
WRAPERRORS
Debugging Options
EXPTRACE
MODTRACE
PRGTRACE
EIF Options
EIFBYTES
EIFEXTENSIONPATH
EIFNAMES
EIFSHORTNAMES
EIFTYPES
EIFUPDBYTES
EIFVERSION
Report Options
BMARGIN
COLWIDTH
COMMAS
DECIMALCHAR
DECIMALS
LCOLWIDTH
LINENUM
LINESLEFT
LSIZE
NASPELL
NOSPELL
PAGENUM
PAGEPRG
PAGESIZE
PAGING
PARENS
THOUSANDSCHAR
TMARGIN
YESSPELL
ZEROROW
ZSPELL
NA Values Options
LIMITSTRICT
NASKIP
NASKIP2
NASPELL
RECURSIVE
TRIGGERMAXDEPTH
TRIGGERSTOREOK
Datetime Options
CALENDARWEEK
DSECONDS
SECONDS
Numeric Options
DECIMALOVERFLOW
DIVIDEBYZERO
RANDOM.SEED.1 and RANDOM.SEED.2
ROOTOFNEGATIVE
ALLOCERRLOGFORMAT
Syntax
ALLOCERRLOGFORMAT = text
Arguments
text
Characters that determine the contents and formatting of the error log that you specify
with an ERRORLOG statement in an ALLOCMAP command. By placing an INTEGER
value before the formatting character, you can specify the number of characters that
the object occupies in the error log. You can specify escape sequences as formatting
characters. For valid escape sequences, see "Escape Sequences" on page 2-5. Table 6–1,
" Characters for Specify the Contents of the Error Log for ALLOCATE" lists the
characters that specify the contents of the error log. The default value of
ALLOCERRLOGFORMAT is the following.
'%8p %8y %8z %e (%n)'
Table 6–1 Characters for Specify the Contents of the Error Log for ALLOCATE
Character Output Specified
b The basis object being processed.
c The child node of the dimension being processed.
d The name of the dimension being processed.
e A description of the error encountered.
n The error code of the error encountered.
p The parent node of the dimension being processed.
r The name of the relation being allocated down.
s The source object being processed.
t The target object being processed.
n The basis value of the child cell receiving the allocation.
y The source value of the parent cell being allocated.
z The basis value of the parent cell being allocated.
Examples
ALLOCERRLOGHEADER
The ALLOCERRLOGHEADER option determines the column headings for the error
log that you specify with the ERRORLOG argument to the ALLOCATE command. To
specify additional formatting for the error log, use the ALLOCERRLOGFORMAT
option.
Syntax
ALLOCERRLOGHEADER = text
Arguments
text
Characters that determine the content and formatting of the column headers that are
the first line of the error log that you specify with the ALLOCATE command. (See
ALLOCERRLOGFORMAT for a list of the characters you can use.)
When you specify NA as the value for this option, then ALLOCATE does not write any
header to the error log. The following is the default value of
ALLOCERRLOGHEADER.
'Dim Source Basis\n%-8d %-8v %-8b Description\n
-------- -------- -------- -----------'
Examples
An allocation operation that has a variable named budget as both the source and
basis objects and which encounters a deadlock when allocating down the division
dimension produces the following entry in the error log.
AWWAITTIME
Data Type
INTEGER
Syntax
AWWAITTIME = seconds
Arguments
seconds
The number of seconds to wait for an analytic workspace to be available. The default
value is 20 seconds.
Notes
Workspace Sharing
When your user ID has the appropriate access rights and that no user has read/write
exclusive access to the workspace, you can get read-only access to an analytic
workspace, no matter how many other users are using it. When another user has
read/write access and commits the workspace, your view of the workspace does not
change; you must detach and reattach the workspace to see the changes.
Examples
BADLINE
When a program, model, or input file is executing, the BADLINE option controls
whether Oracle OLAP records, in the current outfile, the line that caused an error.
Data Type
BOOLEAN
Syntax
BADLINE = {YES|NO}
Arguments
YES
When an error occurs during the execution of a program, model, or input file, Oracle
OLAP records in the current outfile the name of the program, model, or file in which
the error occurred and the line that caused the error. When an error message is
included in the output, the BADLINE information appears immediately after the error
message.
NO
(Default) When an error occurs in a program, model, or input file, Oracle OLAP does
not record the error in the current outfile.
Examples
When you run the program when the DIVIDEBYZERO option is set to NO, then an
error occurs because division by zero is not allowed. When BADLINE is set to YES, the
following messages are recorded in the current outfile.
ERROR: (MXXEQ01) A division by zero was attempted. Set DIVIDEBYZERO to
YES if you want NA to be returned as the result of division by zero.
In DEMO!TEST PROGRAM:
myint2 = 250/myint1
When you run the program, an error occurs because division by zero is not allowed
(that is, when DIVIDEBYZERO is set to NO).
When BADLINE is set to NO only the error is recorded in the current outfile.
ERROR: (MXXEQ01) A division by zero was attempted. (If you want NA to
be returned as the result of a division by zero, set the DIVIDEBYZERO
option to YES.)
When BADLINE is set to YES, the line that causes the error and the name of the
program in which the error occurred are recorded in the current outfile.
ERROR: (MXXEQ01) A division by zero was attempted. (If you want NA to
be returned as the result of a division by zero, set the DIVIDEBYZERO
option to YES.)
In TESTBAD PROGRAM:
myint2 = 250/myint1
In EDDE.RUNCMD PROGRAM:
BMARGIN
The BMARGIN option defines the number of blank lines for the bottom margin of
output pages. BMARGIN is meaningful only when PAGING is set to YES and only for
output from statements such as REPORT and DESCRIBE. The BMARGIN option is
usually set in the initialization section of report programs.
Data Type
INTEGER
Syntax
BMARGIN = n
Arguments
n
An INTEGER expression that specifies the number of lines that you want to set aside
for the bottom margin in a report. The default is 1.
Notes
Examples
CALENDARWEEK
The CALENDARWEEK option determines whether weeks should be aligned with the
actual calendar year.
Note: You can only use this function with dimensions of type WEEK.
Data Type
BOOLEAN
Syntax
CALENDARWEEK = {YES|NO}
Arguments
YES
(Default) Specifies that weeks are aligned with the calendar year. For example, if you
have defined a dimension of type WEEK, Oracle OLAP numbers its values so that the
first week in the calendar year is week 1, the second week in the calendar year is week
2, and so on. Weeks are aligned with the calendar year regardless of any beginning or
ending date specified in the WEEK dimension definition.
NO
Specifies that weeks are not aligned with the calendar year. Instead, weeks are
numbered so that they are aligned with the date specified in the dimension definition.
For example, if you have defined a dimension of type WEEK with a beginning or
ending date, its values are numbered so that the week corresponding to the date in the
dimension definition is week 1, the following week is week 2, and so on.
Notes
Fiscal Years
Setting CALENDARWEEK to NO causes weeks to be numbered so that the number 1 is
assigned to the week beginning or ending on the date specified in the DEFINE
DIMENSION statement. This week is then assigned to a fiscal year, which is the
calendar year of the first January 1 on or after the week's starting date. For example, if
you define a dimension of type WEEK with a starting date of 02Jan1996 (or,
equivalently, an ending date of 08Jan1996), the week starting 02Jan1996 will be
considered week 1 of fiscal year 1997. If, by contrast, you had given the dimension a
starting date between 02Jan1995 and 01Jan1996, then the week starting on that
date would be week 1 of fiscal year 1996.
Examples
COLWIDTH
The COLWIDTH option controls the default width of data columns in report output.
For output from the ROW command and HEADING command, COLWIDTH affects
all columns except the first column. For output from REPORT, COLWIDTH affects all
data columns, as well as the label columns for a composite or a conjoint dimension.
Data Type
INTEGER
Syntax
COLWIDTH = n
Arguments
n
An INTEGER expression that specifies the desired column width in number of
characters. You can set COLWIDTH to any value from 1 to 4000. The default is 10.
Examples
COMMAS
The COMMAS option controls the use of the character that separates thousands and
millions in numeric output. This character is typically a comma; however, it might be
different depending on your NLS_TERRITORY setting. The THOUSANDSCHAR
option records the character that is currently being used for separating thousands. The
COMMAS option controls whether the character appears in numeric output.
COMMAS affects all commands that produce output, including the ROW command as
well as HEADING, REPORT, and SHOW.
Data Type
BOOLEAN
Syntax
COMMAS = {NO|YES}
Arguments
NO
Numeric output does not contain a character that separates thousands, millions, and
so on.
YES
(Default) Numeric output contains a character that separates thousands, millions, and
so on.
Examples
COMPILEMESSAGE
You use the COMPILEMESSAGE option to specify whether you want Oracle OLAP to
send to the current outfile non-fatal messages during execution of the COMPILE
command. Non-fatal messages are those indicating errors that do not prevent a
program from compiling.
Data Type
BOOLEAN
Syntax
COMPILEMESSAGE = {YES|NO}
Arguments
YES
(Default) Indicates that Oracle OLAP should record non-fatal messages during
execution of the COMPILE command.
NO
Indicates that Oracle OLAP should suppress non-fatal messages during execution of
the COMPILE command.
Examples
COMPILEWARN
Data Type
BOOLEAN
Syntax
COMPILEWARN = {YES|NO}
Arguments
YES
Oracle OLAP records a message warning you that a compilable object is being
compiled automatically. The message explains why the compilation was necessary.
NO
(Default) Oracle OLAP does not record a message warning you that an object is being
compiled automatically.
Examples
DATEFORMAT
The DATEFORMAT option holds the template used for displaying DATE-only data
type values and converting DATE-only values to text values. The template can include
format specifications for any of the four components of a date (day, month, year, and
day of the week). It can also include additional text.
Data Type
TEXT
Syntax
DATEFORMAT = template
Arguments
template
A TEXT expression that specifies the template for displaying dates. Each component in
the template must be preceded by a left angle bracket and followed by a right angle
bracket. You can include additional text before, after, or between the components. The
default template is '<DD><MTXT><YY>'.
Table 6–2, "DATEFORMAT Templates for Day", Table 6–3, " DATEFORMAT Templates
for Week", Table 6–4, " DATEFORMAT Templates for Month", and Table 6–5,
" DATEFORMAT Templates for Year" present the valid formats for each component.
The tables provide two display examples, one for March 1, 1990 and another for
November 12, 2051.
Table 6–3, " DATEFORMAT Templates for Week" presents the valid formats for weeks.
The table provides two display examples, one for March 1, 1990 and another for
November 12, 2051.
Note that when you specify a format of <WTXT>, <WTXTL>, <WTEXT>, or <WTEXTL>,
the case in which the value is specified in DAYNAMES affects the displayed value:
■ When the name in DAYNAMES is entered as all lowercase, the entire name is
converted to uppercase. Otherwise, the first letter is converted to uppercase and
the second and subsequent letters remain in their original case.
■ When the name in DAYNAMES is entered as all uppercase, the second and
subsequent letters are converted to lowercase. Otherwise, the entire name remains
in the case specified in DAYNAMES.
Table 6–4, " DATEFORMAT Templates for Month" presents the valid formats for
months. The table provides two display examples, one for March 1, 1990 and another
for November 12, 2051.
Note that when you specify a format of <MTXT> or <MTXTL>, the case in which the
value is specified in MONTHNAMES affects the displayed value:
■ When the name in MONTHNAMES is entered as all lowercase, the entire name is
converted to uppercase. Otherwise, the first letter is converted to uppercase and
the second and subsequent letters remain in their original case.
■ When the name in MONTHNAMES is entered as all uppercase, the second and
subsequent letters are converted to lowercase. Otherwise, the entire name remains
in the case specified in MONTHNAMES.
Table 6–5, " DATEFORMAT Templates for Year" presents the valid formats for years.
The table provides two display examples, one for March 1, 1990 and another for
November 12, 2051.
Notes
Examples
24/03/97
The following statements change the date format to month (text), day (two digits), and
year (four digits), and send the result to the current outfile.
DATEFORMAT = '<MTEXTL> <D>, <YYYY>'
SHOW DATEVAR
The following statements change the date format to day of the week (text), month
(text), day (one or two digits), and year (four digits), and send the result to the current
outfile.
DATEFORMAT = '<WTEXTL> <MTEXTL> <D>, <YYYY>'
SHOW DATEVAR
When today's date is May 30, 1997, the following output is sent to the current outfile
when the program is run.
Hello. Today is Friday, the 30th of May.
DATEORDER
The DATEORDER option holds three characters that indicate the intended order of the
month, day, and year components of the DATE-only values in an analytic workspace
for those cases in which their interpretation is ambiguous. Oracle OLAP automatically
refers to DATEORDER whenever you enter an ambiguous DATE-only value or
convert one from a text value. For information about date values, see "Date-only Data
Type" on page 2-6.
Data Type
ID
Syntax
DATEORDER = order
Arguments
order
One of the following text expressions: 'MDY', 'DMY', 'YMD', 'YDM', 'MYD', 'DYM'.
Each letter represents a component of the date. M stands for the month, D for the day,
and Y for the year. The default date order is 'MDY'.
Notes
Ambiguous Dates
When you enter an unambiguous DATE-only value or convert a text value that has
only one interpretation as a date, it is handled without consulting the DATEORDER
option. For example, in 03-24-97 the 97 can only refer to the year. Considering what
is left, the 24 cannot refer to the month, so it must be the day. Only 03 is left, so it
must be the month. When, however, the interpretation is ambiguous, as in the value
3-5-97, the current value of DATEORDER is used to interpret the meaning of each
component.
a MONTH dimension or its valueset, you can specify a complete date, such as
30jun97, or you can provide only the essential components, such as jun97 or 0697.
Examples
The following statements change the date order, and, therefore, the way the same
value of the DATE-only variable is interpreted.
DATEORDER = 'DMY'
SHOW DATEVAR
DAYABBRLEN
The DAYABBRLEN option specifies the number of characters to use for abbreviations
of day names that are stored in the DAYNAMES option. You can specify how many
characters to use for abbreviating particular day names when you specify the <WT>,
<WTXT>, and <WTXTL> formats with the DATEFORMAT text option.
Data Type
TEXT
Syntax
DAYABBRLEN = specification [;|, specification]...
where specification is a text expression that has the following form:
startpos [- endpos] : length
You can define many different groups of days, each with different abbreviation
lengths. When you do so, separate the groups with a comma or a semicolon as shown
in the syntax.
Arguments
startpos [- endpos]
Numbers that represent the first and last days whose abbreviation length is defined by
length. These numerical positions apply to the corresponding lines of text in the
DAYNAMES option. You can specify these ranges of values in reverse order, endpos
[-startpos], when you prefer.
The DAYNAMES option can have more than seven lines, so you can specify startpos
and endpos greater than seven in the setting of DAYABBRLEN. When you specify a
range where neither startpos nor endpos has a corresponding text value in the
DAYNAMES option, then Oracle OLAP has no text values to abbreviate for that range.
When you later change your day names list so that startpos is valid, the specified
abbreviation is applied.
length
A number that specifies the length in characters (not bytes) of abbreviated day names.
When you do not specify an abbreviation length for a given position in the
DAYNAMES option, or when you explicitly set a given position to zero, Oracle OLAP
uses the default abbreviations of one character for <WT> and three characters for
<WTXT> and <WTXTL>. Oracle OLAP never uses abbreviations when you have
designated the full name specifications <WTEXT> and <WTEXTL>.
Notes
Examples
These statements product the following result, with Tuesday abbreviated to one
character.
T AUGUST 2, 2005
DAYNAMES
The DAYNAMES option holds the list of valid names for the days of the week. The
names are used to display values of type DATE-only or to convert DATE-only values
to text.
Oracle OLAP consults the DAYNAMES list when it displays or converts a date using
the <WT>, <WTXT>, <WTXTL>, <WTEXT>, or <WTEXTL> formats. These formats are
specified in the DATEFORMAT option. When you have more than one set of day
names, Oracle OLAP chooses the synonym whose number of characters and
capitalization pattern best match the DATEFORMAT specification.
Data Type
TEXT
Syntax
DAYNAMES = name-list
Arguments
name-list
A multiline text expression that lists the names of the seven days of the week. Each
name occupies a separate line. Regardless of which day you are treating as the first
day of the week, the list must begin with the name for Sunday. The default value is the
list of English names for the days of the week, in uppercase. You can include more
than one set of seven names in your list. The eighth name is a synonym for the first
name, the ninth name is a synonym for the second name, and so on.
Examples
DECIMALCHAR
(Read-only) The DECIMALCHAR option is the value specified for the NLS_
NUMERIC_CHARACTERS option.
DECIMALCHAR only affects the way Oracle OLAP formats numbers in output. When
you format numbers for input, use a period (.) for the decimal marker. To use a
different decimal marker, enclose the value in single quotes and use the TO_NUMBER
function to convert the value from text to a valid number.
Data Type
ID
Syntax
DECIMALCHAR
Examples
■ With these values, the following statement might produce the output that follows
it.
SHOW TOTAL(sales)
63,181,743.50
DECIMALOVERFLOW
Data Type
BOOLEAN
Syntax
DECIMALOVERFLOW = YES|NO
Arguments
YES
Allows overflow. A calculation that generates overflow will execute without error, and
the results of the calculation will be NA.
NO
(Default) Disallows overflow. A calculation involving overflow will stop executing,
and an error message will be produced.
Examples
DECIMALS
The DECIMALS option controls the number of decimal places that are shown in
numeric output. Values are rounded to fit the specified number of decimal places.
(Note, however, that the setting of DECIMALS does not affect the format of INTEGER
values in output. INTEGER values are shown with no decimal places, unless you
explicitly apply a DECIMAL attribute to them in a HEADING, REPORT, or ROW
command.)
Data Type
INTEGER
Syntax
DECIMALS = n
Arguments
n
An INTEGER expression that specifies the number of decimal places to include in all
output of DECIMAL and SHORTDECIMAL values; n can be any number in the range
0 to 40 or the number 255. (When you set DECIMALS to 255, you are specifying the
formats for values of both SHORTDECIMAL and DECIMAL data types. See
"Comparing 2 Decimal Places with Best Presentation Format" on page 6-31.) The
default is 2.
Examples
DEFAULTAWSEGSIZE
The DEFAULTAWSEGSIZE option holds the default maximum segment size for an
analytic workspace created in your Database session. The setting is in effect for the
duration of your session. For each new session, DEFAULTAWSEGSIZE reverts to the
default value.
Syntax
DEFAULTAWSEGSIZE = n
Arguments
n
A number of bytes.
Examples
DIVIDEBYZERO
The DIVIDEBYZERO option controls the result of division by zero. (Note that division
by zero includes raising zero to a negative power; for example, 0 ** -2.)
Data Type
BOOLEAN
Syntax
DIVIDEBYZERO = YES|NO
Arguments
YES
Allows division by zero. A statement involving division by zero will execute without
error; however, the result of the division by zero will be NA. When you are dividing by
a dimensioned variable or expression, setting DIVIDEBYZERO to YES enables you to
get results for most of the expression's values when a few calculations might involve
dividing by zero.
NO
(Default) Disallows division by zero. A statement involving division by zero will stop
executing and produce an error message.
Examples
When you change DIVIDEBYZERO to YES, the same statement executes without error
and produces NA as the result of the division. The statements
DIVIDEBYZERO = YES
SHOW 100 / 0
DSECONDS
(Read-only) The DSECONDS option returns the elapsed time as a DECIMAL value.
When Oracle is installed on UNIX, the DSECONDS option is the elapsed number of
seconds since Oracle was started. When Oracle is installed on Windows, the
DSECONDS option is the elapsed number of seconds since the machine on which
Oracle is installed was rebooted. As an aid to enhancing a program's speed,
DSECONDS can be used to determine how much time elapses while the program is
running.
Data Type
DECIMAL
Syntax
DSECONDS
Examples
ECHOPROMPT
The ECHOPROMPT option determines whether or not input lines and error messages
should be echoed to the current outfile. When ECHOPROMPT is set to YES and you
have specified a debugging file with DBGOUTFILE, the input lines and error messages
are echoed to the debugging file instead of the current outfile.
Data Type
BOOLEAN
Syntax
ECHOPROMPT = {YES|NO}
Arguments
YES
Input lines and error messages are echoed to the current outfile or the debugging file
specified by DBGOUTFILE.
NO
(Default) Input lines and error messages do not appear in the current outfile or in the
debugging file.
Examples
EIFBYTES
(Read-only) The EIFBYTES option holds the number of bytes read by the most recent
IMPORT (EIF) command or written by the most recent EXPORT (EIF) command.
Data Type
INTEGER
Syntax
EIFBYTES
Examples
EIFEXTENSIONPATH
The EIFEXTENSIONPATH option contains a list of directory objects that identify the
locations where EIF extension files should be created.
Data Type
TEXT
Syntax
EIFEXTENSIONPATH = path-expression
Arguments
path-expression
A text expression that contains one or more directory object names. When you specify
multiple aliases, you must enter each one on a separate line. Specify multiple aliases in
the order in which they should be used for storing EIF extension files.
Notes
Examples
EIFNAMES
The EIFNAMES option holds a list of the names of all the objects imported by the most
recent IMPORT (EIF) command.
Data Type
TEXT
Syntax
EIFNAMES
Examples
EIFSHORTNAMES
The EIFSHORTNAMES option controls the structure of the extension of EIF overflow
(extension) file names.
Data Type
BOOLEAN
Syntax
EIFSHORTNAMES = YES|NO
Arguments
YES
Sets the extension of EIF overflow (extension) file names to xx, where each x is an
automatically assigned lowercase letter between a and z.
NO
(Default) Sets the extension of EIF overflow (extension) file names have the structure
filename.ennn, where nnn is a three-digit number beginning with 001, to distinguish
them from workspace extension file names. For example, when an EIF file is named
export.eif, the extension files are named export.e001, export.e002, and so on,
Examples
EIFTYPES
The EIFTYPES option holds a list of the types of objects that are contained in the list
produced by the EIFNAMES option. The types are listed in the same order as the
corresponding object names in the EIFNAMES list.
Data Type
TEXT
Syntax
EIFTYPES
Examples
Send the names of the imported objects to the current outfile with this statement
SHOW EIFNAMES
Send the types of the imported objects to the current outfile with this statement
SHOW EIFTYPES
EIFUPDBYTES
The EIFUPDBYTES option controls the frequency of updates when you are using the
IMPORT (EIF) command with its UPDATE keyword. The value of EIFUPDBYTES has
an effect only when the UPDATE keyword is specified in this command.
Data Type
INTEGER
Syntax
EIFUPDBYTES = n
Arguments
n
An INTEGER expression that specifies the minimum number of bytes to be read
between updates, during an import. When EIFUPDBYTES has a value of 0, an update
is triggered after each analytic workspace object is imported. When EIFUPDBYTES has
a value greater than 0, an update is triggered each time the specified number of bytes
is imported. The default is 0 (zero).
Examples
EIFVERSION
The EIFVERSION option is used with the EXPORT (EIF) and IMPORT (EIF)
commands to copy data between different versions of Express® Server or Oracle
OLAP. The version from which the data is exported is referred to as the source. The
version to which the data is imported is referred to as the target.
Before you use the EXPORT command to export data to an EIF file, you use the
EIFVERSION option to specify the internal version or build number of the target.
Then, when you use EXPORT to copy data from the source to an EIF file, the data will
be in a format that can be imported by the target. Generally, you can import data from
an EIF file into any target that has a later version number than the one you specify for
the EIF file with EIFVERSION. However, when you set EIFVERSION to a value that is
lower than the default version (that is, the version number of the current process), and
you try to export data that the earlier version cannot manage, an error is generated.
For example, when you try to export an aggmap to a 6.2 version of Express Server, an
error is generated because Express Server 6.2 cannot manage aggmap.
You can use the EVERSION function to determine the internal version or build
number of the target.
Syntax
EIFVERSION = n
Arguments
n
The internal version or build number of an Express Server or Oracle OLAP process.
This is the target into which you want the data imported.
By default, EIFVERSION is set to the internal version or build number of the current
process.
Examples
The following statements export the data from Oracle OLAP (which has a higher build
number than 60232) to an EIF file that can be read in Express 6.2.0
EIFVERSION = 60232
EXPORT ALL TO EIF FILE 'myeif.eif'
ERRNAMES
The ERRNAMES option controls whether the value of the ERRORTEXT option
contains the name of the error (that is, the value of the ERRORNAME option) as well
as the text of the error message.
Data Type
BOOLEAN
Syntax
ERRNAMES = {NO|YES}
Arguments
NO
ERRORTEXT contains only the text of the error message.
YES
(Default) ERRORTEXT contains the name and the text of the error message.
Examples
When the value of ERRNAMES is set to YES, the program returns the following value
for ERRORTEXT.
ERROR: (MXXEQ01) A division by zero was attempted. (If you want NA to
be returned as the result of a division by zero, set the DIVIDEBYZERO
option to YES.)
When the value of ERRNAMES is set to NO, the program returns the following value
for ERRORTEXT.
ERROR: A division by zero was attempted. (If you want NA to be
returned as the result of a division by zero, set the DIVIDEBYZERO
option to YES.)
ERRORNAME
The ERRORNAME option holds the name of the first error that occurs when you
execute a program or when you execute an OLAP DML statement.
Data Type
TEXT
Syntax
ERRORNAME
Notes
Examples
ERRORTEXT
The ERRORTEXT option holds the text of the first error message that occurs when you
execute a program or a statement. The name of the error whose message is found in
ERRORTEXT is contained in the ERRORNAME option.
Data Type
TEXT
Syntax
ERRORTEXT
Examples
ESCAPEBASE
The ESCAPEBASE option specifies the type of escape that is produced by the INFILE
keyword of the CONVERT function.
Syntax
ESCAPEBASE = 'escape-type'
Arguments
escape-type
Specify 'd' for decimal escape, 'x' for hexadecimal escape.
The default escape type is decimal, which produces the INTEGER value for a character
in the following form.
'\dnnn'
A hexadecimal escape is the INTEGER value for a character in the following form.
'\xnn'
Examples
For an example of using ESCAPEBASE with CONVERT to convert a text value to an
escape sequence, see Example 7–50, "Converting Text Values to Escape Sequences" on
page 7-89.
EXPTRACE
The EXPTRACE option controls whether OLAP DML programs in the analytic
workspace named EXPRESS are traced when the PRGTRACE option is set to YES. The
EXPRESS analytic workspace is always attached and contains, among other things,
OLAP DML programs documented as OLAP DML statements and other "helper"
OLAP DML programs.
Data Type
BOOLEAN
Syntax
EXPTRACE = {YES|NO}
Arguments
YES
All programs are traced, including OLAP DML programs provided as OLAP DML
statements.
NO
(Default) OLAP DML programs provided as OLAP DML statements are not traced.
Only other types of programs are traced.
Notes
Examples
INF_STOP_ON_ERROR
Syntax
INF_STOP_ON_ERROR = {YES|NO}
Arguments
YES
When an error occurs, report the error and stop reading from the file.
NO
When an error occurs, report the error and continue reading from the file.
Examples
Assume that the myaw workspace is not attached when a SQL application issues the
DBMS_AW.EXECUTE statement with an OLAP DML INFILE statement to read the
attachmyaw.infinfile file.
When the INF_STOP_ON_ERR option is set to NO then the error Analytic
workspace MYAW is not attached is reported, Oracle OLAP continues to read
the file, and the DBMS_AW.EXECUTE procedure completes successfully.
DBMS_AW.EXECUTE('INF_STOP_ON_ERR = NO ');
DBMS_AW.EXECUTE('INFILE attachmyaw.inf');
When the INF_STOP_ON_ERR option is set to YES then the error Analytic
workspace MYAW is not attached is reported, Oracle OLAP stops reading the
file, and the DBMS_AW.EXECUTE procedure aborts.
DBMS_AW.EXECUTE('INF_STOP_ON_ERR = YES ');
DBMS_AW.EXECUTE('INFILE attachmyaw.inf');
LCOLWIDTH
The LCOLWIDTH option controls the default width of the label column in reports. For
output from ROW command and HEADING, LCOLWIDTH affects the first column.
For output from REPORT, LCOLWIDTH affects the first column except when the first
column is a data column or part of a set of columns that represent the base dimensions
of a composite or a conjoint dimension.
Data Type
INTEGER
Syntax
LCOLWIDTH = n
Arguments
n
An INTEGER expression that specifies the desired column width in number of
characters. You can set LCOLWIDTH to any value from 1 to 4000. The default is 14.
Examples
LIKECASE
The LIKECASE option controls whether the LIKE operator is case sensitive.
Data Type
BOOLEAN
Syntax
LIKECASE = {YES|NO}
Arguments
YES
(Default) Specifies that the LIKE operator is case sensitive.
NO
Specifies that the LIKE operator is not case sensitive.
Examples
The statements
LIKECASE = NO
SHOW 'ORACLE' like 'orc%'
LIKEESCAPE
The LIKEESCAPE option lets you specify an escape character for the LIKE operator.
Data Type
ID
Syntax
LIKEESCAPE = char
Arguments
char
A text expression that specifies the character to use as an escape character in a LIKE
text comparison. The default is no escape character.
The LIKE escape character affects the LISTNAMES program, which accepts a LIKE
argument that it uses in a LIKE text comparison.
Notes
Examples
prodstat(product 'Footwear') = -
'When are the new styles going to be ready?'
Suppose you have the following program, named findeschar, to find certain
characters in the text contained in the cells of the prodstat variable. The program
uses the LIKE operator.
ARGUMENT findstring TEXT
FOR product
IF prodstat LIKE findstring
THEN SHOW JOINCHARS(product ' - ' prodstat)
Before the program can find a text value that contains a percent character (%) or an
underscore (_), you must specify an escape character by using the LIKEESCAPE
option. Suppose you want to use a question mark (?) as the escape character. Before
you set the escape character to a question mark, the following statement finds text that
contains a question mark.
CALL findeschar('%?%') "Find any text that contains a question mark.
The following statements specify the question mark (?) as the escape character and
then call the FINDESCHAR program.
LIKEESCAPE = '?'
CALL findeschar('%?%') "Find any text that ends with a percent character.
The preceding statement does not find any text because none of the text values in
prodstat ends in a percent character. To find any text that contains a percent
character, the following statement adds another wildcard character. LIKEESCAPE
interprets the first percent character as the wildcard that matches zero or more
characters, the second percent character as the literal percent character (%) because it is
preceded by the question mark escape character, and the third percent character as
another wildcard character. The result is that LIKEESCAPE looks for a percent
character preceded by and followed by zero or more characters.
CALL findeschar('%?%%') "Find any text that contains a percent character.
The following statement doubles the escape character to find text that contains the
escape character.
CALL findeschar('%??%') "Find any text that contains a question mark.
LIKENL
The LIKENL option controls whether the LIKE operator recognizes newline characters
between lines of a text expression, when deciding whether a text value is like a text
pattern. (In the OLAP DML, the representation of a newline character is "\n".)
The LIKENL option applies to the text expressions on either side of the LIKE operator.
Data Type
BOOLEAN
Syntax
LIKENL = {YES|NO}
Arguments
YES
(Default) Specifies that the LIKE operator recognizes newline characters between lines
of a text expression.
NO
Specifies that the LIKE operator ignores newline characters between lines of a text
expression. Newline characters are ignored in both of the expressions being compared.
Examples
■ The statements
LIKENL = YES
SHOW textvar LIKE '%low%'
■ The statement
SHOW 'Hello\nworld' LIKE '%\n%'
■ The statement
■ The statements
LIKENL = NO
SHOW textvar LIKE '%low%'
■ The statement
SHOW 'Hello\nworld' LIKE '%\n%'
■ The statement
SHOW 'Hello\nworld' LIKE '%low%'
LIMIT.SORTREL
The LIMIT.SORTREL option controls whether or not a sort is done when you limit a
dimension to a related dimension.
Data Type
BOOLEAN
Syntax
LIMIT.SORTREL = {YES|NO}
Arguments
YES
(Default) Oracle OLAP performs a sort when you limit a dimension to a related
dimension.
NO
Oracle OLAP does not perform a sort when limiting to a related dimension.
Notes
Examples
LIMITSTRICT
The LIMITSTRICT option is a BOOLEAN option that determines how Oracle OLAP
behaves when a list of values in a LIMIT command, a LIMIT function, or a QDR
contains a nonexistent value.
Syntax
LIMITSTRICT = YES | NO
Arguments
YES
(Default) When a list of values in a LIMIT command, a LIMIT function, or a QDR
contains a nonexistent value, Oracle OLAP stops executing the limit and issues an
error.
NO
When a list of values in a LIMIT command, a LIMIT function, or a QDR contains a
nonexistent value, Oracle OLAP processes the limit while treating the specified value
as an NA.
Examples
PROD
--------------
Radios
TVs
YEAR
--------------
2003
2004
--------SALES--------
--------PROD---------
YEAR Radios TVs
-------------- ---------- ----------
2003 2,459 3,534
2004 3,366 3,018
When LIMITSTRICT is set to YES, then Oracle OLAP treats requests to limit by the
nonexistent prod value of 'IDontExist', as a request to limit by an invalid value:
■ Limiting prod to just nonexistent value, results in the error message ORA-34706
and does not change the values in status for prod.
->REPORT prod
PROD
--------------
Radios
TVs
■ Limiting prod to a list of values that includes the nonexistent value results in the
error message ORA-34706 and does not change the values in status for prod
->LIMIT prod to 'Idontexist' 'Radios'
ORA-34706: Idontexist is not a valid TESTLIMITSTRICT!PROD.
->REPORT prod
PROD
--------------
Radios
TVs
■ Specifying a nonexistent prod value in a QDR for sales also results in the error
message ORA-34706.
->REPORT sales (year '2004'prod 'IDontExist')
ORA-34706: IDontExist is not a valid TESTLIMITSTRICT!PROD.
->REPORT prod
PROD
--------------
Radios
TVs
■ Limiting prod to a list of values that includes a nonexistent value does not result
in an error message. Instead, prod is limited to the existing values.
->LIMIT prod to 'Idontexist' 'Radios'
->REPORT prod
PROD
--------------
Radios
■ Specifying a nonexistent prod value in a QDR for sales does not result in an
error message. Instead, a report of sales displays an NA value.
->REPORT sales (year '2004'prod 'IDontExist')
----------
NA
LINENUM
The LINENUM option contains the current line number of the output. Its value is
incremented automatically as output lines are produced. The LINENUM option is
meaningful only when PAGING is set to YES and only for output from commands
such as REPORT and LISTNAMES.
Data Type
INTEGER
Syntax
LINENUM = n
Arguments
n
An INTEGER expression. Normally you do not want to set LINENUM explicitly, but
just want to check its current value.
Notes
Examples
LINESLEFT
(Read-only) The LINESLEFT option contains the number of lines left on the current
page. The LINESLEFT option is meaningful only when PAGING is set to YES and only
for output from commands such as REPORT and LISTNAMES.
Data Type
INTEGER
Syntax
LINESLEFT
Notes
Examples
LOCK_LANGUAGE_DIMS
Data Type
BOOLEAN
Syntax
LOCK_LANGUAGE_DIMS= TRUE | FALSE
Arguments
TRUE
Specifies that Oracle OLAP returns an error if a LIMIT statement tries to limit the
status of a language dimension.
When a program changes the value the LOCK_LANGUAGE_DIMS option from
FALSE to TRUE, Oracle OLAP resets the status of the language dimension in any
attached analytic workspace according to the value of the SESSION_NLS_
LANGUAGE option.
FALSE
Sets the status of the language dimension to ALL, and specifies that programs can
modify the status of the language dimension using LIMIT.
When a program changes the value the LOCK_LANGUAGE_DIMS option from TRUE
to FALSE, Oracle OLAP resets the status of the language dimension in any attached
analytic workspace to ALL.
Examples
MYLANGS
--------------
FRENCH
AMERICAN
Assume also, as shown by the following report, that when you attach the analytic
workspace that the status of mylangs is American.
REPORT mylangs
MYLANGS
--------------
AMERICAN
As the following code illustrates, you can explicitly change the status of mylangs to
French using LIMIT if you first set the value of LOCK_LANGUAGE_DIMS to FALSE.
You cannot use LIMIT against a language dimension when the value of LOCK_
LANGUAGE_DIMS has its default value of TRUE.
" Try to LIMIT mylangs
LSIZE
The LSIZE option defines the line size within which the STDHDR program centers the
standard header. LSIZE can be set in the initialization section of a report program.
Data Type
INTEGER
Syntax
LSIZE = n
Arguments
n
An INTEGER expression that specifies the line size within which the STDHDR
program centers the standard header, or the maximum line size for output from a
HEADING statement. The default is 80 characters for a line.
The maximum width of any line in a report, including a heading line, is 4000
characters. Therefore, it generally makes sense to set LSIZE to a value of 4000 or less
Notes
Examples
PAGEPRG = 'stdhdr'
LSIZE = 50
PAGING = YES
PAGE
HEADING WIDTH LSIZE CENTER 'Quarterly Sales'
Quarterly Sales
MAXFETCH
The MAXFETCH option sets an upper limit on the size of a data block generated by a
FETCH statement specified in the OLAP_command parameter of the OLAP_TABLE
function.
Return Value
INTEGER
Syntax
MAXFETCH = integer-expression
Arguments
integer-expression
An INTEGER expression representing the maximum size in bytes of a data block
generated by FETCH. The minimum value for MAXFETCH is 1K (approximately 1,000
bytes), and the maximum value is 2GB (approximately 2,000,000,000 bytes). The
default value of MAXFETCH is 256K.
Notes
Examples
MODDAMP
The MODDAMP option specifies a weighting factor that damps out oscillations
between iterations when you use the Gauss-Seidel method for solving simultaneous
equations in a model. MODDAMP can allow the solution of models that would
otherwise never converge because the oscillation between equations is stable. In these
cases, the oscillations never decay without damping.
With the Gauss-Seidel method, Oracle OLAP tests each model equation for
convergence or divergence in each iteration over a block of simultaneous equations.
The tests are made by comparing the results of the current iteration to the results from
the previous iteration. When MODDAMP specifies a weighting factor that is greater
than zero, the value that Oracle OLAP tests and stores after each iteration is a
weighted average of the current and previous results. For equations that oscillate
between iterations, you can therefore use MODDAMP to damp out the oscillations
and either prevent divergence or speed up the convergence of the equations.
Data Type
DECIMAL
Syntax
MODDAMP = {n|0.00}
Arguments
n
A decimal value, greater than or equal to zero and less than one, that specifies the
weighting factor. The closer MODDAMP is to 0.00, the more weight is given to the
value from the current iteration. The default value is 0.00, which gives full weight to
the current iteration.
When MODDAMP is greater than zero, Oracle OLAP calculates the weighted average
for the current iteration as follows.
calcvalue * (1 - MODDAMP) + weightavg
where:
■ calcvalue is the value calculated from the model equation in the current iteration.
■ weightavg is the weighted average calculated in the previous iteration.
See "Stored Weighted Average" on page 6-72.
Notes
that do not oscillate, convergence is slowed down when the value of MODDAMP is
greater than zero. Therefore, when your model contains some equations that oscillate
and some that do not, you might be able to speed up overall convergence by setting
MODDAMP to a small nonzero value, such as 0.20. A small nonzero value will slow
down the convergence of non-oscillating equations only slightly, while speeding up
the convergence of oscillating equations.
Examples
...
(MOD= INCOME.BUD) BUDGET (LINE REVENUE MONTH 'JAN97' ITER 37) = 368.718556135
...
(MOD= INCOME.BUD) BUDGET (LINE REVENUE MONTH 'JAN97' ITER 38) = 369.149674626
...
(MOD= INCOME.BUD) BUDGET (LINE REVENUE MONTH 'JAN97' ITER 39) = 368.771110244
...
(MOD= INCOME.BUD) BUDGET (LINE REVENUE MONTH 'JAN97' ITER 40) = 369.103479583
(MOD= INCOME.BUD) END BLOCK 1
The MODDAMP option is set to its default value of 0.00. The equation for the Revenue
line item converged in 40 iterations over a block of simultaneous equations. In the
trace lines, you can see the results that were calculated for the Revenue line item in the
final 6 iterations.
In "Using the Default MODDAMP Value" on page 6-72, the equation for the Revenue
line item converged in 40 iterations. With MODDAMP set to 0.2 in the current
example, the same equation converged in just 6 iterations.
MODERROR
The MODERROR option determines the action that Oracle OLAP takes when a block
of simultaneous equations in a model cannot be solved within a specified number of
iterations.
Data Type
ID
Syntax
MODERROR = {'STOP'|'CONTINUE'}
Arguments
'STOP'
(Default) Oracle OLAP sends an error message to the current outfile and stops
executing the model.
'CONTINUE'
Oracle OLAP sends a warning message to the current outfile, stops executing the
current block, and resumes execution at the next block in the model.
Notes
Block-Solution Failure
When every equation in a simultaneous block passes a convergence test, the block is
considered solved. When any equation diverges or fails to converge within a specified
number of iterations, the solution of the block fails and an error occurs. MODERROR
controls the action that Oracle OLAP takes when an error occurs.
Using 'STOP'
When MODERROR is set to STOP and execution of the model halts because of an
error, you can run the MODEL.XEQRPT program to produce a report about the
execution of the model. The report specifies the block where the solution failed and
shows the values of the model options that were used in solving simultaneous blocks.
Using 'CONTINUE'
When MODERROR is set to CONTINUE and one of the blocks in the model is a
simultaneous block that either diverges or fails to converge, Oracle OLAP executes
any remaining blocks in the model.
Moreover, Oracle OLAP executes the model for the remaining values in the status of
any additional dimensions of the solution variable that are not dimensions of the
model. In this case, when you run the MODEL.XEQRPT program when Oracle OLAP
finishes executing the model, you will see a report on the solution for the final values
of the additional dimensions.
When the simultaneous blocks in the model converged when the model was executed
for the final values of the additional dimensions, then MODEL.XEQRPT will report that
the blocks were solved, even though an earlier execution of the model for another
dimension value might have failed. When you wish to see the MODEL.XEQRPT for the
dimension values where the failure occurred, you can set MODERROR to STOP and
rerun the model.
Examples
When the simultaneous block fails to converge, you can type an Oracle OLAP or
debugger command in the Command Input window in OLAP Worksheet. Since the
solution variable, actual, is dimensioned by division, you might want to display
the current value of division.
SHOW division
Camping
MODGAMMA
The MODGAMMA option specifies a value to use in testing how much an equation in
a simultaneous block of a model is changing between iterations. MODGAMMA
controls the degree to which the test compares the absolute amount of the change
between iterations versus the proportional change. MODGAMMA is especially
important in testing equations that result in very small values.
Data Type
INTEGER
Syntax
MODGAMMA = {n|1}
Arguments
n
An INTEGER value to use in testing for convergence and divergence. As Oracle OLAP
calculates each equation in a simultaneous block, it constructs a comparison value that
is based on the results of the equation for the current iteration and the previous
iteration. When the comparison value passes a tolerance test, the equation is
considered to have converged. When the comparison value meets an overflow test, the
equation is considered to have diverged.
The comparison value that is tested is as follows.
(thisResult - prevResult) DIVIDED BY (prevResult PLUS MODGAMMA)
where thisResult is the result of this iteration and prevResult is the result of the previous
iteration.
Oracle OLAP calculates the absolute value of the enclosed expression. The default
value of MODGAMMA is 1.
Notes
Testing Convergence
In the test for convergence, the MODTOLERANCE option determines how closely the
results of an equation must match between successive iterations. With the default
value of 3 for MODTOLERANCE, the equation is considered to have converged when
the comparison value is less than 0.001.
Testing Divergence
In the test for divergence, the MODOVERFLOW option determines how dissimilar the
results of an equation must be in successive iterations. With the default value of 3 for
MODOVERFLOW, the equation is considered to have diverged when the comparison
value is greater than 1000.
Comparison Value
The comparison value that Oracle OLAP evaluates in tests of convergence and
divergence is fundamentally a proportional value. It expresses the change between
iterations as a proportion of the previous results. In the test for convergence, the
change between iterations must be small in proportion to the previous results. In the
test for divergence, the change between iterations must be large in proportion to the
previous results. By testing a proportional value, rather than testing the absolute
amount of change, Oracle OLAP can apply the same test criteria to all equations,
regardless of the magnitude of the equation results.
However, the comparison value that Oracle OLAP tests is not strictly proportional.
When the results of an equation are very close to zero, the denominator of a strictly
proportional comparison value would also be very close to zero, and thus the
comparison value itself would generally be large. Therefore, the test for convergence
would be difficult to satisfy, while the test for divergence would be easy to meet. To
solve this problem, Oracle OLAP adds the value of MODGAMMA to the denominator
of the comparison value. When the default value of 1 is used for MODGAMMA, the
effect of MODGAMMA is as follows:
■ When the equation results are close to zero, the denominator is close to one and
the test is essentially a test of the absolute change between iterations.
■ When the equation results are very large, the effect of adding MODGAMMA to
the denominator is negligible, and the test is close to being a strictly proportional
test.
Examples
In the trace, you can see the results that were calculated for the NET.INCOME line
item in the final six iterations over a block of simultaneous equations.
The value of MODTOLERANCE is its default value of 3. This means that for an
equation to pass the convergence test, its comparison value must be less than .001.
MODGAMMA is set to its default value of 1. The equation for the NET.INCOME line
item passed the convergence test in the twenty-first iteration. The comparison value
for Net.Income in the twenty-first iteration was calculated as follows.
(0.024608562967 - 0.025501664970 = 0.00087) / (0.025501664970 + 1)
MODINPUTORDER
Data Type
BOOLEAN
Syntax
MODINPUTORDER = {YES|NO}
Arguments
YES
The equations in a simultaneous block of a model are executed in the order in which
they appear in the model.
NO
(Default) The equations in a simultaneous block are executed in an order determined
by the model compiler.
Examples
The following statements compile the model and produce a compilation report using
the MODEL.COMPRPT program.
COMPILE income.calc
MODEL.COMPRPT income.calc
When you compile income.calc with MODINPUTORDER set to its default value of
NO, you can see that the compiler reverses the order of the equations in the
simultaneous block.
You can see that the compiler leaves the simultaneous equations in the order in which
you placed them.
MODMAXITERS
See also: "Model Options" on page 6-5 for descriptions of all of the
options that control the solution of simultaneous blocks, and
Data Type
INTEGER
Syntax
MODMAXITERS = {n|50}
Arguments
n
A positive INTEGER value that indicates the maximum number of iterations Oracle
OLAP should perform in attempting to solve a simultaneous block. The default is 50.
Notes
Examples
MODOVERFLOW
See: "Model Options" on page 6-5 for a list of all of the options that
control the solution of simultaneous blocks.
Data Type
INTEGER
Syntax
MODOVERFLOW = {n|3}
Arguments
n
An INTEGER value to use in testing for divergence. As Oracle OLAP calculates each
equation in a simultaneous block, it constructs a comparison value that is based on the
results of the equation for the current iteration and the previous iteration. When the
comparison value meets a divergence test, the equation is considered to have
diverged.
The comparison value that is tested is as follows.
(thisResult - prevResult) / (prevResult + MODGAMMA)
where thisResult is the result of this iteration and prevResult is the result of the previous
iteration
In the preceding calculation, MODGAMMA is an INTEGER option that controls the
degree to which the comparison value represents the absolute amount of change
between iterations versus the proportional change. The default value of
MODGAMMA is 1.
In the divergence test, Oracle OLAP tests whether the comparison value is greater
than 10 to the power of MODOVERFLOW. The calculation for this test is as follows.
Comparison value > 10**MODOVERFLOW
For the equation to be considered to have diverged, the comparison value must meet
the test described earlier. The default value of MODOVERFLOW is 3. With this
default, the comparison value meets the test when it is greater than 1000.
Notes
Equation Divergence
When an equation diverges, an error occurs. The MODERROR option controls the
action that Oracle OLAP takes when an error occurs.
Examples
In the trace, you can see the results that were calculated for the Selling line item in
the first three iterations and the forty-ninth and fiftieth iterations over a block of
simultaneous equations. The block failed to converge after 50 iterations.
The value of MODOVERFLOW is its default value of 3. This means that for an
equation to meet the divergence test, its comparison value must be greater than 1000.
With MODOVERFLOW set to 2, any comparison value of more than 100 meets the test
for divergence. In this example, the equation for Selling meets the test in the second
iteration. In the second iteration, Oracle OLAP calculates the comparison value for
Selling as follows.
(-997 - 3) / (3 + 1) = 250
Since this comparison value is greater than 100, the equation for Selling diverges in
the second iteration.
MODSIMULTYPE
The MODSIMULTYPE option specifies the method to use for solving simultaneous
blocks in a model.
See: "Model Options" on page 6-5 for a list of all of the options that
control the solution of simultaneous blocks.
Data Type
ID
Syntax
MODSIMULTYPE = {'AITKENS'|'GAUSS'}
Arguments
'AITKENS'
(Default) Oracle OLAP uses the Aitkens delta-squared solution method. In the first
two of every three iterations over a block of simultaneous equations, the equations are
solved using the values from the previous iteration, and the results are tested for
convergence and divergence. In every third iteration, the results are obtained not by
solving the equations, but by making a next-guess calculation. This calculation uses
the results of the previous three iterations. The results of the guesses are not tested for
convergence and divergence, and the solution always continues to the next iteration.
'GAUSS'
Oracle OLAP uses the Gauss-Seidel solution method. Equations in a simultaneous
block are solved in each iteration over the block. The results are tested for convergence
and divergence in each iteration.
Notes
Next-Guess Calculation
The Aitkens method requires three values to perform a next-guess calculation.
Therefore, in the first three iterations over a simultaneous block, Oracle OLAP solves
the equations. The fourth iteration is a next-guess iteration that uses the results from
the first three iterations in its calculation.
Memory Required
The Aitkens method usually speeds convergence, and it generally produces more
accurate results than the Gauss-Seidel method. However, the Aitkens method requires
more memory because the results of three previous iterations are stored.
In general, you should use the Aitkens method. You should use the Gauss-Seidel
method only when limited memory is a problem on your system.
Function Problems
A simultaneous equation might fail to converge when it contains a function that
produces rounded values (such as INSTRB or ROUND) or when it contains a function
that introduces discontinuities in the data (such as MAX or MIN).
Starting-Value Problems
The solution of a simultaneous block is sensitive to starting values. For example, when
a model has a proportional relationship between two model values, then starting
values close to zero will inhibit convergence. You should thus attempt to use starting
values that are reasonable for the equations being solved.
Order of Equations
The solution of a simultaneous block is also sensitive to the order of the equations.
When you compile a model, the model compiler determines an optimal equation order
that is based on the dependencies among the equations.
To force the equations in a simultaneous block to be solved in a particular order, you
can write the equations in the desired order and set the MODINPUTORDER option to
YES before compiling the model. When MODINPUTORDER is YES, the model
compiler leaves the equations in a simultaneous block in the order in which they
appear in the model.
By placing simultaneous equations in a particular order and setting
MODINPUTORDER to YES before compiling the model, you might be able to
encourage convergence in some models. In general, however, it is preferable to rely on
the model compiler to order the equations.
Examples
MODTOLERANCE
Data Type
INTEGER
Syntax
MODTOLERANCE = {n|3}
Arguments
n
An INTEGER value to use in testing for convergence. As Oracle OLAP calculates each
equation in a simultaneous block, it constructs a comparison value that is based on the
results of the equation for the current iteration and the previous iteration. When the
comparison value passes a tolerance test, the equation is considered to have
converged.
The comparison value that is tested is as follows.
(thisResult - prevResult) / (prevResult+ MODGAMMA)
where thisResult is the result of this iteration and prevResult is the result of the previous
iteration
In the preceding calculation, MODGAMMA is an INTEGER option that controls the
degree to which the comparison value represents the absolute amount of change
between iterations versus the proportional change. The default value of
MODGAMMA is 1.
In the tolerance test, Oracle OLAP tests whether the comparison value is less than 10
to the negative power of MODTOLERANCE. The calculation for this test is as follows.
Comparison value < 10**-MODTOLERANCE
For the equation to be considered to have converged, the comparison value must meet
the test described earlier. The default value of MODTOLERANCE is 3. With this
default, the comparison value meets the test when it is less than 0.001.
Notes
Failure to Converge
When an equation fails to converge after a specified number of iterations, an error
occurs. The MODMAXITERS option controls the maximum number of iterations that
are attempted. The MODERROR option controls the action that Oracle OLAP takes
when an error occurs.
Precision of Results
Since MODTOLERANCE controls how closely results of an equation must match
between iterations, it therefore controls the precision of the results of the solution. A
small value of MODTOLERANCE will result in less precision, while a large value will
provide more precision.
Examples
In the trace, you can see the results that were calculated for the Marketing line item
in the final three iterations over a block of simultaneous equations.
MODTOLERANCE is set to its default value of 3. This means that for an equation to
pass the convergence test, its comparison value must be less than 0.001. In the
seventh iteration, Oracle OLAP calculates the comparison value for Marketing as
follows.
This comparison value is greater than 0.001, so it did not pass the test for
convergence.
In the eighth iteration, Oracle OLAP calculated the comparison value as follows.
(73446.025848156700 - 73474.784648631100) /(73474.784648631100 + 1) = 0.0004
Since this comparison value is less than 0.001, it passed the convergence test.
With MODTOLERANCE set to 2, any comparison value of less than 0.01 will pass
the test for convergence. In this example, the equation for Marketing passes the test
in the seventh iteration.
MODTRACE
Tip: The INFO function lets you obtain specific items of information
about the structure of the compiled model and the solution status of a
model you have run. See INFO (MODEL).
Data Type
BOOLEAN
Syntax
MODTRACE = {YES|NO}
Arguments
YES
Oracle OLAP sends the text of each model equation to the current outfile before
calculating the model equation, and then sends the results of the calculation to the
current outfile.
When you have used a DBGOUTFILE statement to specify a debugging file, Oracle
OLAP sends MODTRACE output to the debugging file instead of the current outfile.
NO
(Default) Oracle OLAP does not send the text of model equations and results to a file
while a model executes.
Notes
■ Iteration. These lines occur in simultaneous blocks and specify the number of the
iteration that is about to be performed for the current block. When you are using
the Aitkens solution method, the next-guess iterations are identified. (The
MODSIMULTYPE option determines the solution method being used.)
■ Equation. The equation that is about to be calculated.
■ Results. A results line follows each equation line and shows the results assigned by
the equation. It shows the variable to which the results were assigned and the
current value of each model dimension. In a simultaneous block, it also shows the
current iteration number. For example, when actual is the solution variable and
the model dimensions are line and month, a results line in a simultaneous block
might look like the following one.
(MOD= INCOME.CALC) ACTUAL (LINE OPR.INCOME MONTH 'JAN96'
ITER 1) = 108.9600000
Examples
This model estimates budget line items on an income statement. The model equations
are based on a line dimension. The following statements compile the model and run
the MODEL.COMPRPT program.
COMPILE income.budget
MODEL.COMPRPT income.budget
When you want to debug this model, you can trace its execution, line by line, by
turning on MODTRACE before running the model.
The following statements limit dimensions, specify tracing, and run the model.
LIMIT month TO 'Jan97' TO 'Mar97'
LIMIT division TO 'Camping'
MODTRACE = YES
income.budget budget
In Block 1, which is a simple block, Oracle OLAP solved the equations one at a time,
looping over the three values in the status of month as it solved each equation. In
Block 2, which is a step-forward block over the month dimension, Oracle OLAP
stepped over the values in the status of month, solving all the equations in the block
for each month in turn.
MONTHABBRLEN
Data Type
TEXT
Syntax
MONTHABBRLEN = specification [;|, specification]...
where specification is a text expression that has the following form:
startpos [ - endpos] : length
Arguments
startpos [-endpos]
Numbers that represent the first and last months whose abbreviation length is defined
by length. These numerical positions apply to the corresponding lines of text in the
MONTHNAMES option. You can specify these ranges of values in reverse order,
endpos [-startpos], if you prefer.
The MONTHNAMES option can have more than 12 lines, so you can specify startpos
and endpos greater than 12 in the setting of MONTHABBRLEN. When you specify a
range where neither startpos nor endpos has a corresponding text value in the
MONTHNAMES option, MONTHABBRLEN has no text values to abbreviate for that
range. When you later change your month names list so that startpos is valid, the
specified abbreviation is applied.
length
A number that specifies the length in characters (not bytes) of abbreviated month
names. When you do not specify an abbreviation length for a given position in the
MONTHNAMES option, or when you explicitly set a given position to zero, the
default abbreviation is used. The default abbreviations are one character for <MT> and
three characters for <MTXT> and <MTXTL>. Abbreviations are never used when you
have designated the full name specifications <MTEXT> and <MTEXTL>.
Notes
Examples
These statements product the following result, with August abbreviated to the letter
A.
02A05
MONTHNAMES
The MONTHNAMES option holds the list of valid names for months that is used in
handling values with a DATE-only data type and values of dimensions of type DAY,
WEEK, MONTH, QUARTER, and YEAR. The list of names is used to interpret dates
that are entered and to format dates that are displayed or converted to text values.
The MONTHNAMES list is used when you enter a date that includes a month name or
abbreviation. See the DATEFORMAT option for a discussion of methods for entering
DATE-only values. The MONTHNAMES list is also used when you display or convert
a date using the <MT>, <MTXT>, <MTXTL>, <MTEXT>, or <MTEXTL> formats. These
formats are specified in the DATEFORMAT option. When you have more than one set
of month names, Oracle OLAP chooses the synonym whose number of characters and
capitalization pattern best match the DATEFORMAT specification.
Data Type
TEXT
Syntax
MONTHNAMES = name-list
Arguments
name-list
A multiline text expression that lists the names of the 12 months of the year. Each
month name occupies a separate line. Regardless of which month you are treating as
the first month of the year, the list must begin with the name for January. The default
value is the list of English month names, all in capital letters.
You can include more than 1 set of 12 names in your list. Any name in the list is
considered a valid name for input. The thirteenth name is a synonym for the first
name, the fourteenth name is a synonym for the second name, and so on.
Examples
MULTIPATHHIER
The MULTIPATHHIER option specifies that a given cell that contains detail data can
have more than one path into a cell that contains aggregated data. Certain calculations
require this kind of multiple-path aggregation.
Data Type
BOOLEAN
Syntax
MULTIPATHHIER = {YES|NO}
Arguments
YES
Allows a detail data cell to aggregate in multiple paths to the same ancestor cell.
NO
(Default) Disallows a detail data cell to aggregate in multiple paths to the same
ancestor cell.
Notes
In the preceding error message, X is the name of the detail data cell, and Y is the name
of the ancestor cell into which the detail data cell takes more than one path to
aggregate. For more information, see Example 6–68, "Defining Multiple Paths in a
Hierarchy" on page 6-98.
This error message is displayed because the multiple paths taken by the detail data cell
have been interpreted as a circular hierarchy. When this is a mistake and you did not
intend to create multiple paths, then change the hierarchy. Otherwise, set the
MULTIPATHHIER option to YES.
Examples
First, a geography dimension named geog and a second dimension named path are
defined.
A relation named geog.geog is defined, in which the geography dimension is
dimensioned by itself and the path dimension.
Dimension values named A1, B1, B2, and Top are added to the geog dimension.
Two dimension values are added to the path dimension. Because path was defined
with an INTEGER data type, the dimension values that are automatically assigned to it
are the INTEGER values 1 and 2.
Finally, the hierarchy for the geog dimension is created. The A1 dimension value is
the detail data. The B1 and B2 dimension values are the second level of the hierarchy.
The Top dimension value is the top of the hierarchy.
A1 has two aggregation paths: A1 aggregates into B1, which aggregates into Top; A1
aggregates into B2, which aggregates into Top.
The following statements define a variable named myvar, assign a data value of 1 to
its detail data level (A1), and define an aggmap for that variable.
DEFINE myvar INTEGER VARIABLE <geog>
myvar(geog 'A1') = 1
DEFINE myvar.aggmap <geog>
AGGMAP 'RELATION geog.geog'
The multiple paths of aggregation that have been created for A1 have been interpreted
as a circular hierarchy, because the MULTIPATHHIER option is currently set to NO.
When you had made a mistake and created these multiple paths by mistake, you
would fix the problem in the hierarchy.
However, in this case, the multiple paths have been created because a calculation
requires them. Therefore, the solution is to set MULTIPATHHIER to YES. Now you
can execute the AGGREGATE command without error.
NASKIP
The NASKIP option controls whether NA values are considered as input to aggregation
functions.
Data Type
BOOLEAN
Syntax
NASKIP = NO|YES
Arguments
NO
(Default) NA values are considered by aggregation functions. When any of the values
being considered are NA, the function returns NA for that value.
YES
NA values are ignored by aggregation functions. Only expressions with actual values
are used in calculations.
Notes
SMALLEST
STDDEV
TCONVERT
TOTAL
VINTSCHED
VPMTSCHED
Other statements are not affected by the setting of NASKIP, they always ignore NA
values.
Examples
The statements
NASKIP = YES
REPORT DOWN month MOVINGMIN(sales -2, 0, 1, month)
produce the following report, which shows NA values for March 1997.
DISTRICT: SEATTLE
-----------MOVINGMIN(SALES -2, 0, 1, MONTH)-----------
---------------------PRODUCT--------------------------
MONTH Tents Canoes Racquets Sportswear Footwear
----- ---------- ---------- ---------- ---------- ---------
Jul96 108,663.59 125,823.37 57,666.37 57,713.27 73,085.88
Aug96 119,066.18 128,660.89 45,046.71 60,322.88 78,019.87
Sep96 97,188.43 122,702.13 42,257.14 63,777.36 78,019.87
Oct96 91,578.77 79,925.93 39,729.25 55,021.85 83,347.55
Nov96 56,044.34 77,357.10 39,024.93 44,004.12 65,216.94
Dec96 41,576.26 67,609.36 36,156.10 40,575.34 62,113.72
Jan97 41,576.26 67,609.36 36,156.10 40,575.34 62,113.72
Feb97 41,576.26 67,609.36 36,156.10 40,575.34 62,113.72
Mar97 NA NA NA NA NA
The statements
NASKIP = NO
REPORT DOWN month MOVINGMIN(sales -2, 0, 1, month)
produce the following report, which shows NA values for January through
March 1997.
DISTRICT: SEATTLE
----------MOVINGMIN(SALES -2, 0, 1, MONTH)-------------
------------------------PRODUCT------------------------
MONTH Tents Canoes Racquets Sportswear Footwear
----- ---------- ---------- ---------- ---------- ----------
Jul96 108,663.59 125,823.37 57,666.37 57,713.27 73,085.88
Aug96 119,066.18 128,660.89 45,046.71 60,322.88 78,019.87
Sep96 97,188.43 122,702.13 42,257.14 63,777.36 78,019.87
Oct96 91,578.77 79,925.93 39,729.25 55,021.85 83,347.55
Nov96 56,044.34 77,357.10 39,024.93 44,004.12 65,216.94
Dec96 41,576.26 67,609.36 36,156.10 40,575.34 62,113.72
Jan97 NA NA NA NA NA
Feb97 NA NA NA NA NA
Mar97 NA NA NA NA NA
NASKIP2
The NASKIP2 option controls how NA values are treated in arithmetic operations with
the + (plus) and - (minus) operators. The result is NA when any operand is NA unless
NASKIP2 is set to YES.
Data Type
BOOLEAN
Syntax
NASKIP2 = YES|NO
Arguments
YES
Zeroes are substituted for NA values in arithmetic operations using the + (plus) and -
(minus) operators. The two special cases of NA + NA and NA - NA both result in NA.
NO
(Default) NA values are treated as NAs in arithmetic operations using the + (plus) and
- (minus) operators. When any of the operands being considered is NA, the arithmetic
operation evaluates to NA.
Notes
Examples
report. The sum of X + Z is given for each combination of NASKIP and NASKIP2
settings, starting with their defaults. The example also shows that when the + (plus)
operator is used in the expression argument to the TOTAL function, the results that are
returned by TOTAL depend on the settings of both NASKIP and NASKIP2.
■ NASKIP Set to YES, NASKIP2 Set to NO
In this example, NASKIP is set to YES, which means NA values are ignored by the
TOTAL function. NASKIP2 is set to NO, which means that the result of a + (plus)
operation will be NA when any of the operands are NA.
NASKIP = YES
NASKIP2 = NO
COLWIDTH = 5
REPORT LEFT W 6 DOWN intdim x, z, x + z
These statements produce the following output. With NASKIP2 set to NO, the
expression X + Z evaluates to NA when either X or Z is NA.
INTDIM X Z x + z
------ ----- ----- -----
1 NA 2 NA
2 3 NA NA
3 7 6 13
The following statement uses a + (plus) operator within the expression argument to
the TOTAL function.
SHOW TOTAL(x + z)
The next statement uses the + (plus) operator to add the results that are returned
by two TOTAL functions.
SHOW TOTAL(x) + TOTAL(z)
These statements produce the following output. With NASKIP2 set to YES, NA
values are ignored when the expression X + Z is evaluated.
INTDIM X Z X + Z
------ ----- ----- -----
1 NA 2 2
2 3 NA 3
3 7 6 13
The following statement uses a + (plus) operator within the expression argument to
the TOTAL function.
SHOW TOTAL(x + z)
The next statement uses the + (plus) operator to add the results that are returned
by two TOTAL functions.
SHOW TOTAL(x) + TOTAL(z)
The following statement uses a + (plus) operator within the expression argument to
the TOTAL function.
SHOW TOTAL(x + z)
The next statement uses the + (plus) operator to add the results that are returned
by two TOTAL functions.
SHOW TOTAL(x) + TOTAL(z)
The following statement uses a + (plus) operator within the expression argument to
the TOTAL function.
SHOW TOTAL(x + z)
The next statement uses the + (plus) operator to add the results that are returned
by two TOTAL functions.
SHOW TOTAL(x) + TOTAL(z)
NASPELL
The NASPELL option controls the spelling that is used for NA values in output.
Data Type
TEXT
Syntax
NASPELL = {'text'|'NA'}
Arguments
text
The spelling to use for any NA value in output. When you specify an expression rather
than a text literal, you can omit the single quotes. The default is NA.
Notes
Assigning NA Values
NASPELL affects only Oracle OLAP output; it does not affect the way you assign an
NA value. For example, even when you have set NASPELL to NONE, you assign an NA
value as follows.
var1 = NA
Examples
SHOW current.month
NLS_CALENDAR
Data Type
TEXT
Syntax
NLS_CALENDAR = option-value
Arguments
See Oracle Database Reference for more information about NLS parameters, including
valid values.
Examples
NLS_CURRENCY
The NLS_CURRENCY option specifies the local currency symbol for the L number
format element for the session. (See the TO_NUMBER function for a description of
number format elements.
Within a session, you can dynamically modify the value of this option using the OLAP
DML syntax show below or by using the SQL statement ALTER SESSION SET
option = value.
Data Type
TEXT
Syntax
NLS_CURRENCY = option-value
Arguments
See Oracle Database Reference for more information about NLS parameters, including
valid values.
NLS_DATE_FORMAT
The NLS_DATE_FORMAT option specifies the default format for datetime values.
Within a session, you can dynamically modify the value of this option using the OLAP
DML syntax show below or by using the SQL statement ALTER SESSION SET
option = value.
Data Type
TEXT
Syntax
NLS_DATE_FORMAT = option-value
Arguments
See Oracle Database Reference for more information about NLS parameters, including
valid values.
Examples
See Example 6–74, "Setting the Language for Dates" on page 6-112.
NLS_DATE_LANGUAGE
The NLS_DATE_LANGUAGE option specifies the language for days, months, and
similar language-dependent datetime format elements.
Within a session, you can dynamically modify the value of this option using the OLAP
DML syntax show below or by using the SQL statement ALTER SESSION SET
option = value.
Data Type
TEXT
Syntax
NLS_DATE_LANGUAGE = option-value
Arguments
See Oracle Database Reference for more information about NLS parameters, including
valid values.
Examples
NLS_DUAL_CURRENCY
Data Type
TEXT
Syntax
NLS_DUAL_CURRENCY= option-value
Arguments
See Oracle Database Reference for more information about NLS parameters, including
valid values.
NLS_ISO_CURRENCY
The NLS_ISO_CURRENCY option specifies the international currency symbol for the
C number format element.
Within a session, you can dynamically modify the value of this option using the OLAP
DML syntax show below or by using the SQL statement ALTER SESSION SET
option = value.
Data Type
TEXT
Syntax
NLS_ISO_CURRENCY = option-value
Arguments
See Oracle Database Reference for more information about NLS parameters, including
valid values.
NLS_LANG
(Read-only) The NLS_LANG option specifies the current language, territory, and
database character set, which are determined by session-wide globalization
parameters.
Data Type
TEXT
Syntax
NLS_LANG
Arguments
See Oracle Database Globalization Support Guide for more information about NLS
database parameters.
Examples
NLS_LANGUAGE
The NLS_LANGUAGE option specifies the current language for the session. the
setting of this option determines the value of the SESSION_NLS_LANGUAGE option.
Within a session, you can dynamically modify the value of this option using the OLAP
DML syntax show below or by using the SQL statement ALTER SESSION SET
option = value.
Data Type
TEXT
Syntax
NLS_LANGUAGE = option-value
Arguments
See Oracle Database Reference for more information about NLS parameters, including
valid values.
Examples
NLS_NUMERIC_CHARACTERS
Data Type
TEXT
Syntax
NLS_NUMERIC_CHARACTERS = option-value
Arguments
See Oracle Database Reference for more information about NLS initialization parameters.
Examples
is now
1 234,56
NLS_SORT
The NLS_SORT option specifies the sequence of character values used when sorting or
comparing text. The value of NLS_SORT affects the GT, GE, LT, and LE operators,
SORT command, and the SORTLINES function.
Within a session, you can dynamically modify the value of this option using the OLAP
DML syntax show below or by using the SQL statement ALTER SESSION SET
option = value.
Data Type
TEXT
Syntax
NLS_SORT = option-value
Arguments
See Oracle Database Globalization Support Guide for more information about the NLS_
SORT parameter.
Examples
NLS_TERRITORY
Data Type
TEXT
Syntax
NLS_TERITORRY = option-value
Arguments
See Oracle Database Reference for more information about the NLS_TERRITORY
parameter.
Examples
The thousands marker is a comma (,), and the decimal marker is a period (.).
SHOW TO_NUMBER('12345')
12,345.00
The thousands marker is now a period (.), and the decimal marker is a comma (,).
SHOW TO_NUMBER('12345')
12.345,00
NOSPELL
(Read-only) The NOSPELL option holds the text that is used for FALSE Boolean values
in the output of OLAP DML statements.
The value of the NOSPELL option is the word for "no" in the current language, as
specified by the NLS_LANGUAGE option. For example, when NLS_LANGUAGE is
set to "American," then the default value of NOSPELL is NO.
Data Type
TEXT
Syntax
NOSPELL
Examples
OKFORLIMIT
The OKFORLIMIT option controls whether you can limit the dimension you are
looping over within an explicit FOR loop.
Tip: To set the status of the dimension you are looping over in a loop
that is generated by a REPORT statement, use a TEMPSTAT
statement.
Data Type
BOOLEAN
Syntax
OKFORLIMIT = {NO|YES}
Arguments
NO
(Default) You cannot limit the dimension you are looping over within an explicit FOR
loop.
YES
You can limit the dimension you are looping over within an explicit FOR loop.
Examples
OKNULLSTATUS
Data Type
BOOLEAN
Syntax
OKNULLSTATUS = {YES|NO}
Arguments
YES
Indicates that null status lists are allowed. With this setting, when you execute a
LIMIT command (without the IFNONE argument) that results in a dimension status
list being null, the status list is set to null, and no error message is produced.
NO
(Default) Indicates that null status lists are not allowed. With this setting, when you
execute a LIMIT command (without the IFNONE argument and without the NULL
keyword) that would result in a dimension status list being null, the status list is not
changed and an error message is produced.
Notes
Examples
OUTFILEUNIT
(Read-only) The OUTFILEUNIT option holds the file unit number of the current
OUTFILE destination, set by the last OUTFILE statement. The first time you redirect
output to a given file, OUTFILE assigns that file an arbitrary INTEGER as a file unit
number.
Data Type
INTEGER
Syntax
OUTFILEUNIT
Notes
Examples
PAGENUM
The PAGENUM option holds the current page number of output. You can use
PAGENUM with PAGEPRG to produce the page number on each page of a report.
The PAGENUM option is meaningful only when PAGING is set to YES and only for
output from statements such as REPORT and LISTNAMES.
Data Type
INTEGER
Syntax
PAGENUM = n
Arguments
n
An INTEGER expression that specifies the page number to use for the next page of
output. The default is 1.
Notes
Examples
In your report program, set the PAGEPRG option to use the report.head program.
PAGEPRG = 'report.head'
When you run the report program, each page after the first page starts with a heading
such as the following.
15JAN95 15:05:16 Page 2
Annual Sales Report
(Continued)
PAGEPRG
The PAGEPRG option holds the name of a program or the text of a statement to be
executed at the beginning of each page of output. You can use this program or
statement to create titles and column headings on multiple pages of a report. A
program can also contain other statements appropriate for execution at the start of
every page. Normally, you set the value of PAGEPRG in the initialization section of a
report program.
The PAGEPRG option is meaningful only when PAGING is set to YES and only for
output from statements such as REPORT and LISTNAMES.
Data Type
TEXT
Syntax
PAGEPRG = {'program'|'statement'|'NONE'|'STDHDR'}
Arguments
program
The name of a program to be executed after every page break. When you specify the
program name as a text expression, you can omit the single quotes.
statement
The text of a statement to be executed after every page break. When you specify the
statement as a text expression, you can omit the single quotes.
NONE
Indicates that no statement or program is executed automatically after a page break.
STDHDR
(Default) Makes STDHDR the program name that PAGEPRG stores. You can also set
PAGEPRG to 'DEFAULT' to make STDHDR the program name that PAGEPRG stores.
STDHDR produces a heading with the date and time on the left and the page number
on the right.
Notes
Examples
Specify this program to execute after every page break by setting the PAGEPRG
option in the report program. You can include PUSH and POP commands to save the
PAGEPRG setting that is active.
PUSH PAGEPRG PAGING
PAGEPRG = 'report.head'
PAGING = YES
... (body of report program)
POP PAGEPRG PAGING
When you run the report, each page will contain the following heading.
15JAN98 15:05:16 Page 1
Each page after the first page will also contain the subheading "(Continued)" because
of the PAGENUM test in the IF statement.
Then you can change the first few lines of the report.head program to the following.
PAGESIZE
The PAGESIZE option specifies the size of a page of output. The value of PAGESIZE is
the number of output lines to be produced on each page. PAGESIZE is usually used in
the initialization section of report programs. The PAGESIZE option is meaningful only
when PAGING is set to YES and only for output from statements such as REPORT and
LISTNAMES. PAGESIZE also controls the LINELEFT option. When PAGESIZE is
changed, Oracle OLAP adjusts LINELEFT accordingly.
Data Type
INTEGER
Syntax
PAGESIZE = n
Arguments
n
An INTEGER expression that specifies the number of output lines on a page; n
includes the top and bottom margins (controlled by the TMARGIN and BMARGIN
options). The default is 66 lines, which is suitable for printing report output on 8 1/2"
by 11" paper.
Notes
When you set PAGESIZE for the default outfile, the new value remains in effect until
you reset it, regardless of intervening OUTFILE commands that send output to a file.
That is, the value of PAGESIZE is automatically saved for the default outfile.
Examples
PAGING
The PAGING option controls the production of paged output in Oracle OLAP. When
you set PAGING to YES, output from statements such as DESCRIBE, REPORT, ROW
command, HEADING, SHOW, and LISTNAMES is produced in a page-oriented
format. Output is produced in page-size segments with standard top and bottom
margins and headings. You can use a variety of paging-related options to change the
size of the page, the size of the margins, and the headings on each page.
Paging is useful primarily for making output more attractive when you plan to print
output that you send to a file. However, you can also send paged output to the default
outfile. Normally you would set the PAGING option in the initialization section of a
report program to turn paging on for your report.
Data Type
BOOLEAN
Syntax
PAGING = {YES|NO}
Arguments
YES
Produces output with page breaks, top and bottom margins, and page headings.
NO
(Default) Produces output that contains no page breaks, top and bottom margins, or
page headings. Output is continuous, one line after another.
Notes
Paging-Related Options
Oracle OLAP uses default values for page length, page headings, and top and bottom
margins. You can change these values by setting the PAGESIZE, PAGEPRG,
TMARGIN, and BMARGIN options. Other paging options that become meaningful
when PAGING is set to YES are LINENUM, LINELEFT, and PAGENUM.
The value of PAGING for the current outfile determines whether the paging-related
options will be used. You must set PAGING to YES for the current outfile in order to
make the paging options take effect.
Changing Outfiles
When you use an OUTFILE statement to direct output to a file, all the paging-related
options are set to their default values for the file. When you use an OUTFILE
statement with the EOF keyword to redirect output to the default outfile, the
paging-related options will contain the values that they last held for the default outfile.
Examples
PARENS
The PARENS option controls whether negative numbers are represented in output
with parentheses or a minus sign.
Data Type
BOOLEAN
Syntax
PARENS = {YES|NO}
Arguments
YES
Encloses negative values in parentheses, instead of using a minus sign.
NO
(Default) Uses a minus sign to represent negative values.
Notes
Overriding PARENS
The setting of the PARENS option is overridden by a PAREN or NOPAREN attribute
in a HEADING, REPORT, or ROW command. The PAREN attribute specifies the use
of parentheses; the NOPAREN attribute specifies the use of a minus sign.
Examples
BUDGET-ACT
MONTH BUDGET ACTUAL UAL
-------------- ---------- ---------- ----------
Jan96 279,773 287,558 (7,785)
Feb96 323,982 315,299 8,683
Mar96 302,178 326,185 (24,007)
Apr96 386,101 394,544 (8,443)
May96 433,998 449,862 (15,864)
Jun96 448,042 457,348 (9,305)
PERMITERROR
Data Type
BOOLEAN
Syntax
PERMITERROR = NO|YES
Arguments
NO
When you set PERMITERROR to NO, an error condition is not created on attempted
access of a variable for which read or write permission is denied with a PERMIT
statement. Values for which you do not have read permission are displayed as NAs.
When you try to change a value for which you do not have write permission, the
request is ignored.
YES
When PERMITERROR is YES (the default), an error is signaled upon attempted access
of a variable for which read or write permission is denied with a PERMIT statement.
The error, which can be trapped, terminates the Oracle OLAP operation that initiated
the illegal access.
Notes
Maintaining Dimensions
The setting of PERMITERROR is ignored for violations of maintain and permit
permission. Attempted violations of permission to maintain dimensions and to change
permission are always treated as errors. Attempted violations of read or write
permission for dimensions are, similarly, always treated as errors.
Examples
The statements
LIMIT month TO 'Dec96'
REPORT price
The statements
PERMITERROR = yes
REPORT price
POUTFILEUNIT
The POUTFILEUNIT option identifies a destination for status information about the
execution of many OLAP DML statements, including:
AGGREGATE command
AGGREGATE function
ALLOCATE
CLEAR
AW ATTACH
AW DETACH
UPDATE
IMPORT
EXPORT
When an OLAP DML statement is executed through SQL, using the POUTFILEUNIT
option enables you to see the work that the statement is doing as it progresses instead
of waiting until the execution of the SQL call is complete.
Syntax
POUTFILEUNIT = -1 |fileunit
Arguments
-1
(Default) Specifies that Oracle OLAP is currently not logging data.
fileunit
Specifies a destination, such as an open disk file, to which Oracle OLAP sends
information on the progress of an operation. The fileunit can be the value of the
OUTFILEUNIT option or the results of the FILEOPEN function.
Notes
Examples
PRGTRACE
The PRGTRACE option controls whether each line of a program is recorded in the
current outfile or in a debugging file during execution of the program. PRGTRACE is
primarily used as a debugging tool to uncover problems by tracing the execution of a
program.
OLAP DML programs provided as OLAP DML statements are not traced unless
EXPTRACE is set to YES.
When you have used a DBGOUTFILE statement to specify a debugging file, Oracle
OLAP sends PRGTRACE output to the debugging file instead of the current outfile.
Data Type
BOOLEAN
Syntax
PRGTRACE = {YES|NO}
Arguments
YES
Oracle OLAP records each line in a program before it is executed.
NO
(Default) Oracle OLAP does not record each line in a program.
Notes
PRGTRACE Output
PRGTRACE records the name of the current program at the beginning of each
program line. It includes an equals sign to indicate a compiled line.
(PRG= SALESREP) . . .
A compiled line is a line that has been translated into an efficient internal form,
whereas an uncompiled line has not. Oracle OLAP ordinarily stores lines in compiled
form to make programs work more efficiently, especially programs that contain loops.
Examples
cleanup:
POP month division line
END
When you want to debug this program, you can trace the execution of each of its lines
by turning on PRGTRACE and executing the program.
PRGTRACE = yes
salesrep FIRST 3
PRGTRACE produces the following output in the current outfile or debugging file.
(PRG= SALESREP) push month division line
(PRG= SALESREP) trap on cleanup
(PRG: SALESREP) limit month to &args
(PRG= SALESREP) limit division to all
(PRG= SALESREP) limit line to first 1
(PRG= SALESREP) report down division across month: dec0 budget
LINE: REVENUE
-------------BUDGET-------------
-------------MONTH--------------
DIVISION JAN95 FEB95 MAR95
-------------- ---------- ---------- ----------
CAMPING 679,149 707,945 780,994
SPORTING 482,771 517,387 525,368
CLOTHING 983,888 1,016,528 992,331
(PRG= SALESREP) cleanup:
(PRG= SALESREP) pop month division line
Data Type
INTEGER
Syntax
RANDOM.SEED.1|RANDOM.SEED.2 = n
Arguments
n
An INTEGER expression that specifies the value to use when generating random
numbers. The default is for RANDOM.SEED.1 is 12345 and RANDOM.SEED.2 is 1073.
Notes
Examples
As shown in the following code, when you use RANDOM to populate myvar without
seeding it first. Oracle OLAP populates myvar with different values each time the
RANDOM executes.
myvar = 0
myvar = RANDOM (10, 20)
REPORT myvar
ID MYVAR
-------------- ----------
a1 11
a2 19
a3 14
myvar = 0
myvar = RANDOM (10, 20)
REPORT myvar
ID MYVAR
-------------- ----------
a1 16
a2 13
a3 12
Now, assume that you want to write a test that uses RANDOM to create predictable
values for myvar. As the following code illustrates, to ensure that the results of
RANDOM are the same from time to time, you must set the values of
RANDOM.SEED.1 and RANDOM.SEED.2 right before the execution of RANDOM.
myvar = 0
RANDOM.SEED.1 = 5
RANDOM.SEED.2 = 3
myvar = RANDOM (10, 20)
REPORT myvar
ID MYVAR
-------------- ----------
a1 10
a2 16
a3 13
myvar = 0
RANDOM.SEED.1 = 5
RANDOM.SEED.2 = 3
myvar = RANDOM (10, 20)
REPORT myvar
ID MYVAR
-------------- ----------
a1 10
a2 16
a3 13
The values that you set for RANDOM.SEED.1 and RANDOM.SEED.2 do not stay the
same throughout a session. As the following code illustrates, when you do not reseed
with the same values before each execution, the values produced by RANDOM are not
the same.
myvar = 0
RANDOM.SEED.1 = 5
RANDOM.SEED.2 = 3
myvar = RANDOM (10, 20)
REPORT myvar
ID MYVAR
-------------- ----------
a1 10
a2 16
a3 13
myvar = 0
myvar = RANDOM (10, 20)
REPORT myvar
ID MYVAR
-------------- ----------
a1 11
a2 16
a3 20
RECURSIVE
Syntax
RECURSIVE = {YES|NO}
Arguments
YES
Specifying YES allows a formula or $NATRIGGER expression to call itself. Set this
option to YES when you define a formula or an expression for the $NATRIGGER
property that uses a recursive method of computation.
NO
(Default) Specifying NO prevents a formula or $NATRIGGER expression from calling
itself. When you attempt to evaluate a recursive formula or $NATRIGGER expression,
then Oracle OLAP displays an error message, which states that the RECURSIVE
option is currently set to NO. Until the workspace contains a recursive formula or
$NATRIGGER expression, keep this option set to NO in order to detect errors that
could result in infinite looping behavior.
Notes
ROLE
(Read-only) The ROLE option holds a list of Oracle Database roles associated with the
user ID under which an Oracle OLAP session is running.
Data Type
TEXT
Syntax
ROLE
Examples
ROOTOFNEGATIVE
The ROOTOFNEGATIVE option determines the result of any attempt to obtain a root
of a negative number.
Data Type
BOOLEAN
Syntax
ROOTOFNEGATIVE = YES|NO
Arguments
YES
Allows any attempt to obtain a root of a negative number. This means that a statement
that attempts to obtain a root of a negative number will execute without an error;
however, the result of the attempt to obtain the root will be NA. When you are working
with a dimensioned variable or expression, setting ROOTOFNEGATIVE to YES
enables you to obtain the root of most of the expression's values when a few of the
values might be negative.
NO
(Default) Disallows any attempt to obtain a root of a negative number. Any statement
that attempts to obtain a root of a negative number will stop executing and an error
message will be produced.
Notes
Examples
When you change ROOTOFNEGATIVE to YES, the same statement executes without
error
ROOTOFNEGATIVE = YES
SHOW SQRT(testnumber)
SECONDS
(Read-only) The SECONDS option holds the number of seconds since January 1, 1970.
As an aid to enhancing a program's speed, SECONDS can be used to determine how
many real seconds elapse while the program is running.
Data Type
INTEGER
Syntax
SECONDS
Examples
SESSCACHE
Typically used only when debugging, the SESSCACHE option controls whether
Oracle OLAP creates an Oracle OLAP session cache described in "What is an Oracle
OLAP Session Cache?" on page 6-148.
Data Type
BOOLEAN
Syntax
SESSCACHE = {YES|NO}
Arguments
YES
The session cache is created to hold the data described in "What is an Oracle OLAP
Session Cache?" on page 6-148.
NO
Oracle OLAP does not read or write to the session cache. When you specify NO,
caching does not occur even when you have specified caching by coding a CACHE
SESSION statement in the specification for one or more aggmap objects, by setting one
or more $VARCACHE properties to SESSION, or by setting the VARCACHE option to
SESSION.
Notes
There is one internal cache for a session. Cached data is ignored by UPDATE and
COMMIT statements. However, once data is cached, Oracle OLAP uses the values in
the cache for all calculations except when an AGGREGATE function with the
FORCECALC keyword executes. In this case, the FORCECALC keyword specifies that
Oracle OLAP recalculate the values.
When a session is terminated, its cache is cleared. To clear the session cache without
terminating the session, issue a CLEAR statement.
The effectiveness of a session cache is tracked in the V$AW_CALC dynamic
performance view.
SESSION_NLS_LANGUAGE
Data Type
TEXT
Syntax
SESSION_NLS_LANGUAGE
Examples
For examples of retrieving how the value of SESSION_NLS_LANGUAGE is impacted
by changes in the value of NLS_LANGUAGE and STATIC_SESSION_LANGUAGE,
see Example 5–9, "Changing NLS_LANGUAGE" on page 5-15 and Example 6–105,
"Changing NLS_LANGUAGE Without Changing the Language of the OLAP Session"
on page 6-159.
REPORT myaw4!mylangs
MYLANGS
--------------
AMERICAN
GERMAN
Now assume that you attach both of these analytic workspaces while NLS_
LANGUAGE and SESSION_NLS_LANGUAGE are set to American. As shown in the
following code, Oracle OLAP limits mylangs in both analytic workspace to American.
REPORT myaw3!mylangs
MYLANGS
--------------
AMERICAN
REPORT myaw4!mylangs
MYLANGS
--------------
AMERICAN
SORTCOMPOSITE
Data Type
BOOLEAN
Syntax
SORTCOMPOSITE = {YES|NO}
Arguments
YES
(Default) In an explicitly specified loop over a composite, Oracle OLAP sorts the
composite values according to the order of the composite's base dimension values
(when they have not already been sorted in this way). The task of sorting requires
some processing time, so when variables are large, performance can be affected.
NO
In an explicitly specified loop over a composite, Oracle OLAP does not sort the
composite values according to the order of the composite's base dimension values.
Eliminating this sorting step can improve Oracle OLAP performance, when large
variables are involved. See "Results with SORTCOMPOSITE Set to NO" on page 6-152.
Notes
Examples
With SORTCOMPOSITE set to YES, and after the following LIMIT and SORT
commands, the preceding REPORT statement produces the following report. Notice
that the products are listed in descending order according to the total of Boston and
Chicago figures for each product.
-COUPON_COUNT--
-----MONTH-----
PRODUCT DISTRICT Jan95
---------- ---------- ---------------
Racquets Boston 93
Tents Boston 42
Canoes Boston 67
Sportswear Boston 29
Racquets Chicago 102
Tents Chicago 51
When SORTCOMPOSITE had been set to NO, Oracle OLAP would not necessarily
have looped over the product dimension according to the sorted values of coupon_
count. The looping order would have been the order that required the least
processing effort from Oracle OLAP. If coupon_count had been a very large
variable, the performance improvement might have been significant.
SPARSEINDEX
The SPARSEINDEX option controls the type of index algorithm that composites use to
load and access their values. The value of SPARSEINDEX at the time a named
composite is defined, or an unnamed composite is created, determines the type of
algorithm the composite uses by default. When you specify an index algorithm in a
DEFINE COMPOSITE statement, this overrides the default specified by the
SPARSEINDEX option.
Choosing an index algorithm is important only in regard to performance issues. Any
recommendations are for the version of Oracle OLAP that is associated with this
documentation. You can test how using different algorithms affect performance by
using a CHGDFN statement to change the algorithm for a composite (for example,
before loading data).
Data Type
TEXT
Syntax
SPARSEINDEX = {'BTREE'|'HASH'}
Arguments
BTREE
A standard indexing method that is recommended for composites. Use BTREE unless
you are an advanced user. BTREE tends to group similar values together, which
results in better locality of access. BTREE is the default algorithm.
HASH
A standard indexing method that should only be used when a composite has only two
or three base dimensions. HASH is generally not recommended for composites since
using HASH results in a very large index table, which can be too large to fit into
memory.
Examples
SQLBLOCKMAX
The SQLBLOCKMAX option controls the maximum number of records retrieved from
an Oracle Database at one time. This option provides a means of fine-tuning the
performance of data fetches.
Data Type
INTEGER
Syntax
SQLBLOCKMAX = records
Arguments
records
An INTEGER that identifies the number of records you want fetched at one time.
While you can set SQLBLOCKMAX to any INTEGER, no appreciable change in
performance results in setting it over 100. The default is 10 records.
Notes
Opening Cursors
Only cursors opened after SQLBLOCKMAX is reset will use the new block size.
Number of Records
When a program typically opens a cursor, reads one record, and closes the cursor, you
should set SQLBLOCKMAX to 1. Otherwise, the SQL FETCH statement retrieves 10
records and discards 9 of them. The same is true for other routine fetches of less than
10 records.
Block Size
When your program is fetching small records, you can increase SQLBLOCKMAX to
reduce the number of blocks required for the fetch. Oracle OLAP fetches the data into
a 64K buffer. The block size in bytes is the number of records multiplied by the size of
the records. When the block size exceeds the 64K limit imposed by the buffer, Oracle
OLAP automatically reduces the number of records fetched. See Example 6–101,
"Defining a Cursor with SQLBLOCKMAX" on page 6-155.
Examples
SQLCODE
(Read-only) The SQLCODE option holds the value returned by the Oracle RDBMS
after the most recently attempted SQL operation.
Return Value
INTEGER. 0 after a successful operation, -1 after an error, or 100 after all requested
rows have been fetched.
Syntax
SQLCODE
Notes
You can write programs that look for a specific error code. For example, the most
common warning code is 100, which indicates that the cursor reached the end of its
table selection and the FETCH statement is complete.
Examples
SQLERRM
(Read-only) After the Database reports an error and SQLCODE has a nonzero value,
the SQLERRM option usually contains text that explains the problem.
Data Type
TEXT
Syntax
SQLERRM
Notes
Examples
SQLMESSAGES
The SQLMESSAGES option controls whether error messages are sent to the current
output file.
Data Type
BOOLEAN
Syntax
SQLMESSAGES = {YES|NO}
Arguments
YES
Error messages are sent to the current output file.
NO
(Default) Error messages are only stored as values of SQLERRM.
Notes
Typical Usage
You will want to set SQLMESSAGES to YES while you are developing an application
so that you can diagnose errors quickly. When your application is in use, you will
probably want it to capture and handle errors in a different manner with
SQLMESSAGES set to NO.
STATIC_SESSION_LANGUAGE
Data Type
BOOLEAN
Syntax
STATIC_SESSION_LANGUAGE = NO | YES
Arguments
NO
Specifies that whenever the value of the NLS_LANGUAGE option changes, Oracle
OLAP changes the value of SESSION_NLS_LANGUAGE to the value of the NLS_
LANGUAGE option. (Default)
YES
Specifies that the value of SESSION_NLS_LANGUAGE does not change when the
value of NLS_LANGUAGE changes.
Examples
SHOW SESSION_NLS_LANGUAGE
AMERICAN
SHOW LOCK_LANGUAGE_DIMS
oui
SHOW STATIC_SESSION_LANGUAGE
oui
REPORT mylangs
MYLANGS
--------------
AMERICAN
REPORT prod_desc
------PROD_DESC------
------PRODUCTS-------
MYLANGS PROD01 PROD02
-------------- ---------- ----------
AMERICAN Trousers Skirts
THIS_AW
(Read-only) The THIS_AW option is the value of the workspace name that Oracle
OLAP uses when it replaces occurrences of the THIS_AW keyword to create a
qualified object name.
Data Type
TEXT
Syntax
THIS_AW
THOUSANDSCHAR
(Read-only) The THOUSANDSCHAR option is the value specified for the NLS_
NUMERIC_CHARACTERS option discussed in NLS Options.
Data Type
ID
Syntax
THOUSANDSCHAR
Examples
Assume that a comma is displayed as the marker for THOUSANDSCHAR and that a
period is displayed as the marker for DECIMALCHAR. With these values, a SHOW
TOTAL(sales) statement would produce the following output.
63,181,743.50
TMARGIN
The TMARGIN option defines the number of blank lines for the top margin of output
pages, above the running page heading. In other words, the top margin lines are
produced before the program that is defined by PAGEPRG, if any, is run.
TMARGIN is meaningful only when PAGING is set to YES and only for output from
statements such as REPORT and DESCRIBE. The TMARGIN option is usually set in
the initialization section of report programs.
Data Type
INTEGER
Syntax
TMARGIN = n
Arguments
n
An INTEGER expression that specifies the number of lines that you want to set aside
for the top margin in a report. The default is 2.
Notes
Examples
TRACEFILEUNIT
(Read-only) The TRACEFILEUNIT option records the unit number of the Oracle trace
file. This is a writable output file that collects information about the activity in the
Oracle session.
Syntax
TRACEFILEUNIT
Notes
Examples
TRIGGERMAXDEPTH
Data Type
INTEGER
Syntax
TRIGGERMAXDEPTH = n
Arguments
n
An INTEGER expression that specifies the maximum number of $NATRIGGER
property expressions that can execute simultaneously. The default value is 50.
Notes
Recursive Triggers
While a $NATRIGGER expression is executing, it cannot be invoked again by a
formula, program, or other $NATRIGGER expression that it invokes unless the
RECURSIVE option is set to YES. The TRIGGERMAXDEPTH option governs the
depth of recursion of $NATRIGGER expressions and prevents infinite recursions or
excessively deep recursions, which can cause Oracle OLAP to malfunction.
Examples
The following statements set the maximum trigger depth to a higher value and show
the value of the variable.
TRIGGERMAXDEPTH = 3
SHOW v1
TRIGGERSTOREOK
Data Type
BOOLEAN
Syntax
TRIGGERSTOREOK = {NO|YES}
Arguments
NO
(Default) NA values are not permanently replaced with the $NATRIGGER property
expression that is set for a variable.
YES
NA values are permanently replaced with the $NATRIGGER property expression that
is set for a variable. The default value is NO.
For Oracle OLAP to permanently replace NA values for a variable with the valid
$NATRIGGER property expression that is set for the variable, you must set both the
TRIGGERSTOREOK option and the $STORETRIGGERVAL property for the variable
to YES.
Notes
Examples
REPORT v1
The following statements delete the $NATRIGGER property from the v1 variable and
report the values in the cells of the variable.
CONSIDER v1
PROPERTY DELETE '$NATRIGGER'
REPORT v1
USERID
(Read-only) The USERID option holds the user ID for the current Oracle Database
session. This is the same value as that returned by SYSINFO(USER).
Data Type
TEXT
Syntax
USERID
Examples
USETRIGGERS
Tip: Oracle OLAP does not support recursive triggers. Set the
USETRIGGERS option to NO before you issue the same DML
statement within a trigger program that triggered the program itself.
For example, assume that you have written a TRIGGER_DEFINE
program. Within the TRIGGER_DEFINE program, you must set the
USETRIGGERS option to NO before you issue a DEFINE statement
Data Type
BOOLEAN
Syntax
USETRIGGERS = {NO|YES}
Arguments
YES
(Default) Trigger programs execute.
NO
Trigger programs do not execute.
Examples
USETRIGGERS = NO
SHOW USETRIGGERS
no
VARCACHE
The VARCACHE option specifies whether Oracle OLAP stores or caches all variable
data that is the result of the execution of an AGGREGATE function or $NATRIGGER
property expression.
Syntax
VARCACHE = {VARIABLE | SESSION | NONE}
Arguments
VARIABLE
Specifies that Oracle OLAP stores the data in the variable in the Database. When you
specify this option, the results of the calculation are permanently stored in the variable
when the analytic workspace is updated and committed.
SESSION
Specifies that Oracle OLAP caches the calculated data in the session cache (See "What
is an Oracle OLAP Session Cache?" on page 6-148). When you specify this option, the
results of the calculation are ignored during updates and commits and are discarded at
the end of the session.
NONE
For data that is calculated on the fly using the AGGREGATE function, specifies that
Oracle OLAP calculates the data each time the AGGREGATE function executes; Oracle
OLAP does not store or cache the data calculated by the AGGREGATE function
Notes
WEEKDAYSNEWYEAR
Data Type
INTEGER
Syntax
WEEKDAYSNEWYEAR = days
Arguments
days
An INTEGER expression in the range 1 through 7 that indicates how many days in the
year must be present in week 1 of that year. The default value for days is 1.
Examples
WRAPERRORS
The WRAPERRORS option determines if Oracle OLAP displays long error messages
as multiple lines with each line being 72 characters in length.
Data Type
BOOLEAN
Syntax
WRAPERRORS = NO | YES
Arguments
NO
Error messages are not wrapped. (Default)
YES
Error message are wrapped. Oracle OLAP inserts a line break after each group of 72
characters.
Notes
YESSPELL
(Read-only) The YESSPELL option holds the text that is used for TRUE Boolean values
in the output of OLAP DML statements.
The value of the YESSPELL option is the word for "yes" in the current language, as
specified by the NLS_LANGUAGE option. For example, when NLS_LANGUAGE is
set to American, then the value of YESSPELL is YES. When NLS_LANGUAGE is set
to Spanish, then the value of YESSPELL is SI.
Data Type
TEXT
Syntax
YESSPELL
Examples
YRABSTART
The YRABSTART option sets the specific 100-year period associated with years that
are read or displayed using a two-digit abbreviation.
Data Type
INTEGER
Syntax
YRABSTART = year
Arguments
year
A four-digit INTEGER expression that indicates the year at which the 100-year period
begins. You can specify any value in the range 1000 to 9999. However, when you
specify a value greater than 9900 for year, requests to read or display two-digit year
values that correspond to a year later than 9999 will result in a return value of NA. The
default is 1950; two-digit year abbreviations are interpreted as being in the range 1950
to 2049 unless a different range is set through YRABSTART.
Examples
ZEROROW
For output produced by the REPORT and ROW commands, the ZEROROW option
suppresses report rows with numeric values that are all NAs or all zeros or would be
represented as zeros. When your report includes a small number, such as 0.004, the
number of decimal places being shown affects whether ZEROROW treats that number
as zero. When you are producing a report with totals, the actual number will be used
to calculate the total, even when the number is suppressed.
Data Type
BOOLEAN
Syntax
ZEROROW = {YES|NO}
Arguments
YES
Suppresses report rows that contain any numeric values when all the numeric values
would be shown either as zeros or NAs.
NO
(Default) Produces all rows of the report, regardless of the values they contain.
Notes
Non-Numeric Data
Even when a row contains non-numeric data, such as TEXT, ID, or BOOLEAN values,
along with numeric values, the row is suppressed when ZEROROW is YES and all the
numeric values would be shown either as zeros or NAs.
Examples
LINE: REVENUE
-----------------WORSTCASE-----------------
-------------------MONTH-------------------
DIVISION Nov95 Dec95 Jan96 Feb96
-------- ---------- ---------- ---------- ----------
Camping 0.00 0.00 45,500.00 47,400.00
Sporting 0.00 0.00 29,200.00 28,400.00
Clothing 0.00 0.00 15,200.00 14,900.00
In the preceding report, no rows are suppressed, since some months for each division
have projected sales. However, when you lay out this report with month down and
division across, the rows for Nov95 and Dec95 are suppressed, because these
months have no projected sales.
REPORT DOWN month ACROSS division: worstcase
ZSPELL
The ZSPELL option holds the default text that is used for representing numeric zero
values in output produced by the HEADING, REPORT, and ROW commands.
Data Type
TEXT
Syntax
ZSPELL = {'text'|'OFF'}
Arguments
text
The spelling to use as the default spelling for numeric zero values. When you specify
an expression rather than a text literal, you can omit the single quotes.
OFF
(Default) Shows a zero (0) with the appropriate number of decimal places (determined
by a DECIMAL attribute) for each numeric zero value.
Notes
Examples
The following statements set ZSPELL to NONE and specify two decimal places for the
output.
ZSPELL = 'NONE'
ROW DECIMAL 2 testvar
With ZSPELL still set to NONE, the following statement specifies three decimal places
for the output.
ROW DECIMAL 3 testvar
A
ABS
ADD_MONTHS
AGGCOUNT
AGGMAPINFO
AGGREGATE function
AGGREGATION
AGGROPS
ALLOCOPS
ANTILOG
ANTILOG10
ANY
ARCCOS
ARCSIN
ARCTAN
ARCTAN2
ARG
ARGCOUNT
ARGFR
ARGS
ASCII
AVERAGE
AW function
B
BACK
BASEDIM
BASEVAL
BEGINDATE
BIN_TO_NUM
BITAND
BLANKSTRIP
C
CALLTYPE
CHARTOROWID
CATEGORIZE
CEIL
CHANGEBYTES
CHANGECHARS
CHANGEDRELATIONS
CHANGEDVALUES
CHARLIST
CHGDIMS
CHR
COALESCE
COLVAL
CONTEXT function
CONVERT
CORRELATION
COS
COSH
COUNT
CUMSUM
CURRENT_DATE
CURRENT_TIMESTAMP
D
DAYOF
DBTIMEZONE
DDOF
DECODE
DEPRDECL
DEPRDECLSW
DEPRSL
DEPRSOYD
E
ENDDATE
ENDOF
EVERY
EXISTS
EXP
EVERSION
EXTBYTES
EXTCHARS
EXTCOLS
EXTLINES
EXTRACT
F
FCOPEN
FCQUERY
FILEERROR
FILEGET
FILENEXT
FILEOPEN
FILEQUERY
FILTERLINES
FINDBYTES
FINDCHARS
FINDLINES
FINTSCHED
FLOOR
FPMTSCHED
FROM_TZ
G
GET
GREATEST
GROUPINGID function
GROWRATE
H
HIERCHECK
HIERHEIGHT function
I
INFO
INITCAP
INLIST
INSBYTES
INSCHARS
INSCOLS
INSLINES
INSTAT
INSTR functions
INTPART
IRR
ISDATE
ISEMPTY
ISSESSION
ISVALUE
J
JOINBYTES
JOINCHARS
JOINCOLS
JOINLINES
K
KEY
L
LAG
LAGABSPCT
LAGDIF
LAGPCT
LARGEST
LAST_DAY
LEAD
LEAST
LIMIT function
LIMITMAPINFO
LNNVL
LOCALTIMESTAMP
LOG function
LOG10
LOWCASE
LPAD
LTRIM
M
MAKEDATE
MAX
MAXBYTES
MAXCHARS
MEDIAN
MIN
MMOF
MODE
MODULO
MONTHS_BETWEEN
MOVINGAVERAGE
MOVINGMAX
MOVINGMIN
MOVINGTOTAL
N
NA2
NAFILL
NAFLAG
NEW_TIME
NEXT_DAY
NLSSORT
NONE
NORMAL
NPV
NULLIF
NUMBYTES
NUMCHARS
NUMLINES
NUMTODSINTERVAL
NUMTOYMINTERVAL
NVL
NVL2
O
OBJ
OBJLIST
OBSCURE
P
PARTITION
PARTITIONCHECK
PERCENTAGE
Q
QUAL
R
RANDOM
RANK
RECNO
REM
REMAINDER
REMBYTES
REMCHARS
REMCOLS
REMLINES
REPLBYTES
REPLCHARS
REPLCOLS
REPLLINES
RESERVED
ROUND
ROW function
ROWIDTOCHAR
ROWIDTONCHAR
RPAD
RTRIM
RUNTOTAL
S
SESSIONTIMEZONE
SIGN
SIN
SINH
SMALLEST
SMOOTH
SORT function
SORTLINES
SQLFETCH
SQRT
STARTOF
STATALL
STATDEPTH
STATEQUAL
STATFIRST
STATLAST
STATLEN
STATLIST
STATMAX
STATMIN
STATRANK
STATVAL
STDDEV
SUBSTR functions
SUBTOTAL
SYS_CONTEXT
SYSDATE
SYSINFO
SYSTEM
SYSTIMESTAMP
T
TALLY
TAN
TANH
TCONVERT
TEXTFILL
TO_CHAR
TO_DATE
TO_DSINTERVAL
TO_NCHAR
TO_NUMBER
TO_TIMESTAMP
TO_TIMESTAMP_TZ
TO_YMINTERVAL
TOD
TODAY
TOTAL
TRANSLATE
TRIGGER function
TRIM
TRUNCATE
TZ_OFFSET
U
UNIQUELINES
UNRAVEL
UPCASE
V
VALSPERPAGE
VALUES
VINTSCHED
VPMTSCHED
W
WEEKOF
WIDTH_BUCKET
WKSDATA
WRITABLE
Y
YYOF
Functions by Category
The OLAP DML provides the typical numeric and text functions:
Conversion functions
Datetime functions
Date-only functions
Financial functions
File management functions
NA functions
Numeric (general) functions
Numeric aggregation functions
Program argument and context functions
Reporting functions
Statistical and forecasting functions
Text functions
CHANGEDVALUES
BASEDIM
EXISTS
ISEMPTY
ISSESSION
ISVALUE
LIMITMAPINFO
OBJ
OBJLIST
PARTITION
RESERVED
TALLY
TRIGGER function
VALSPERPAGE
WRITABLE
Conversion functions
BIN_TO_NUM
CHR
CONVERT
FROM_TZ
TCONVERT
TO_CHAR
TO_DATE
TO_NCHAR
TO_NUMBER
TO_TIMESTAMP
TO_TIMESTAMP_TZ
Datetime functions
ADD_MONTHS
CURRENT_DATE
CURRENT_TIMESTAMP
DBTIMEZONE
EXTRACT
FROM_TZ
LAST_DAY
LOCALTIMESTAMP
MONTHS_BETWEEN
NEW_TIME
ROUND (datetime)
NEW_TIME
NUMTODSINTERVAL
NUMTOYMINTERVAL
SESSIONTIMEZONE
SYSDATE
SYSTIMESTAMP
TO_DSINTERVAL
TO_TIMESTAMP
TO_TIMESTAMP_TZ
TO_YMINTERVAL
TOD
TRIM
TRUNCATE (datetime)
TZ_OFFSET
Date-only functions
BEGINDATE
DAYOF
DDOF
ENDDATE
ENDOF
ISDATE
MAKEDATE
MMOF
STARTOF
TODAY
WEEKOF
YYOF
Financial functions
DEPRDECL
DEPRDECLSW
DEPRSL
DEPRSOYD
FINTSCHED
FPMTSCHED
GROWRATE
IRR
NPV
VINTSCHED
VPMTSCHED
NA functions
COALESCE
NA2
NAFILL
NAFLAG
NULLIF
NVL
NVL2
TANH
TRUNCATE (number)
WIDTH_BUCKET
Reporting functions
COLVAL
RUNTOTAL
SUBTOTAL
Text functions
ASCII
BLANKSTRIP
CHANGEBYTES
CHANGECHARS
CHARLIST
EXTBYTES
EXTCHARS
EXTCOLS
EXTLINES
FILTERLINES
FINDBYTES
FINDCHARS
FINDLINES
INITCAP
INLIST
INSBYTES
INSCHARS
INSCOLS
INSLINES
INSTR functions
JOINBYTES
JOINCHARS
JOINCOLS
JOINLINES
LEAST
LENGTH functions
LOWCASE
LPAD
LTRIM
MAXBYTES
MAXCHARS
NLSSORT
NULLIF
NUMBYTES
NUMCHARS
NUMLINES
OBSCURE
REMBYTES
REMCHARS
REMCOLS
REMLINES
REPLBYTES
REPLCHARS
REPLCOLS
REPLLINES
RPAD
RTRIM
SORT function
SORTLINES
SUBSTR functions
TEXTFILL
TRANSLATE
TRIM
UNIQUELINES
UPCASE
Time-series functions
CUMSUM
LAG
LAGABSPCT
LAGDIF
LAGPCT
LEAD
MOVINGAVERAGE
MOVINGMAX
MOVINGMIN
MOVINGTOTAL
ABS
The ABS function calculates the absolute value of an expression. Since, the absolute
value of a real number is its numerical value without regard to its sign (for example, 3
is the absolute value of both 3 and -3), this function always returns a positive value.
Return Value
DECIMAL.
The dimensionality of the result is the same as the specified expression.
Syntax
ABS(expression)
Arguments
expression
The expression whose absolute value is to be calculated.
Examples
ADD_MONTHS
The ADD_MONTHS function returns the date that is n months after the specified date.
Return Value
DATETIME
Syntax
ADD_MONTHS(start_datetime, n)
Arguments
start_datetime
A DATETIME expression that identifies the starting date. When the day component of
start_datetime is the last day of the month or when the returned month has fewer days,
then the returned day component is the last day of the month. Otherwise, the day
component of the returned date is the same as the day component of start_datetime. See
Example 7–2, "End-of-Month Calculation" on page 7-15.
n
An INTEGER that identifies the number of months to be added to start_datetime.
Examples
Since February 29 was the last day of February 2000, ADD_MONTHS returns
February 29, 2000.
29-Feb-00
AGGCOUNT
The AGGCOUNT function retrieves the values of the Aggcount variable associated
with the specified variable. An Aggcount variable is an INTEGER variable that Oracle
OLAP automatically creates when it creates a variable defined using a DEFINE
VARIABLE statement that includes a USING AGGOUNT phrase.
Return Value
INTEGER
The values of the Aggcount variable that are the non-NA counts of the number of leaf
nodes that contribute to the calculation of aggregate values when RELATION (for
aggregation) statements that have an AVERAGE, HAVERAGE, WAVERAGE, or
HWAVERAGE execute.
Syntax
AGGCOUNT(variable-name)
Arguments
variable-name
The name of the variable with which the Aggcount variable is associated.
Examples
Notice that the definition for the sales variable includes a request for an Aggcount
variable and that, within the aggsales aggmap, the RELATION statement for the
time_parentrel relation incudes an AVERAGE operator.
Assume also that when only the base values of the sales variable are populated, sales
has the following values for Radios and TVs.
REPORT sales
PRODUCT: Radio
-------------SALES--------------
--------------TIME--------------
GEOG 2004 2005 Average
-------------- ---------- ---------- ----------
Maine 122.93 176.69 NA
California 168.32 150.92 NA
Quebec NA NA NA
Ontario 187.46 164.46 NA
USA NA NA NA
Canada NA NA NA
World NA NA NA
PRODUCT: TV
-------------SALES--------------
--------------TIME--------------
GEOG 2004 2005 Average
-------------- ---------- ---------- ----------
Maine 184.75 135.40 NA
California 139.89 145.71 NA
Quebec NA NA NA
Ontario 123.63 113.32 NA
USA NA NA NA
Canada NA NA NA
World NA NA NA
PRODUCT: AV
-------------SALES--------------
--------------TIME--------------
GEOG 2004 2005 Average
-------------- ---------- ---------- ----------
Maine NA NA NA
California NA NA NA
Quebec NA NA NA
Ontario NA NA NA
USA NA NA NA
Canada NA NA NA
World NA NA NA
Since no aggregation has occurred, for AV, Oracle OLAP has not yet populated the
Aggcount variable and the Aggcount variable for sales contains only NA values.
Now assume that you aggregate the sales variable by issuing the following
statement.
AGGREGATE sales USING aggsales
PRODUCT: Radio
-------------SALES--------------
--------------TIME--------------
GEOG 2004 2005 Average
-------------- ---------- ---------- ----------
Maine 122.93 176.69 149.81
California 168.32 150.92 159.62
Quebec NA NA NA
Ontario 187.46 164.46 175.96
USA 291.24 327.61 309.42
PRODUCT: TV
-------------SALES--------------
--------------TIME--------------
GEOG 2004 2005 Average
-------------- ---------- ---------- ----------
Maine 184.75 135.40 160.07
California 139.89 145.71 142.80
Quebec NA NA NA
Ontario 123.63 113.32 118.47
USA 324.64 281.11 302.87
Canada 123.63 113.32 118.47
World 448.27 394.42 421.35
PRODUCT: AV
-------------SALES--------------
--------------TIME--------------
GEOG 2004 2005 Average
-------------- ---------- ---------- ----------
Maine 307.67 312.08 309.88
California 308.21 296.63 302.42
Quebec NA NA NA
Ontario 311.09 277.78 294.43
USA 615.88 608.71 612.30
Canada 311.09 277.78 294.43
World 926.97 886.49 906.73
A report of the Aggcount variable shows that it is populated with the INTEGER values
that are needed to aggregate the average sales.
REPORT AGGCOUNT (sales)
PRODUCT: Radio
--------AGGCOUNT (SALES)--------
--------------TIME--------------
GEOG 2004 2005 Average
-------------- ---------- ---------- ----------
Maine NA NA 2
California NA NA 2
Quebec NA NA NA
Ontario NA NA 2
USA 2 2 4
Canada NA NA 2
World 3 3 6
PRODUCT: TV
--------AGGCOUNT (SALES)--------
--------------TIME--------------
GEOG 2004 2005 Average
-------------- ---------- ---------- ----------
Maine NA NA 2
California NA NA 2
Quebec NA NA NA
Ontario NA NA 2
USA 2 2 4
Canada NA NA 2
World 3 3 6
PRODUCT: AV
--------AGGCOUNT (SALES)--------
--------------TIME--------------
GEOG 2004 2005 Average
-------------- ---------- ---------- ----------
Maine 2 2 4
California 2 2 4
Quebec NA NA NA
Ontario 2 2 4
USA 4 4 8
Canada 2 2 4
World 6 6 12
AGGMAPINFO
Return Value
Varies depending on the type of information that is requested. See Table 7–1,
" Keywords for the choice Parameter of the AGGMAPINFO function" on page 7-20 for
more information.
Syntax
AGGMAPINFO (name {choice | {choice-at-position rel-pos} })
Arguments
name
The name of the aggmap object.
choice
Specifies the type of information that you want returned. See Table 7–1, " Keywords
for the choice Parameter of the AGGMAPINFO function", for details.
Table 7–1 Keywords for the choice Parameter of the AGGMAPINFO function
Keyword Data Type Description
ADDED_MODELS TEXT The models that are currently added to an aggmap
using AGGMAP ADD or REMOVE model
statements.The names of the models are returned as a
multi-line text string.
AGGINDEX BOOLEAN Indicates the setting for the AGGINDEX statement in
the aggmap. A YES setting specifies that all possible
indexes (composite tuples) are created whenever the
aggmap is recompiled. (Applies to AGGMAP type
aggmaps only.)
CHILDREN TEXT The dimension members used in the right-hand side of
member-name equations used to calculate temporary calculated
members added using MAINTAIN ADD SESSION
statements. The names of the members are returned as a
multi-line text string.
CUSTOMMEMBERS TEXT The members added using MAINTAIN ADD SESSION
statements. The names of the members are returned as a
multi-line text string.
DIMENSION TEXT The names of the dimensions of the models or relations
used by the aggmap. The names of the members are
returned as a multi-line text string.
Table 7–1 (Cont.) Keywords for the choice Parameter of the AGGMAPINFO function
Keyword Data Type Description
FCACHE BOOLEAN Indicates whether Oracle OLAP has a cache for the
AGGREGATE function. (Applies to AGGMAP type
aggmaps only.)
MAPTYPE TEXT The type of the aggmap.
■ Returns AGGMAP for an aggregation specification
(that is, when the specification has been entered
with an AGGMAP statement). You can use this
type of aggmap only with the AGGREGATE
command or AGGREGATE function.
■ Returns ALLOCMAP for an allocation specification
(that is, when the specification has been entered
with an ALLOCMAP statement). You can use this
type of aggmap only with ALLOCATE.
■ Returns NA when the aggmap has been defined but
a specification has not been entered with an
AGGMAP or ALLOCMAP statement.
MODELS TEXT The models in the aggmap. The names of the models are
returned as a multi-line text string.
NUMRELS INTEGER The total number of RELATION statements in an
aggmap specification.
RELATIONS TEXT The name of relation that is specified by a RELATION
statement in the aggmap specification. Each statement is
displayed on a separate line.
STORE BOOLEAN Indicates whether the CACHE statement in the aggmap
is set to STORE. A YES setting specifies that the data
that is calculated on the fly is stored in the cache.
(Applies to AGGMAP-type aggmaps only.)
VARIABLES TEXT The variables for which this aggmap object has been
specified as the default aggmap using AGGMAP ADD
or REMOVE model statements or the $AGGMAP
property. The names of the variables are returned as a
multi-line text string.
choice-at-position
Specifies the exactly which piece of information you want returned.
PRECOMPUTE returns the text of the limit clause that follows the PRECOMPUTE
keyword in a RELATION statement. You must use the rel-pos argument to specify a
single RELATION statement. Returns NA when the RELATION statement does not
have a PRECOMPUTE keyword. (Applies to AGGMAP type aggmaps only.)
RELATION returns the name of the relation that follows the RELATION statement that
you specify with the rel-pos argument.
STATUS returns the status list that results from the compilation of the PRECOMPUTE
clause in the RELATION statement that you specify with the rel-pos argument.
(Applies to AGGMAP type aggmaps only.)
rel-pos
An INTEGER that specifies a RELATION statement in the aggmap. The INTEGER
indicates the position of the statement in the list of RELATION statements. You can
use the rel-pos argument only with the RELATION, PRECOMPUTE, or STATUS
keywords. For example, to get information about the first RELATION statement in an
aggmap, use an INTEGER with a value of 1 as the rel-pos argument. To get information
about the fourth RELATION statement in an aggmap, use the INTEGER 4, and so on.
You may use any INTEGER between 1 and the total number of RELATION statements
in an aggmap specification. You can use the NUMRELS keyword to obtain the total
number of RELATION statements for an aggmap object.
Examples
Suppose the following specification has been added to sales.agg with an AGGMAP
statement.
AGGMAP
RELATION time.r PRECOMPUTE (time ne 'Year98')
RELATION product.r
RELATION geography.r
CACHE STORE
END
Once a specification has been added to the aggmap, you can use AGGMAPINFO to
get information about its specification.
To see the names of the hierarchies that are specified by the RELATION statements,
use the following statement.
SHOW AGGMAPINFO(sales.agg RELATIONS)
The following statement and result tell you how many RELATION statements are in
the aggmap object.
SHOW AGGMAPINFO(sales.agg NUMRELS)
3
The following statement and result verifies that data that is calculated on the fly is
stored in the cache for the session. The result is YES because the aggmap contains a
CACHE STORE statement.
show AGGMAPINFO(sales.agg STORE)
YES
The following statement displays the relation name that is specified in the second
RELATION statement in the aggmap.
SHOW AGGMAPINFO(sales.agg RELATION 2)
product.r
The following statement displays the limit clause that follows the PRECOMPUTE
keyword in the first RELATION statement in the aggmap.
SHOW AGGMAPINFO(sales.agg PRECOMPUTE 1)
time NE 'YEAR98'
Suppose the time dimension values are Jan98 to Dec99, Year98, and Year99. The
following statement displays the status list for the dimension in the first RELATION
statement in the aggmap.
SHOW AGGMAPINFO(sales.agg STATUS 1)
Jan98 TO Dec99, Year99
Because the limit clause in the RELATION statement specifies that the time
dimension values should not equal Year98, all time dimension values other than
Year98 are included in its status.
The following statement displays the aggmap type of sales.agg.
SHOW AGGMAPINFO(sales.agg MAPTYPE)
AGGMAP
AGGREGATE function
The AGGREGATE function calculates the data in the variable that is not specified as
PRECOMPUTE in the specified aggmap. (For information about specifying
precompute data, see PRECOMPUTE statement and the PRECOMPUTE clause of the
RELATION (for aggregation) statement .) The aggregation is limited to those values
that are currently in status.
Return Value
The same data type as the aggregated variable.
Syntax
AGGREGATE (var ... [USING aggmap] -
[FROM fromspec|FROMVAR textvar] [FORCECALC FORCEORDER] [COUNTVAR countvar])
Arguments
var
The name of the variable whose data will be calculated (if necessary) and returned.
USING
This keyword indicates that the aggregation is performed using the specified aggmap.
aggmap
The name of a previously-defined aggmap that specifies how the data will be
aggregated. For information about aggmaps, see DEFINE AGGMAP.
FROM
This keyword indicates that the detail data is obtained from a different object. A
FROM clause is only one way in which you can specify the variable from which detail
data should be obtained when performing aggregation. See "Ways of Specifying Where
to Obtain Detail Data for Aggregation" on page 9-63.
fromspec
An arbitrarily dimensioned variable, formula, or relation from which the detail data
for the aggregation is obtained.
FROMVAR
This keyword indicates that the detail data is obtained from different objects to
perform a capstone aggregation. A FROMVAR clause is only one way in which you
can specify the variable from which detail data should be obtained when performing
aggregation. See "Ways of Specifying Where to Obtain Detail Data for Aggregation" on
page 9-63.
textvar
An arbitrarily dimensioned variable used to resolve any leaf nodes. Specify NA to
indicate that a node does not need detail data to calculate the value.
FORCECALC
Specifies that any value that is not specified in a PRECOMPUTE clause of a
RELATION statement that are in the aggmap should be recalculated, even when there
is a value stored in the desired cell. Use the FORCECALC keyword when you want
users to be able to change detail data cells and see the changed values reflected in
dynamically-computed aggregate cells.
FORCEORDER
Specifies that the calculation must be performed in the order in which the RELATION
statements are listed in the aggmap. Use this option when you have changed some of
the values calculated by the AGGREGATE command. Otherwise, the optimization
methods used by the AGGREGATE function may cause the modified values to be
ignored. FORCEORDER will slow performance.
COUNTVAR countvar
Indicates that Oracle OLAP should use the user-defined variable specified by countvar
to store the non-NA counts of the number of leaf nodes that contributed to aggregate
values calculated for RELATION (for aggregation) statements that have an
AVERAGE, HAVERAGE, HWAVERAGE, or WAVERAGE operator.
The countvar variable must be an INTEGER variable with exactly the same dimensions
in exactly the same order as the dimensions of the variable specified by var. When you
aggregate several variables together, you must define an INTEGER variable for each
one to record the results.
Notes
A statement such as REPORT SALES will now execute the AGGREGATE function, so
that computed values are returned instead of NAs.
When you cannot answer "yes" to this question with confidence, you should not use
the AGGREGATE function with multiple aggmaps.
Examples
This section contains several examples of using the AGGREGATE function. For
additional aggregation examples, see the examples for the AGGMAP command.
Now you create two aggmap objects with the following definitions. Note that in this
case the capstone_aggmap consists of a RELATION statement with a PRECOMPUTE
NA clause.
DEFINE LEAF_AGGMAP AGGMAP
AGGMAP
RELATION geog.parentrel OPERATOR SUM
END
END
In Example 9–31, "Capstone Aggregation" on page 9-66, the final capstone aggregation
is performed using an AGGREGATE command. In this example, the capstone
aggregation is defined as a formula named f_sales_capstone76 that has an
AGGREGATE function as the expression of the formula.
DEFINE F_SALES_CAPSTONE76 FORMULA INTEGER <GEOG.D TIME.D>
EQ AGGREGATE ( sales_capstone76 USING capstone_aggmap fromvar capstone_source)
When you report on the unaggregated variables and formulas in your analytic
workspace, you see the following results.
GEOG.D SALES_JAN76 SALES_FEB76 SALES_MAR76
-------------- -------------- -------------- --------------
Boston 1,000 2,000 3,000
Medford 2,000 4,000 6,000
San Diego 3,000 6,000 9,000
Sunnydale 4,000 8,000 12,000
Massachusetts NA NA NA
California NA NA NA
United States NA NA NA
--------------------F_SALES_CAPSTONE76---------------------
--------------------------TIME.D---------------------------
GEOG.D Jan76 Feb76 Mar76 76Q1
-------------- -------------- -------------- -------------- --------------
Boston 1,000 2,000 3,000 6,000
Medford 2,000 4,000 6,000 12,000
San Diego 3,000 6,000 9,000 18,000
Sunnydale 4,000 8,000 12,000 24,000
Massachusetts NA NA NA NA
California NA NA NA NA
United States NA NA NA NA
---------------------SALES_CAPSTONE76----------------------
--------------------------TIME.D---------------------------
GEOG.D Jan76 Feb76 Mar76 76Q1
-------------- -------------- -------------- -------------- --------------
Boston 1,000 2,000 3,000 NA
Medford 2,000 4,000 6,000 NA
San Diego 3,000 6,000 9,000 NA
Sunnydale 4,000 8,000 12,000 NA
Massachusetts NA NA NA NA
California NA NA NA NA
United States NA NA NA NA
Now you aggregate the leaf variables using the following AGGREGATE statement.
AGGREGATE sales_jan76 sales_feb76 sales_mar76 USING leaf_aggmap
While a report of the sales_capstone76 variable does not show the aggregated
values for 76Q1 since they are not stored in the variable.
---------------------SALES_CAPSTONE76----------------------
--------------------------TIME.D---------------------------
GEOG.D Jan76 Feb76 Mar76 76Q1
-------------- -------------- -------------- -------------- --------------
Boston 1,000 2,000 3,000 NA
Medford 2,000 4,000 6,000 NA
San Diego 3,000 6,000 9,000 NA
Sunnydale 4,000 8,000 12,000 NA
Massachusetts 3,000 6,000 9,000 NA
California 7,000 14,000 21,000 NA
United States 10,000 20,000 30,000 NA
The parent relation for the product dimension contains these values.
PRODUCT.PA
PRODUCT RENTREL
---------- ----------
Food Na
Snacks Food
Drinks Food
Popcorn Snacks
Cookies Snacks
Cakes Snacks
Soda Drinks
Juice Drinks
In the units variable, data is stored only at the lowest level of each dimension
hierarchy.
-------------------UNITS-------------------
-------------------TIME--------------------
PRODUCT Jan01 Feb01 Mar01 Q1.01
----------- ---------- ---------- ---------- ----------
Food NA NA NA NA
Snacks NA NA NA NA
Drinks NA NA NA NA
Popcorn 2 2 4 NA
Cookies 3 6 3 NA
Cakes 4 4 2 NA
Soda 7 3 9 NA
Juice 1 3 2 NA
The aggmap specifies that all data will be calculated on the fly.
DEFINE tp.agg AGGMAP
LD <time product> Aggmap
AGGMAP
RELATION time.parentrel PRECOMPUTE (NA)
RELATION product.parentrel PRECOMPUTE (NA)
END
The following REPORT statement uses the AGGREGATE function to calculate the
data.
REPORT aggregate(units USING tp.agg)
-------------------UNITS-------------------
-------------------TIME--------------------
PRODUCT Jan01 Feb01 Mar01 Q1.01
----------- ---------- ---------- ---------- ----------
Food 17 18 20 55
Snacks 9 12 9 30
Then the AGGREGATE function calculates all aggregations except AA, as shown here.
REPORT AGGREGATE(units USING letter.aggmap)
AGGREGATE(UNITS
LETTER USING LETTER.AGGMAP)
-------------- --------------------
A 3
AA NA
AB 3
AAB 2
ABA 1
ABB 2
AAAA 1
AABA 2
ABAA 1
ABBB 1
ABBA 1
...
AGGREGATION
Within a model, the AGGREGATION function allows you to create a model that
represents a custom aggregate. Such an aggmap can be used for dynamic aggregation
with the AGGREGATE function.
Syntax
AGGREGATION(dimval-list)
Arguments
dimval-list
A list of one or more dimension values to include in the custom aggregation. The
specified values must belong to the same dimension to which the target dimension
value belongs. You must specify each dimension value as a text literal. That is, they
cannot be represented by a text expression such as a variable.
Examples
2. Define the model mytime_custagg and set the specification of the model using
the AGGREGATION function.
DEFINE mytime_custagg MODEL
MODEL JOINLINES('DIMENSION time' 'My_Time = AGGREGATION(\'23\' \'24\')')
(Note that backslash escape characters are required to include quotation marks
within a quoted string.)
3. Define the sales_aggmap aggmap.
DEFINE sales_aggmap AGGMAP <time cpc <customer product channel> >
AGGMAP
RELATION prntrel.time
RELATION prntrel.chan
RELATION prntrel.prod
RELATION prntrel.cust
END
AGGROPS
The AGGROPS function returns the keywords for all of the aggregation operators that
you can specify in a RELATION (for aggregation) statement, listed one name on each
line in a multiline text value.
Return Value
TEXT
Syntax
AGGROPS
Example
SUM
WSUM
SSUM
AND
OR
FIRST
LAST
HFIRST
HLAST
AVERAGE
WAVERAGE
HAVERAGE
HWAVERAGE
MIN
MAX
WFIRST
WLAST
HWFIRST
HWLAST
WMIN
WMAX
NOAGG
ALLOCOPS
The ALLOCOPS function returns the keywords for all of the allocation operators that
you can specify in a RELATION (for allocation) statement, listed one name on each
line in a multiline text value.
Return Value
TEXT
Syntax
ALLOCOPS
Examples
FIRST
LAST
HFIRST
HLAST
MIN
MAX
EVEN
HEVEN
COPY
HCOPY
PROPORTIONAL
ANTILOG
The ANTILOG function calculates the value of e (the base of natural logarithms) raised
to a specific power.
Return Value
DECIMAL
Syntax
ANTILOG(n)
Arguments
n
The power of e to be returned by the ANTILOG function.
Examples
ANTILOG10
Return Value
DECIMAL
Syntax
ANTILOG10(n)
Arguments
n
The power of 10 to be returned by the ANTILOG10 function.
Examples
Example 7–13 Calculating the Value of Ten Raised to the Third Power
The following function calculates the value of 10 raised to the third power.
ANTILOG10(3)
ANY
The ANY function returns YES when any values of a Boolean expression are TRUE, or
NO when none of the values of the expression are TRUE.
Return Value
BOOLEAN.
Syntax
ANY(boolean-expression [CACHE] [dimension ...] )
Arguments
boolean-expression
The Boolean expression to be evaluated
CACHE
Specifies slightly different internal behavior. Specify this keyword only when the
original performance is extrememly slow.
dimension
The name of a dimension of the result; or, the name of a relation between one of the
dimensions of boolean-expression and another dimension that you want as a dimension
of the result.
By default, ANY returns a single YES or NO value. When you indicate one or more
dimensions for the result, ANY tests for TRUE values along the dimensions that are
specified and returns an array of values. Each dimension must be either a dimension
of boolean-expression or related to one of its dimensions.
Notes
related dimension. Oracle OLAP uses the implicit relation between these dimensions.
To control the mapping of one of these dimension to another (for example, from weeks
to months), you can define an explicit relation between the dimensions and specify the
name of the relation as the dimension argument to the ANY function.
For each time period in the related dimension, Oracle OLAP tests the data values for
all the source time periods that end in the target time period. This method is used
regardless of which dimension has the more aggregate time periods.
Examples
ARCCOS
The ARCCOS function calculates the angle value (in radians) of a specified cosine.
Return Value
DECIMAL
Syntax
ARCCOS(expression)
Arguments
expression
An expression that contains the decimal value of a cosine.
Notes
Examples
ARCSIN
The ARCSIN function calculates the angle value (in radians) of a specified sine.
Return Value
DECIMAL
Syntax
ARCSIN(expression)
Arguments
expression
An expression that contains the decimal value of a sine.
Notes
Examples
ARCTAN
The ARCTAN function calculates the angle value (in radians) of a specified tangent.
To retrieve a full-range (0 - 2 pi) numeric value indicating the arc tangent of a given
ratio, use ARCTAN2.
Return Value
DECIMAL
Syntax
ARCTAN(expression)
Arguments
expression
An expression that contains the decimal value of a tangent.
Examples
ARCTAN2
The ARCTAN2 function returns a full-range (0 - 2 pi) numeric value indicating the arc
tangent of a given ratio. The function returns values in the range of -pi to pi,
depending on the signs of the arguments. The values are expressed in radians.
To calculate the angle value (in radians) of a specified tangent that is not a ratio, use
ARCTAN.
Return Value
NUMBER
Syntax
ARCTAN2 (n / m)
Arguments
n
A numeric expression that specifies one component of the ratio. The argument n can
be in an unbounded range.
m
A numeric expression that specifies the other component of the ratio.
Examples
.982793723
ARG
Within an OLAP DML program, the ARG function lets you reference arguments
passed to a program. The function returns one argument as a text value.
Return Value
TEXT
Syntax
ARG(n)
Arguments
n
The number by position of the argument whose value you want to reference. ARG(1)
returns the first argument to the program, ARG(2) returns the second argument, and
so forth. When the program is called with fewer than n arguments, ARG returns a null
value. ARG also returns a null value when n is zero or negative.
Examples
To run the program, you specify the program name (salesrpt) followed by two sets
of months to mark the beginning and the end of the two periods of sales to be
reported. Then, when the LIMIT MONTH statements are executed, Oracle OLAP passes
the months specified on the command line as return values for ARG(1), ARG(2),
ARG(3), and ARG(4) in the LIMIT commands.
salesrpt 'Jan95' 'Mar95' 'Jan96' 'Mar96'
ARGCOUNT
Within an OLAP DML program, the ARGCOUNT function returns the number of
arguments that were specified when the current program was invoked.
Return Value
INTEGER
Syntax
ARGCOUNT
Examples
ARGFR
Within an OLAP DML program, the ARGFR function lets you reference the arguments
that are passed to a program. The function returns a group of one or more arguments,
beginning with the specified argument number, as a single text value. You can use
ARGFR only within a program that is invoked as a command, not as a user-defined
function or with a CALL statement.
Return Value
TEXT
Syntax
ARGFR(n)
Arguments
n
The number by position of the first argument in the group of arguments you want to
reference. ARGFR(1) returns the first argument and all subsequent arguments,
ARGFR(2) returns the second argument and all subsequent arguments, and so forth.
When there are fewer than n arguments, ARGFR returns a null value. ARGFR also
returns a null value when n is 0 (zero) or negative.
Examples
The command line for the salesrpt program must include two or more arguments.
The first argument is the product for the report, and the second and subsequent
arguments are the months. In the LIMIT month statement, the &ARGFR(2) function
returns the months that were specified as arguments on the command line.
The following statement executes the salesrpt program, specifying Jan96, Feb96,
Mar96, and Apr96 for the values of month.
salesrpt 'Canoes' 'Jan96' TO 'Apr96'
ARGS
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.
Return Value
TEXT
When no arguments have been specified for the program, ARGS returns a null value
Syntax
ARGS
Examples
When you execute the following statement, the LIMIT command will use the values
Jan96 and Feb96 for the month dimension.
salesrpt 'Jan96' 'Feb96'
ASCII
The ASCII function returns the decimal representation of the first character of an
expression.
Return Value
INTEGER.
Syntax
ASCII (text-exp)
Arguments
text-exp
A text expression.
Notes
Examples
AVERAGE
Return Value
DECIMAL
Syntax
AVERAGE(expression [CACHE] [dimension ...] )
Arguments
expression
The expression whose values are to be averaged.
CACHE
Specifies slightly different internal behavior. Specify this keyword only when the
original performance is extrememly slow.
dimension
The name of a dimension of the result; or, the name of a relation between one of the
dimensions of expression and another dimension that you want as a dimension of the
result.
By default, AVERAGE returns a single value. When you indicate one or more
dimensions for the result, AVERAGE calculates values along the dimensions that are
specified and returns an array of values. Each dimension must be either a dimension
of expression or related to one of its dimensions.
Notes
(for example, from weeks to months), you can define an explicit relation between the
two dimensions and specify the name of the relation as the dimension argument to the
AVERAGE function.
For each time period in the related dimension, Oracle OLAP averages the data for all
the source time periods that end in the target time period. This method is used
regardless of which dimension has the more aggregate time periods. To control the
way in which data is aggregated or allocated between the periods of two dimensions,
you can use the TCONVERT function.
Examples
You might also want to see the average monthly sales for each region. Since the
region dimension is related to the district dimension, you can specify region
instead of district as a dimension for the results of AVERAGE.
AW function
Return Value
The return value depends on the keyword you specify, as described in Table 7–2,
" Keywords for AW Function" on page 7-54.
Syntax
AW(keyword [workspace])
Arguments
keyword
Indicates the specific information you want. The keywords that you can use with the
AW function are listed in Table 7–2, " Keywords for AW Function" with the data type
of the value they return and the meaning of the information.
workspace
A text expression that indicates the name of the workspace for which you want
information. When you do not specify this argument, the AW function ordinarily
returns information about the current workspace. The ATTACHED, LIST, and NAME
keywords are exceptions to this rule.
Notes
Examples
BACK
The BACK function returns the names of all currently executing programs, listed one
name on each line in a multiline text value. When more than one program is executing,
this means that one program has called another in a series of nested executions.
The first name in the return value is that of the program containing the call to BACK.
The last name is that of the initial program, which made the first call to another
program.
BACK can only be used in a program.
Return Value
TEXT
Syntax
BACK
Examples
BASEDIM
The BASEDIM function loops over a concat dimension and returns the name of the
dimension from which the current value of a concat dimension comes.
Return Value
TEXT
Syntax
BASEDIM(concatdim [LEAF])
Arguments
concatdim
Specifies the concat dimension for which you want the names of the base or
component dimensions. The data type of the values returned is TEXT.
LEAF
The LEAF keyword causes BASEDIM to return the names of the component
dimensions of the concatdim dimension. The base dimensions of a concat dimension
are the simple, conjoint, or other concat dimensions that you specify with the
basedimlist argument when you define the concat. Simple dimensions and conjoint
dimensions are the bottom-level components, or leaves, of a concat dimension.
When you specify a concat dimension as a base dimension when defining a concat,
then the base dimensions of that inner concat are component dimensions of the outer
concat. Using the LEAF keyword results in BASEDIM returning the names of the
component simple and conjoint dimensions of the inner concat dimension.
When the base dimensions are all simple dimensions or conjoint dimensions, then the
base dimensions are the bottom-level components and therefore BASEDIM returns the
names of those dimensions whether or not you use the LEAF keyword.
When the base dimensions are all simple dimensions or conjoint dimensions, then the
base dimensions are the bottom-level components and therefore BASEDIM returns the
names of those dimensions whether or not you use the LEAF keyword.
Examples
PRODUCT
PRODUCT
REGION.DISTRICT
REGION.DISTRICT
REGION.DISTRICT
REGION.DISTRICT
REGION.DISTRICT
REGION.DISTRICT
BASEVAL
The BASEVAL function loops over a concat dimension and returns the values of the
base dimensions of a concat dimension. When a base dimension is a concat dimension,
then the values of its base dimensions are returned, also.
Return Value
The following are the rules that determine the data types of the values returned by
BASEVAL:
■ The data type of the return value is NTEXT when any of the component
dimensions of concatdim is of type NTEXT, or when any component dimension is a
conjoint that uses a simple dimension of type NTEXT.
■ The data type of the return value is the data type of the component dimensions
when all of the component dimensions have the same data type and when none of
the component dimensions is a conjoint.
■ The data type of the return value is TEXT in all other cases.
Syntax
BASEVAL(concatdim)
Arguments
concatdim
Specifies the concat dimension for which you want the base values. The data types of
the values returned depend on the data types of the base dimensions of the concat
dimension.
Examples
The data type of the returned values is NTEXT. The BASEVAL function converted the
v1 and v2 TEXT values into NTEXT values before returning them.
BEGINDATE
Note: You cannot use this function for time dimensions that are
implemented as hierarchical dimensions of type TEXT.
Return Value
DATE-only or text
When all the values of the expression are NA, BEGINDATE returns NA.
Syntax
BEGINDATE(expression)
Arguments
expression
The expression must have exactly one dimension that has a type of DAY, WEEK,
MONTH, QUARTER, or YEAR.
Examples
BIN_TO_NUM
Return Values
NUMBER
Syntax
BIN_TO_NUM(expression [, expression ]... )
Arguments
expression
An expression that evaluates to either 0 (zero) or 1 (one) which is the value of a bit in
the bit vector.
Examples
BITAND
The BITAND function computes a logical AND operation on the bits of two
nonnegative values. This function is commonly used with the DECODE function.
An AND operation compares two bit values. When the values are the same, the
operator returns 1. When the values are different, the operator returns 0. Only
significant bits are compared. For example, an AND operation on the integers 5
(binary 101) and 1 (binary 001 or 1) compares only the rightmost bit, and results in a
value of 1 (binary 1).
Return Value
INTEGER
Syntax
BITAND (argument1 , argument2)
Arguments
argument1
A nonnegative INTEGER expression.
argument2
A nonnegative INTEGER expression.
Examples
See Example 7–65, "DECODE with BITAND" on page 7-106.
BLANKSTRIP
The BLANKSTRIP function removes leading or trailing blank spaces from text values.
BLANKSTRIP is useful for such purposes as removing unwanted blank spaces from
imported fixed-length fields.
Return Value
TEXT or NTEXT
Syntax
BLANKSTRIP(text-expression [TRAILING|LEADING|BOTH])
Arguments
text-expression
A text expression from which to remove blank spaces. When you specify a TEXT
expression, the return value is TEXT. When you specify an NTEXT expression, the
return value is NTEXT.
TRAILING
Removes blank spaces at the end of the text.
LEADING
Removes blank spaces at the beginning of the text.
BOTH
Removes both leading and trailing spaces.
Examples
CALLTYPE
Return Value
TEXT
The return value of CALLTYPE is:
■ FUNCTION when the program was invoked as a function that returns a value.
■ COMMAND when the program was invoked as a a command.
■ CALL when the program was invoked using a CALL statement.
■ TRIGGER when the program is a trigger program (that is, when a TRIGGER
command associated the program with an object event) was invoked in response
to a OLAP DML statement.
Syntax
CALLTYPE
Examples
The three statements send the following output to the current outfile. Note that the
return value of myprog appears only when the program is called as a function.
COMMAND
CALL
FUNCTION
This is the return value
CATEGORIZE
The CATEGORIZE function groups the values of a numeric expression into categories.
You define the categories by specifying a series of increasing numeric values. The
result that CATEGORIZE returns is dimensioned by all the dimensions of expression.
For each cell in expression, CATEGORIZE returns one of the following: the category in
which the number falls, zero (0) for a value below the range of the first category,
minus one (-1) for a value above the range of the last category, or NA for an NA value.
Return Value
DECIMAL
Syntax
CATEGORIZE(expression {values|group-expression})
where values has the following syntax:
bottom-value [next-lowest-break-value] top-value
Arguments
expression
The numeric expression whose values are to be categorized.
bottom-value
A number that specifies the lowest number in the series and sets the bottom limit of
category 1.
next-lowest-break-value
A number that specifies the beginning of the range of the next category.
top-value
A number that specifies the highest number in the series and sets the upper limit of the
highest category.
group-expression
A one-dimensional numeric expression that defines the break values for the categories.
Examples
This statement reports the result of calling the CATEGORIZE function with the sales
variable as the expression argument and the groupvals variable as the
group-expression argument of the call.
REPORT CATEGORIZE(sales, groupvals)
The preceding statement produces the same output as the statement in the "Specifying
Category Range Values" on page 7-67.
CEIL
The CEIL function returns the smallest whole number greater than or equal to a
specified number.
Return Value
NUMBER
Syntax
CEIL(n)
Arguments
n
A number (NUMBER data type) that you specify.
Examples
Example 7–38 Displaying the Smallest Integer Greater Than or Equal to a Number
The following statements show results returned by CEIL.
■ The statement
SHOW CEIL(15.7)
■ The statement
SHOW CEIL(-6.457)
CHANGEBYTES
Return Value
TEXT
Syntax
CHANGEBYTES(text-expression oldtext newtext [number])
Arguments
text-expression
A TEXT expression in which bytes are to be changed. When text-expression is a
multiline TEXT expression, CHANGEBYTES preserves the line breaks in the returned
value.
oldtext
A TEXT expression that contains one or more bytes that will be changed.
newtext
A TEXT expression that contains one or more bytes that will replace oldtext.
number
An INTEGER that represents the number of times oldtext should be replaced with
newtext when oldtext appears more than once in text-expression. The default is to change
all occurrences of oldtext.
Examples
CHANGECHARS
Return Value
When all arguments are TEXT values, the return value is TEXT. When all arguments
are NTEXT values, the return value is NTEXT. When the arguments include both
TEXT and NTEXT values, the function converts all TEXT values to NTEXT before
performing the function operation, and the return value is NTEXT.
Syntax
CHANGECHARS(text-expression oldtext newtext [number] [UPCASE])
Arguments
text-expression
The TEXT or NTEXT expression in which characters are to be changed. When
text-expression is a multiline text value, CHANGECHARS preserves the line breaks in
the returned value.
oldtext
A TEXT or NTEXT expression that contains one or more characters that will be
changed.
newtext
A TEXT or NTEXT expression that contains one or more characters that will replace
oldtext.
number
An INTEGER that represents the number of times oldtext should be replaced with
newtext when oldtext appears more than once in text-expression. The default is to change
all occurrences of oldtext.
UPCASE
Specifies that CHANGECHARS should uppercase text-expression and oldtext before
trying to find a match. CHANGECHARS does not uppercase the return value.
Examples
CHANGEDRELATIONS
Return Value
BOOLEAN.
TRUE when changes have occurred, FALSE when they have not, or NA when the
function can not determine if changes have occurred.
Syntax
CHANGEDRELATIONS( variable [ [(partition ...) ] aggmap] )
Arguments
variable
The name of the variable whose aggmap object you want to check for changes.
partition
The name of one or more partitons, separated by commas, whose aggmap you want to
check for changes.
aggmap
The name of the aggmap object you want to check for changes. When you do not
specify a value for aggmap, the function uses the aggmap specified in the $AGGMAP
property for variable, if any.
CHANGEDVALUES
The CHANGEDVALUES function identifies if any value in a variable has changed (or
the number of values that have changed) since the last time a variable was aggregated.
Return Value
BOOLEAN unless you specify NUMBER for returntype.
When the function returns a BOOLEAN value, that value is TRUE when any value has
changed since the variable was last aggregated, FALSE when no values have changed,
or NA when the function cannot determine if any values have changed or not.
When the function returns a NUMBER value, that value is the number of values that
have changed since the variable was last aggregated.
Syntax
CHANGEDVALUES ( variable [(partition ...)] [returntype] )
Arguments
variable
The name of the variable that you want to check for changed values.
partiton
The name of one or more partitions, separated by commas, that you want to check for
changed values.
returntype
NUMBER when you want the function to return a numeric value that is the number of
values that have changed. When you want the function to return whether or not any
value has changed since the last aggregation, specify BOOLEAN or leave this
argument empty as BOOLEAN is the default value for returntype.
CHARLIST
The CHARLIST function transforms an expression into a multiline text value with a
separate line for each value of the original expression.
Return Value
NTEXT when the expression is NTEXT; otherwise, TEXT.
Syntax
CHARLIST(expression [dimensions])
Arguments
expression
The expression to be transformed into a multiline text value. When the expression has
a data type other than TEXT or NTEXT, CHARLIST automatically converts the
expression to TEXT.
dimensions
The dimensions of the return value. When you do not specify a dimension, CHARLIST
returns a single value. When you provide one or more dimensions for the return
value, CHARLIST returns a multiline text value for each value in the current status list
of the specified dimension. Each dimension must be an actual dimension of the
expression; it cannot be a related or base dimension.
Examples
CHARTOROWID
The CHARTOROWID function converts a value from a text data type to ROWID data
type.
Return Value
ROWID
Syntax
CHARTOROWID(char)
Arguments
char
A text expression that you want to convert.
Examples
As the following code illustrates, you can add text values to it using the
CHARTOROWID function.
MAINTAIN erowid ADD CHARTOROWID('AAAFd1AAFAAAABSAA/')
REPORT erowid
EROWID
------------------------------
AAAFd1AAFAAAABSAA/
CHGDIMS
Return Value
Data type of the original expression.
Syntax
CHGDIMS (expression, limit-type)
where limit-type is one of the following:
[CACHE] LIMITSAVE valueset-list
[CACHE] LIMIT valueset-list
TO dimension-list
ADD dimension-list
Arguments
expression
The expression you want to modify.
CACHE
Specifies that Oracle OLAP caches the result of the limit and saves it for use in
subsequent executions of CHGDIMS until the OLAP DML statement that called
CHGDIMS finishes execution.
LIMITSAVE
Specifies that Oracle OLAP sets the value of dimension status for expression to the
position before the CHGDIMS command executed (that is, specifying LIMITSAVE
does not change the current dimension status value). For example, you specify
CHGDIMS with LIMITSAVE if expression is the LAG function so that the lag is from
the current value; or if you are coding CHGDIMS inside of an outer loop, like a SQL
SELECT statement, and you want to keep the dimension status value set by the outer
loop.
LIMIT
Specifies the Oracle OLAP sets the value of dimension status for expression to the first
position in the new status before evaulating expression in much the same way as if a
LIMIT TO command was issued just before evaluating expression.
valueset-list
The name of a valueset or the LIMIT function.
TO dimension-list
Specifies that Oracle OLAP evaluate expression as though the dimensions of expression
are the dimensions specified by dimension-list.
ADD dimension-list
Specifies that Oracle OLAP evaluateexpression as though the dimensions of expression
are the dimensions of expression plus the dimensions specified by dimension-list
Examples
Assume that you have the following objects in your analytic workspace.
DEFINE PRODUCT DIMENSION TEXT
DEFINE GEOG DIMENSION TEXT
DEFINE SALES VARIABLE INTEGER <PRODUCT GEOG>
Assume, also, that the sales variable has the following values.
-------------------SALES-------------------
------------------PRODUCT------------------
GEOG Trousers Skirts Dresses Shoes
-------------- ---------- ---------- ---------- ----------
USA 13 20 32 18
Canada 17 32 15 28
The following lines of code show how the value returned by a TOTAL(sales)
expression varies depending on how you qualify that expression.
"Total over all dims with standard status
SHOW TOTAL(sales)
175
CHR
The CHR function converts an integer value (or any value that can be implicitly
converted to an integer value) into a character.
Return Value
A text value. For single-byte character sets, if number > 256, the function returns the
binary equivalent of number MOD 256. For multibyte character sets, number must
resolve to one entire code point. Invalid code points are not validated, and the result of
specifying invalid code points is indeterminate.
Syntax
CHR(number [ USING NCHAR_CS ])
Arguments
number
An integer value, or any value that can be implicitly converted to an integer value.
USING NCHAR_CS
Specifies that the function returns the value in the national character set. When you do
not specify this clause, the function returns the value in the database character set.
Examples
COALESCE
The COALESCE function returns the first non-NA expression in a list of expressions, or
NA when all of the expressions evaluate to NA.
Return Value
Data type of the first argument.
Syntax
COALESCE (expr [, expr]...)
Arguments
expr
An expression.
Examples
The following code illustrates limiting supplier_id to a single value and displaying
a report that shows the list price, minimum price, and sale price for the products
provided by that supplier.
LIMIT supplier_id TO '102050'
REPORT DOWN product_id list_price min_price sale
----------SUPPLIER_ID-----------
-------------102050-------------
PRODUCT_ID LIST_PRICE MIN_PRICE SALE
-------------- ---------- ---------- ----------
2382 850.00 731.00 765.00
3355 NA NA 5.00
1770 NA 73.00 73.00
2378 305.00 247.00 274.50
1769 48.00 NA 43.20
1660 16.45 16.45 14.80
COLVAL
The COLVAL function returns a numeric value from a column to the left of the current
column in the same row of a report. COLVAL can only be used in the ROW command
and the REPORT command.
Return Value
DECIMAL when the selected column contains numeric or Boolean data; NA when the
column (n) contains only a TEXT or ID value; or an error when the specified column is
the current column, a column to the right of the current column, or a nonexistent
column
Syntax
COLVAL(n)
Arguments
n
The number of the column in the current row whose value you want; n can be any
INTEGER expression.
Use a positive number to identify an absolute column number (counting left to right
from the left margin of the report). In figuring an absolute column number, you must
count all columns shown in the report. For example, this means that when you are
using a REPORT command that produces a column of labels down the left side of the
report, you count this column of labels as column 1.
For example, COLVAL(2) identifies the second column from the left margin of the
report.
Use a negative number to identify a relative column number (counting right to left
from the current column). For example, COLVAL(-2) identifies the column that is two
columns to the left of the current column.
Examples
CONTEXT function
The CONTEXT function lets you obtain information about object values that are saved
in a context. You must first create the context with the CONTEXT command.
Return Value
The data type of the return value of the CONTEXT function depends on the arguments
you provide. When you use the CONTEXT function without supplying any
arguments, it returns a multiline text value that contains the names of all the contexts
in the current session.
Syntax
CONTEXT ([context-name [UPDATE|name]])
Arguments
context-name
A text expression that contains the name of the context. Using the CONTEXT function
with only the context-name returns a multiline text value that contains the names of all
the objects saved in that context.
UPDATE
When you specify UPDATE with the CONTEXT function, the return value is the
number of times values have been saved or dropped from the context.
name
The name of an object whose value is saved in the context. When you specify name
with the CONTEXT function, the return value is the saved status or value of that
object.
Examples
CONVERT
The CONVERT function converts values from one type of data to another.
Return Value
The return value depends on the value of the type argument.
Syntax
CONVERT(expression, type [argument...])
Arguments
expression
The expression or variable to be converted.
type
The type of data to which you want to convert expression. The keywords that represent
the types are described in Table 7–3, " Keywords for the type Argument of the
CONVERT Function".
Table 7–3 Keywords for the type Argument of the CONVERT Function
Keyword Description
BINARY Does not indicate conversion to a standard Oracle data type but allows
additional conversion capabilities. BINARY does no conversion. The
internal representation of every value, regardless of data type, is
returned as a text value.
■ For TEXT data types, the result will be the value itself and will
therefore be of variable length.
■ For ID and DECIMAL data types, the result will be 8 bytes long; ID
values will be blank filled, when necessary.
■ For BOOLEAN or INTEGER, the default result will be 2 or 4 bytes
long respectively (see the arguments explanation for an additional
argument that lets you vary the width slightly).
■ For all other data types, the result will be 4 bytes long.
See "PACKED and BINARY Conversion" on page 7-88.
BOOLEAN Conversion to Oracle OLAP BOOLEAN data type.
BYTE Converts a single character into an ASCII INTEGER value in the range 0
to 255. Or BYTE converts an INTEGER within this range into a character.
An INTEGER outside this range is taken modulo 256 and then converted;
that is, 256 is subtracted from the INTEGER until the remainder is less
than 256, and that within-range remainder is then converted into a
character.
DATE Conversion to Oracle OLAP DATE data type.
DATETIME Conversion to Oracle OLAP DATETIME data type.
DECIMAL Conversion to Oracle OLAP DECIMAL data type.
DSINTERVAL Conversion to Oracle OLAP DML DSINTERVAL data type.
ID Conversion to Oracle OLAP ID data type.
Table 7–3 (Cont.) Keywords for the type Argument of the CONVERT Function
Keyword Description
INFILE Encloses an ID, TEXT, DATE, or RELATION value within single quotes,
so that it can be read with an INFILE statement. This means that
expression must have ID, TEXT, DATE, or RELATION value values. In the
case of TEXT values with no alphanumeric equivalent, INFILE converts
them to the correct escape sequences.
INTEGER Conversion to Oracle OLAP INTEGER data type.
LONGINTEGER Conversion to Oracle OLAP LONGINTEGER data type.
NTEXT Conversion to standard Oracle OLAP data types. Corresponds to the
NCHAR and NVARCHAR2 SQL data types. An NTEXT character is encoded
in UTF8 Unicode. This encoding might be different from the NCHAR
character set of the database, which can be UTF16. A conversion from
NTEXT to TEXT can result in data loss when the NTEXT value cannot be
represented in the database character set.
NUMBER Conversion to Oracle OLAP NUMBER data type.
[(p,[s])]
PACKED Converts a number to a decimal value and then to packed format -- a text
value 8 bytes long containing 15 digits and a plus or minus sign.
Fractions cannot be represented in packed numbers; therefore the
conversion process rounds decimal numbers to the nearest INTEGER.
See "PACKED and BINARY Conversion" on page 7-88.
ROWID Converts a text value to a ROWID value.
SHORTDECIMAL Conversion to Oracle OLAP SHORTDECIMAL data type.
SHORTINTEGER Conversion to Oracle OLAP SHORTINTEGER data type.
TEXT Conversion to standard Oracle OLAP data types. Corresponds to CHAR
and VARCHAR2 data types in SQL. A TEXT character is encoded in the
database character set.
TIMESTAMP Conversion to Oracle OLAP DML TIMESTAMP data type.
TIMESTAMP_LTZ Conversion to Oracle OLAP DML TIMESTAMP_LTZ data type.
TIMESTAMP_TZ Conversion to Oracle OLAP DML TIMESTAMP_TZ data type.
UROWID Converts a text value to a UROWID value.
YMINTERVAL Conversion to Oracle OLAP DML YMINTERVAL data type.
argument
When you specify TEXT, NTEXT, ID, DATE, or INFILE for the type, you can specify
additional arguments to determine how the conversion should be done as outlined in
Table 7–4, " Syntax for Specifying Conversion to TEXT, NTEXT, ID, DATE, and
INFILE".
Table 7–4 Syntax for Specifying Conversion to TEXT, NTEXT, ID, DATE, and INFILE
When
Keyword for Converting
type argument From Syntax for All Arguments
TEXT Any numeric TEXT [decimal-int|DECIMALS [comma-bool|COMMAS [paren-bool|PARENS]]]
NTEXT Any numeric NTEXT [decimal-int|DECIMALS [comma-bool|COMMAS [paren-bool|PARENS]]]
ID Any numeric ID [decimal-int|DECIMALS]
TEXT, NTEXT, Any datetime ID|TEXT|NTEXT ['date_format']
or ID
Table 7–4 (Cont.) Syntax for Specifying Conversion to TEXT, NTEXT, ID, DATE, and
When
Keyword for Converting
type argument From Syntax for All Arguments
TEXT, NTEXT, DATE ID|TEXT|NTEXT ['dateformat']
or ID
ID or TEXT for DATE ID [dwmqy-dimension]|TEXT [dwmqy-dimension|'vnf ']
a dimension of
type DAY,
WEEK,
MONTH,
QUARTER, or
YEAR with
VNF
DATE TEXT, DATE [date-order|dwmqy-dimname]
NTEXT, or ID
NTEXT TEXT NOXLATE
TEXT NTEXT NOXLATE
INFILE INFILE [width-exp|LSIZE [escape-int|0]]
IBINARY with BINARY [width-exp]
BOOLEAN or
INTEGER
decimal-int
An INTEGER expression that controls the number of decimal places to be used when
converting numeric data to TEXT or ID values. When this argument is omitted,
CONVERT uses the current value of the DECIMALS option (the default is 2).
comma-bool
A Boolean expression that determines whether commas are used to mark thousands
and millions in the text representation of the numeric data. When the value of the
expression is YES, commas are used. When this argument is omitted, CONVERT uses
the current value of the COMMAS option (the default is YES).
paren-bool
A Boolean expression that determines whether negative values are enclosed in
parentheses in the text representation of the numeric data. When the value of the
expression is YES, parentheses are used; when the value is NO, a minus sign precedes
negative values. When this argument is omitted, CONVERT uses the current value of
the PARENS option (the default is NO).
date_format
A text expression that specifies the template to use when converting a datetime
expression to text. The valid formats for each date field are the same as the formats
that you can specify using the DATE_FORMAT command.
When you do not include the date_format argument, the format of the result is
determined by the default date format for the session as described in "Default
Datetime Format Template" on page 9-159.
dateformat
A text expression that specifies the template to use when converting a DATE-only
expression to text. The template can include format specifications for any of the four
components of a date (day, month, year, and day of the week). Each component in the
template must be preceded by a left angle bracket (<)and followed by a right angle
bracket (>). You can include additional text before, after, or between the components.
The valid formats for each date component are the same as the formats allowed in the
DATEFORMAT option.
In the following statement, CONVERT returns today's date as a text value that is
formatted by a dateformat argument.
SHOW CONVERT(TODAY TEXT '<MM>-<DD>-<YY>')
In this example, today's date is March 31, 1998, and the SHOW statement presents it in
the following format.
03-31-98
When you do not include the dateformat argument, the format of the result is
determined by the current setting of the DATEFORMAT option.
dwmqy-dimension
The name of a dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR. Oracle
OLAP uses the VNF of dwmqy-dimension when converting a DATE-only value to a
TEXT or an ID value. When you have not specified the VNF of dwmqy-dimension,
Oracle OLAP uses its default VNF.
In the following statement, CONVERT returns today's date as a text value that is
formatted by the VNF of the YEAR dimension.
show convert(today text year)
In this example, today's date is March 31, 1998, and the SHOW statement presents it in
the following format.
YR98
vnf
A text template that specifies the value name format to use when converting values of
a dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR to text. The template
can include format specifications for any of the components of a time period. Time
period components include all the components of a date (day, month, year, and day of
the week), plus the fiscal year and period components. The template can also include
the name of the DAY, WEEK, MONTH, QUARTER, or YEAR dimension as a
component. Each component in the template must be preceded by a left angle bracket
and followed by a right angle bracket. You can include additional text before, after, or
between the components.
The vnf argument to the CONVERT function is similar to the template in a VNF
command. However, a VNF command template must be designed for precise and
unambiguous interpretation of input, while the vnf argument is not so constrained.
Therefore, the format styles allowed in the vnf argument are more extensive than those
allowed in a VNF command template.
Valid format styles for a vnf argument include all the format styles allowed in the
template of a VNF command, plus all the format styles allowed in a DATEFORMAT
template. DATEFORMAT provides the following format styles that are not allowed in
VNF command templates but that are valid in the vnf argument to the CONVERT
function:
■ Ordinal styles for the day of the month (DT and DTL)
■ First-letter style for the month (MT)
■ Styles for the day of the week (W, WT, WTXT, WTXTL, WTEXT, and WTEXTL)
Append a B code to any of these formats to indicate that you want to display the
beginning day or month of the period, rather than the final day or month.
You can use any combination of VNF and DATEFORMAT format styles with for any
dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR. This contrasts with
the template in a VNF command, in which only certain format combinations are valid
for each type of dimension.
In the following statement, CONVERT returns the current value of the MONTH
dimension as a text value that is formatted by a vnf argument.
SHOW CONVERT(month TEXT '<MTEXTL>, <YYYY>')
In this example, the first MONTH value in status is DEC97, and the SHOW statement
presents it in the following format.
December, 1997
When you do not include the vnf argument, the format of the result is determined by
the VNF of the dimension whose values you are converting. When the dimension has
no VNF, the result is formatted according to the default VNF for the type of dimension
being converted.
date-order
A text expression that specifies how to interpret the specified text value as a
DATE-only value when the order of the text value's components (month, day, and
year) is ambiguous. The expression can be one of the following: 'MDY', 'DMY',
'YMD', 'YDM', 'MYD', or 'DYM'. Each letter represents a component of the date:
M stands for month, D stands for day, and Y stands for year.
When you do not include the date-order or dwmqy-dimname argument, any ambiguity in
the interpretation of a text expression is resolved by the current setting of the
DATEORDER option. Refer to the DATEORDER option for a complete description of
DATE-only values and how they are interpreted.
dwmqy-dimname
The name of a dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR whose
VNF or default date-order determines how to interpret the specified text value as a
DATE-only value when the order of the text value's components is ambiguous.
When you do not include the date-order or dwmqy-dimname argument, any ambiguity in
the interpretation of a text expression is resolved by the current setting of the
DATEORDER option. Refer to the DATEORDER option for a complete description of
DATE-only values and how they are interpreted.
width-exp
An INTEGER expression that indicates the width of the output from CONVERT. The
minimum width is 7. The default width is the current value of the LSIZE option. This
argument is required when you specify the escape-int argument.
escape-int
Indicates whether escape sequences are to be used in the output. For this argument
you can specify one of the values listed in Table 7–5, " Values for escape-int Argument
of the CONVERT".
For more information on escape sequences in the OLAP DML, see "Escape Sequences"
on page 2-5.
width-exp
An INTEGER expression that controls the width of the converted result. It can evaluate
to 1, 2, or 4 bytes. The default width is 2 for BOOLEAN, or 4 for INTEGER. When an
INTEGER value is too large to fit in the specified width, the result is NA. When the
width is invalid or specified for some other data type, an error occurs.
NOXLATE
A keyword indicating that no character set conversion should be performed. Instead,
Oracle OLAP only tags the converted value with the target data type, leaving the data
as it was before the CONVERT function was called. Use this keyword only when it is
necessary to store binary data in a TEXT or NTEXT variable.
Notes
INFILE Conversion
The maximum number of characters in a line is 4000. An error occurs when you try an
INFILE conversion that produces a line with more than 4000 characters. This can occur
when the source line exceeds 99 characters and enough of them need escape
sequences.
specified number. When the numeric data type is not INTEGER, Oracle OLAP first
converts the numeric value to an INTEGER value and then converts that INTEGER
value to a DATE-only value.
Examples
CORRELATION
The CORRELATION function returns the correlation coefficients for the pairs of data
values in two expressions. A correlation coefficient indicates the strength of
relationship between the data values. The closer the correlation coefficient is to
positive or negative 1, the stronger the relationship is between the data values in the
expressions. A correlation coefficient of 0 (zero) means no correlation and a +1 (plus
one) or -1 (minus one) means a perfect correlation. A positive correlation coefficient
indicates that as the data values in one expression increase (or decrease), the data
values in the other expression also increase (or decrease). A negative correlation
coefficient indicates that as the data values in one expression increase, the data values
in other expression decrease.
Return Value
DECIMAL
Syntax
CORRELATION(expression1 expression2 [PEARSON|SPEARMAN|KENDALL] -
[BASEDON dimension-list])
Arguments
expression1
A dimensioned numeric expression with at least one dimension in common with
expression2.
expression2
A dimensioned numeric expression with at least one dimension in common with
expression1.
PEARSON
Calculates the Pearson product-moment correlation coefficient. Use this method when
the data is interval-level or ratios, such as units sold and price for each unit, and the
data values in the expressions have a linear relationship and are distributed normally.
SPEARMAN
Calculates Spearman's rho correlation coefficient. Use this nonparametric method
when the expressions do not have a linear relationship or a normal distribution. In
computing the correlation coefficient, this method ranks the data values in expression1
and in expression2 and then compares the rank of each element in expression1 to the
corresponding element in expression2. This method assumes that most of the values in
the expressions are unique.
KENDALL
Calculates Kendall's tau correlation coefficient. This nonparametric method is similar
to the SPEARMAN method in that it also first ranks the data values in expression1 and
in expression2. The KENDALL method, however, compares the ranks of each pair to
the successive pairs. Use this method when few of the data values in expression1 and in
expression2 are unique.
BASEDON dimension-list
An optional list of dimensions along which CORRELATION computes the correlation
coefficient. Both expression1 and expression2 must be dimensioned by all of the
dimension-list dimensions. CORRELATION correlates the data values of expression1 to
those of expression2 along all of the dimension-list dimensions. CORRELATION returns
an array that contains one correlation coefficient for each cell that is dimensioned by
all of the dimensions of expression1 and expression2 except those in dimension-list.
When you do not specify a dimension-list argument, then CORRELATION computes
the correlation coefficient over all of the common dimensions of expression1 and
expression2. When all of the dimensions of the two expressions are the same, then
CORRELATION returns a single correlation coefficient. When either expression
contains dimensions that are not shared by the other expression, then CORRELATION
returns an array that contains one correlation coefficient for each cell that is
dimensioned by the dimensions of the expressions that are not shared.
Notes
Examples
The following statement reports the correlation coefficient based on the product
dimension for the limited dimension values that are in status.
The following statement reports the correlation coefficient based on the month
dimension for the limited dimension values.
REPORT CORRELATION(units price pearson basedon month)
COS
The COS function calculates the cosine of an angle expression. The result returned by
COS is a decimal value with the same dimensions as the specified expression.
Return Value
DECIMAL
Syntax
COS(angle-expression)
Arguments
angle-expression
A numeric expression that contains an angle value, which is specified in radians.
Examples
COSH
Return Value
DECIMAL
Syntax
COSH(expression)
Arguments
expression
A numeric expression that contains an angle value, which is specified in radians.
Examples
COUNT
The COUNT function counts the number of TRUE values of a Boolean expression. It
returns 0 (zero) when no values of the expression are TRUE.
Return Value
INTEGER
Syntax
COUNT(boolean-expression [CACHE] [dimension...])
Arguments
boolean-expression
The Boolean expression whose TRUE values are to be counted.
CACHE
Specifies slightly different internal behavior. Specify this keyword only when the
original performance is extrememly slow.
dimension
The name of a dimension of the result; or, the name of a relation between one of the
dimensions of boolean-expression and another dimension that you want as a dimension
of the result.
By default, COUNT returns a single YES or NO value. When you indicate one or more
dimensions for the result, COUNT tests for TRUE values along the dimensions that are
specified and returns an array of values. Each dimension must be either a dimension
of boolean-expression or related to one of its dimensions.
Notes
Examples
CUMSUM
The CUMSUM function computes cumulative totals over time or over another
dimension. When the data being totaled is one-dimensional, CUMSUM produces a
single series of totals, one for all values of the dimension. When the data has
dimensions other than the one being totaled over, CUMSUM produces a separate
series of totals for each combination of values in the status of the other dimensions.
Return Value
DECIMAL
Syntax
CUMSUM(cum-expression [STATUS] total-dim [reset-dim] [INSTAT])
Arguments
cum-expression
A numeric variable or calculation whose values you want to total, for example UNITS.
STATUS
When cum-expression is multidimensional, CUMSUM creates a temporary variable to
use while processing the function. When you specify the STATUS keyword,
CUMSUM uses the current status instead of the default status of the dimensions for
calculating the size of this temporary variable. When the dimensions of the expression
are limited to a few values and are physically fragmented, you can improve the
performance of CUMSUM by specifying STATUS.
When you use CUMSUM with the STATUS keyword in an expression that requires
going outside of status for results (for example, with the LEAD or LAG functions or
with a qualified data reference), the results outside of status will be returned as NA.
Note: When you specify the STATUS keyword when the data being
totaled is one-dimensional, an error results
total-dim
The dimension of cum-expression over which you want to total.
reset-dim
Specifies that the cumulative totals in a series should start over with each new reset
dimension value, for example at the start of each new year. The reset dimension can be
any of the following:
■ Any dimension related to total-dim through an explicitly defined relation.
■ Any dimension with a type of DAY, WEEK, MONTH, QUARTER, or YEAR, when
total-dim also has a type of DAY, WEEK, MONTH, QUARTER, or YEAR.
CUMSUM uses the implicit relation between the two dimensions, so they do not
need to be related through an explicit relation. See "Overriding an Implicit
Relation" on page 7-98.
■ A relation dimensioned by total-dim. CUMSUM uses the related dimension as the
reset dimension. This enables you to choose which relation is used when there is
more than one.
INSTAT
Specifies that CUMSUM uses only the values of total-dim that are currently in status.
When you do not specify INSTAT, CUMSUM produces a total for all the values of
total-dim, independent of its current status. See "INSTAT Ignores Current Status By
Default" on page 7-98.
Notes
Examples
The totals for CUMSUM(UNITS, MONTH) include values for all months beginning
with the first month, JAN95. The totals for CUMSUM(UNITS, MONTH YEAR) include
only the values starting with JAN96.
A report displays.
DISTRICT: ATLANTA
------------------PRODUCT------------------
--------TENTS-------- -------CANOES--------
CUMSUM(UNI CUMSUM(UNI
TS, MONTH TS, MONTH
MONTH UNITS QUARTER) UNITS QUARTER)
------------ ---------- ---------- ---------- ----------
Jan96 279 279 281 281
Feb96 305 584 309 590
Mar96 356 940 386 976
Apr96 537 537 546 546
May96 646 1,183 525 1,071
Jun96 760 1,943 608 1,679
Jul96 852 852 626 626
Aug96 730 1,582 528 1,154
Sep96 620 2,202 520 1,674
Oct96 554 554 339 339
Nov96 380 934 309 648
Dec96 284 1,218 288 936
CURRENT_DATE
The CURRENT_DATE function returns the current date in the session time zone, as a
value in the Gregorian calendar.
Return Values
DATETIME
Syntax
CURENT_DATE
Examples
CURRENT_TIMESTAMP
The CURRENT_TIMESTAMP function returns the current date and time in the session
time zone, as a value of data type TIMESTAMP_TZ. The time zone offset reflects the
current local time of the session.
When you want to retrieve the current date and time in the session time zone as a
TIMESTAMP value, use the LOCALTIMESTAMP function.
Return Values
TIMESTAMP_TZ
Syntax
CURRENT_TIMESTAMP [ (precision) ]
Arguments
precision
The fractional second precision of the time value returned. When you omit this
argument, then the function uses a default value of 6.
Examples
DAYOF
The DAYOF function returns an INTEGER in the range of 1 through 7, giving the day
of the week on which a specified date falls. A result of 1 refers to Sunday. The result
has the same dimensions as the specified DATE expression.
Return Value
INTEGER
Syntax
DAYOF(date-expression)
Arguments
date-expression
An expression that has the DATE data type, or a text expression that specifies a date.
In place of a DATE expression, you can specify a text expression that has values that
conform to a valid input style for dates. DAYOF automatically converts the values of
the text expression to DATE values, using the current setting of the DATEORDER
option to resolve any ambiguity.
Examples
When today's date is January 15, 1997, which is a Wednesday, this statement produces
the following output.
4
DBTIMEZONE
The DBTIMEZONE function returns the value of the Database time zone.
Return Values
A time zone offset (a character type in the format '[+|-]TZH:TZM') or a time zone
region name, depending on how the user specified the database time zone value in the
most recent CREATE DATABASE or ALTER DATABASE statement.
Syntax
DBTIMEZONE
Examples
DDOF
The DDOF function returns an INTEGER in the range of 1 through 31, giving the day
of the month on which a specified date falls. The result returned by DDOF has the
same dimensions as the specified DATE expression.
Return Value
INTEGER
Syntax
DDOF(date-expression)
Arguments
date-expression
An expression that has the DATE data type, or a text expression that specifies a date.
See "Date-only Input Values" on page 2-6 for valid formats for a text expression.
Examples
When today's date is September 8, 2000, this statement produces the following output.
8
DECODE
The DECODE function compares one expression to one or more other expressions and,
when the base expression is equal to a search expression, returns the corresponding
result expression; or, when no match is found, returns the default expression when it
is specified, or NA when it is not.
Return Value
The data type of the first result argument.
Syntax
DECODE (expr , search, result [, search , result]... [, default])
Arguments
expr
The expression to be searched. The function automatically converts expr to the data
type of the first search value before comparing
search
An expression to search for. The function automatically each search value to the data
type of the first search value before comparing
result
The expression to return when expression is equal to search.
default
An expression to return when expression is not equal to search.
Notes
Examples
REPORT inventories
---------------INVENTORIES---------------
---------------PRODUCT_ID----------------
WAREHOUSE_ID 1770 1775
-------------------- -------------------- --------------------
1 30.63 79.02
2 71.49 55.83
3 88.71 68.02
4 86.27 41.86
REPORT inventory_location
WAREHOUSE_ID INVENTORY_LOCATION
-------------------- --------------------
1 Southlake
2 San Francisco
3 Non domestic
4 Seattle
The following reports illustrate how you can use inventory_location to display
the decoded values of warehouse_id in a report rather than displaying the actual
values of warehouse_id.
LIMIT product_id to '1775'
Assume that the value of order_status is used as a bitmap where the first three bits
hold information about the order and the other bits are always 0:
■ The first bit is used for location information:
0 = Post Office. This corresponds to integer values of 0, 2, 4, and 6.
1 = Warehouse. This corresponds to the integer values of 1, 3, 5, and 7.
■ The second bit is used for method:
0 = Air. This corresponds to the integer values of 0, 1, 4, and 5.
1 = Ground. This corresponds to the integer values of 2, 3, 6, and 7.
■ The third bit is used for receipt:
0 = Certified. This corresponds the integer values of 0, 1, 2, and 3.
1 =Insured. This corresponds to the integer values of 4, 5, 6, and 7.
The following formulas use DECODE to substitute the text values for the bit values.
DEFINE location FORMULA DECODE(BITAND(order_status, 1), 1, 'Warehouse',
'PostOffice')
DEFINE method FORMULA DECODE(BITAND(order_status, 2), 2, 'Ground', 'Air')
DEFINE receipt FORMULA DECODE(BITAND(order_status, 4), 4, 'Insured', 'Certified')
DEPRDECL
The DEPRDECL function calculates the depreciation expenses for a series of assets.
DEPRDECL uses the declining balance method, as described in "Calculation Method
Used by DEPRDECL" on page 7-109, to depreciate the assets over the specified lifetime
of the assets. The starting value and ending value are specified for the assets acquired
in each time period.
Return Value
DECIMAL
The return value is dimensioned by all the dimensions of start-exp.
Syntax
DEPRDECL(start-exp end-exp n [STATUS] [decline-factor [ {FULL|HALF|portion-exp}[time-dimension] ] ])
Arguments
start-exp
A numeric expression that contains the starting values of the assets. The start-exp
expression must be dimensioned by a time dimension. For each value of the time
dimension, start-exp contains the initial value of the assets acquired during that time
period. In addition to a time dimension, start-exp can also have non-time dimensions.
end-exp
A numeric expression that contains the ending values of the assets. The end-exp
expression must be dimensioned by the same dimensions as start-exp. For each value
of the time dimension, end-exp contains the final (or salvage) value for the assets
acquired during that time period. Each value of start-exp must have a corresponding
end-exp value. For example, when the assets acquired in 1996 have a salvage value of
$200, then the value of end-exp for 1996 is $200.
n
An INTEGER expression that contains the number of periods for the depreciation life
of the assets. The n expression can have any of the non-time dimensions of start-exp,
but it cannot have a time dimension.
STATUS
Specifies that DEPRDECL should use the current status list (that is, only the dimension
values currently in status in their current status order) when computing the
depreciation expenses. By default DEPRDECL uses the default status list.
decline-factor
A numeric expression that gives the declining balance rate to use for calculating the
depreciation expenses. The decline-factor expression can have any of the non-time
dimensions of start-exp, but it cannot have a time dimension.
A factor of 2 indicates a double declining balance. The default is 2.
FULL
(Default) Specifies that the full amount of a time period's depreciation expense is
charged to the time period in which assets were acquired. Charges the full amount to
all of the assets in the series.
HALF
Specifies that half of the full amount of a time period's depreciation expense is charged
to the time period in which assets were acquired. Charges half the full amount to all of
the assets in the series. When you specify HALF as the portion of depreciation
expenses to charge to the period of acquisition, the HALF factor is applied to each
period. Half of each period's full depreciation is rolled to the next period, and the final
half period of depreciation takes place in the time period n + 1. You might want to
use HALF when assets are acquired during the second half of the time period.
portion-exp
When you want to charge the full amount for some assets and half the amount for
other assets, you can supply a portion-exp expression that is dimensioned by any of the
non-time dimensions of start-exp. The portion-exp expression must be a text expression
with values of FULL or HALF.
time-dimension
The name of the time dimension by which start-exp and end-exp are dimensioned.
When the time dimension has a type of DAY, WEEK, MONTH, QUARTER, or YEAR,
the time-dimension argument is optional.
Notes
Examples
Suppose you assign the following values to the variables assets and salvage.
YEAR ASSETS SALVAGE
-------------- ---------- ----------
Yr95 1,000.00 100.00
Yr96 0.00 0.00
Yr97 0.00 0.00
Yr98 0.00 0.00
Yr99 0.00 0.00
Yr00 0.00 0.00
The assets variable contains the starting value of the assets acquired in 1995. The
salvage variable contains the ending value of the assets acquired in 1995.
The following statement reports asset and salvage values, along with depreciation
expenses for the assets. Note that the call to DEPRDECL to calculate the depreciation
expenses specifies an asset lifetime of 5 periods (in this case, years) and a decline factor
of 2 (double-declining balance).
REPORT assets salvage W 12 HEADING 'Depreciation' -
DEPRDECL(assets salvage 5 2 FULL year)
In this example, the depreciation expense for 1999 is adjusted so that the current asset
value does not fall below the salvage value. The current asset value is calculated by
subtracting the accumulated depreciation expense from the starting asset value. For
example, for 1998 the accumulated depreciation expense is $870.40 ($400.00 + $240.00
+ $144.00 + $86.40 = $870.40). This means the current asset value for 1998 is $129.60
Example 7–67 Using DEPRDECL to Calculate the Depreciation Expenses for Assets
Acquired in Multiple Periods
You can also use DEPRDECL to calculate the depreciation expenses for a series of
assets.
Suppose you change the values for the year 1997 in the variables assets and
salvage to the values shown in the following report.
YEAR ASSETS SALVAGE
-------------- ---------- ----------
Yr95 1,000.00 100.00
Yr96 0.00 0.00
Yr97 500.00 50.00
Yr98 0.00 0.00
Yr99 0.00 0.00
Yr00 0.00 0.00
Yr01 0.00 0.00
Yr02 0.00 0.00
Now assets and salvage contain nonzero values for 1995 and for 1997
The following statement reports the values of assets and salvage, and uses DEPRDECL
to calculate depreciation expenses for each year, specifying an asset lifetime of 5 years,
and a decline factor of 2 (double declining balance).
REPORT assets SALVAGE W 12 HEADING 'Depreciation' -
DEPRDECL(assets salvage 5 2 FULL year)
This statement produces the following output. (Notice that the depreciation expense
increases in 1997 due to the assets acquired in that year.)
YEAR ASSETS SALVAGE Depreciation
-------------- ---------- ---------- ------------
Yr95 1,000.00 100.00 400.00
Yr96 0.00 0.00 240.00
Yr97 500.00 50.00 344.00
Yr98 0.00 0.00 206.00
Yr99 0.00 0.00 101.00
Yr00 0.00 0.00 43.20
Yr01 0.00 0.00 14.80
Yr02 0.00 0.00 0.00
DEPRDECLSW
The DEPRDECLSW function calculates the depreciation expenses for a series of assets.
DEPRDECLSW uses a variation on the declining balance method, as described in
"Calculation Method Used by DEPRDECLSW" on page 7-113, to depreciate assets over
the specified lifetime of the assets. DEPRDECLSW begins by using the declining
balance method, then switches over to the straight-line method at one of the following
points in the time series:
■ The first period for which straight-line depreciation over the remaining periods
exceeds the declining balance depreciation for those periods (the default)
■ The period specified by the switch-period argument
This variation on the declining-balance method is the most commonly used form of
declining-balance depreciation methods.
Return Value
DECIMAL, dimensioned by all the dimensions of start-exp.
Syntax
DEPRDECLSW(start-exp end-exp n [STATUS]
[decline-factor [{FULL|HALF| portion-exp} [switch-period [time-dimension]]]])
Arguments
start-exp
A numeric expression that contains the starting values of the assets. The start-exp
expression must be dimensioned by a time dimension. For each value of the time
dimension, start-exp contains the initial value of the assets acquired during that time
period. In addition to a time dimension, start-exp can also have non-time dimensions.
end-exp
A numeric expression that contains the ending value of the assets. The end-exp
expression must be dimensioned by the same dimensions as start-exp. For each value
of the time dimension, end-exp contains the final (or salvage) value for the assets
acquired during that time period. Each value of start-exp must have a corresponding
end-exp value. For example, when the assets acquired in 1990 have a salvage value of
$200, then the value of end-exp for 1990 is $200.
n
An INTEGER expression that contains the number of periods for the depreciation life
of the assets. The n expression can have any of the non-time dimensions of start-exp,
but it cannot have a time dimension.
STATUS
Specifies that DEPRDECLSW should use the current status list (that is, only the
dimension values currently in status in their current status order) when computing the
depreciation expenses. By default DEPRDECLSW uses the default status list.
decline-factor
A numeric expression that gives the declining balance rate to use for calculating the
depreciation expenses. The decline-factor expression can have any of the non-time
dimensions of start-exp, but it cannot have a time dimension.
FULL
(Default) Specifies that the full amount of a time period's depreciation expense is
charged to the time period in which assets were acquired. Charges the full amount to
all of the assets in the series. This argument is optional; however, when you include it,
you must also include the preceding optional arguments.
HALF
Specifies that half of the full amount of a time period's depreciation expense is charged
to the time period in which assets were acquired. Charges half the full amount to all of
the assets in the series. You might want to use HALF when assets are acquired during
the second half of the time period. When you specify HALF as the portion of
depreciation expenses to charge to the period of acquisition, the HALF factor is
applied to each period. Half of each period's full depreciation is rolled to the next
period, and the final half period of depreciation takes place in the time period n + 1.
This argument is optional; however, when you include it, you must also include the
preceding optional arguments.
portion-exp
When you want to charge the full amount for some assets and half the amount for
other assets, you can supply a portion-exp expression that is dimensioned by any of the
non-time dimensions of start-exp. The portion-exp expression must be a text expression
with values of FULL or HALF. This argument is optional; however, when you include
it, you must also include the preceding optional arguments.
switch-period
An INTEGER expression that indicates the time period in which the calculation should
switch to the straight-line method. This argument is optional; however, when you
include it, you must also include the preceding optional arguments.
A common accounting practice is to switch to a straight-line method in the first period
for which straight-line depreciation over the remaining periods exceeds the
declining-balance depreciation. You can specify this behavior by not specifying the
switch-period argument.
When the switch-period argument is not specified or has a value of NA or 0, the
calculation switches from the declining method to the straight-line method in the first
period for which straight-line depreciation over the remaining periods exceeds the
declining-balance depreciation. In this case, the DEPRDECLSW function behaves just
like the DEPRDECL function.
When you want to specify different switch periods for different assets, you can supply
an expression that is dimensioned by any of the non-time dimensions of start-exp.
time-dimension
The name of the time dimension by which start-exp and end-exp are dimensioned.
When the time dimension has a type of DAY, WEEK, MONTH, QUARTER, or YEAR,
the time-dimension argument is optional. When you include this argument, you must
also include the preceding optional arguments
Notes
depreciated. The first period of depreciation for an asset is the period in which it was
acquired.
For each time period in which DEPRDECLSW is calculating depreciation according to
the declining balance method, it calculates the depreciation expense by multiplying
the current value of an asset by the decline-factor and dividing the result by the number
of periods in the lifetime of the asset. When DEPRDECLSW switches to the
straight-line method, it subtracts the depreciation expense (from previous periods)
from the value of an asset and divides the resulting amount by the number of periods
left in the lifetime of the asset. However, when the depreciation expense calculated for
a specific time period would result in an asset's current value going below its ending
value, then the depreciation expense is adjusted. In this instance, the depreciation
expense is calculated as the current value minus the ending value.
The straight-line method as used by DEPRDECLSW differs from the traditional
straight-line method as used by DEPRSL. Unlike other methods of depreciation, the
declining-balance methods of depreciation ignore the salvage value for an asset until
the period in which the calculated depreciation would exceed the remaining
depreciable value. This holds true for DEPRDECLSW even after it switches from the
declining-balance method to the straight-line method. For example, suppose the
beginning value for an asset is 16,000 and the salvage value is 1,000 over 5 periods.
The total depreciation through the periods using declining balance method (here the
first three) is 11,544. The straight-line calculations for the remaining periods would be
based on the overall remaining value of 16,000 minus 11,544 (3,456), rather than the
overall value minus the salvage value (2,456). Thus the depreciation for the last two
periods would be 1,728; but for the very last period the salvage value is subtracted out
and thus is 728.
Unexpected-Balance Method
When the ending value specified for an asset is relatively high, then an asset might be
totally depreciated in fewer periods than were specified for the lifetime of the
depreciation. In this instance, when you want the depreciation expense applied across
the specified lifetime of the depreciation, you can lower the decline-factor.
Examples
Suppose you assign the following values to the variables assets and salvage.
YEAR ASSETS SALVAGE
------- ---------- -----------
Yr95 1,000.00 100.00
Yr96 0.00 0.00
Yr97 0.00 0.00
Yr98 0.00 0.00
Yr99 0.00 0.00
Yr00 0.00 0.00
The variable assets contains the starting value of the assets acquired in 1995.
salvage contains the ending value of the assets acquired in 1995.
The following statement reports the values of assets and salvage, and uses
DEPRDECLSW to calculate depreciation expenses for each year, specifying an asset
lifetime of 5 years, and a decline factor of 2 (double declining balance). The statement
does not specify a switch-period argument. Because of this, DEPRDECLSW will use the
default for switch-period, which is to switch from the declining balance method of
depreciation in the first period for which straight-line depreciation over the remaining
periods exceeds the declining-balance depreciation.
REPORT assets salvage W 12 HEADING 'Depreciation' -
DEPRDECLSW (assets salvage 5 2 FULL)
Example 7–70 Calculating the Depreciation Expenses for Assets Acquired in Multiple
Periods
You can use DEPRDECLSW to calculate the depreciation expenses for a series of
assets. Suppose you change the values for the year 1997 in the variables assets and
salvage to the values shown in the following report.
YEAR ASSETS SALVAGE
-------------- ---------- ----------
Yr95 1,000.00 100.00
Yr96 0.00 0.00
Yr97 500.00 50.00
Yr98 0.00 0.00
Yr99 0.00 0.00
Yr00 0.00 0.00
Yr01 0.00 0.00
Yr02 0.00 0.00
Now assets and salvage contain nonzero values for 1995 and for 1997.
The following statement reports asset and salvage values along with depreciation
expenses for the assets. Note that the call to DEPRDECLSW to calculate the
depreciation expenses specifies an asset lifetime of 5 periods (in this case, years) and a
decline factor of 2 (double-declining balance). The statement does not specify a
switch-period argument. Because of this, DEPRDECLSW will use the default for
switch-period, which is to switch from the declining balance method of depreciation in
the first period for which straight-line depreciation over the remaining periods
exceeds the declining-balance depreciation.
REPORT assets salvage W 12 HEADING 'Depreciation' -
DEPRDECLSW(assets salvage 5 2 FULL)
Notice that the depreciation expense increases in 1997 due to the assets acquired in
that year.
DEPRSL
The DEPRSL function calculates the depreciation expenses for a series of assets.
DEPRSL uses the straight-line method, as described in "DEPRSL Calculation Method"
on page 7-118, to depreciate the assets over the specified lifetime of the assets. The
starting and ending values are specified for the assets acquired in each time period.
Return Value
DECIMAL, dimensioned by all the dimensions of start-exp.
Syntax
DEPRSL(start-exp end-exp n [STATUS] [{FULL|HALF| portion-exp} [time-dimension]])
Arguments
start-exp
A numeric expression that contains the starting values of the assets. The start-exp
expression must be dimensioned by a time dimension. For each value of the time
dimension, start-exp contains the initial value of the assets acquired during that time
period. In addition to a time dimension, start-exp can also have non-time dimensions.
end-exp
A numeric expression that contains the ending values of the assets. The end-exp
expression must be dimensioned by the same dimensions as start-exp. For each value
of the time dimension, end-exp contains the final (or salvage) value for the assets
acquired during that time period. Each value of start-exp must have a corresponding
end-exp value. For example, when the assets acquired in 1995 have a salvage value of
$200, then the value of end-exp for 1995 is $200.
n
An INTEGER expression that contains the depreciation lifetime of the assets. The n
expression can have any of the non-time dimensions of start-exp, but it cannot have a
time dimension.
STATUS
Specifies that DEPRSL should use the current status list (that is, only the dimension
values currently in status in their current status order) when computing the
depreciation expenses. By default DEPRSL uses the default status list.
FULL
(Default) Specifies that the full amount of a time period's depreciation expense is
charged to the time period in which assets were acquired. Charges the full amount to
all of the assets in the series.
HALF
Specifies that half of the full amount of a time period's depreciation expense is charged
to the time period in which assets were acquired. Charges half the full amount to all of
the assets in the series. When you specify HALF as the portion of depreciation
expenses to charge to the period of acquisition, the HALF factor is applied to each
period. Half of each period's full depreciation expense is rolled to the next period, and
the final half period of depreciation takes place in the time period n + 1. You might
want to use HALF when assets are acquired during the second half of the time period.
portion-exp
When you want to charge the full amount for some assets and half the amount for
other assets, you can supply a portion-exp expression that is dimensioned by any of the
non-time dimensions of start-exp. The portion-exp expression must be a text expression
with values of FULL or HALF.
time-dimension
The name of the time dimension by which start-exp and end-exp are dimensioned.
When the time dimension has a type of DAY, WEEK, MONTH, QUARTER, or YEAR,
the time-dimension argument is optional.
Notes
Examples
Example 7–71 Using DEPRSL to Calculate Depreciation Expenses for Assets Acquired
in a Single Period
This example shows how to use DEPRSL to calculate depreciation expenses for assets
acquired in a single time period.
The following statements create two variables called assets and salvage.
DEFINE assets DECIMAL <year>
DEFINE salvage DECIMAL <year>
Suppose you assign the following values to the variables assets and salvage.
YEAR ASSETS SALVAGE
-------------- ---------- ----------
Yr95 1,000.00 100.00
Yr96 0.00 0.00
Yr97 0.00 0.00
Yr98 0.00 0.00
Yr99 0.00 0.00
Yr00 0.00 0.00
The variable assets contains the starting value of assets acquired in 1995. The
variable salvage contains the ending value of the assets acquired in 1995.
The following statement reports the values of assets and salvage, and uses DEPRSL to
calculate depreciation expenses for each year, specifying an asset lifetime of 5 years.
Example 7–72 Using DEPRSL to Calculate the Depreciation Expenses for Assets
Acquired in Multiple Periods
You can also use DEPRSL to calculate the depreciation expenses for a series of assets.
Suppose you change the values for the year 1997 in the variables assets and
salvage to the values shown in the following report.
YEAR ASSETS SALVAGE
-------------- ---------- ----------
Yr95 1,000.00 100.00
Yr96 0.00 0.00
Yr97 500.00 50.00
Yr98 0.00 0.00
Yr99 0.00 0.00
Yr00 0.00 0.00
Yr01 0.00 0.00
Yr02 0.00 0.00
Now assets and salvage contain nonzero values for 1995 and for 1997.
The following statement reports asset and salvage values along with depreciation
expenses for the assets. Note that the call to DEPRSL to calculate the depreciation
expenses specifies an asset lifetime of 5 periods (in this case, years).
REPORT assets salvage W 12 HEADING 'Depreciation' -
DEPRSL(assets salvage 5 FULL year)
The assets acquired in 1995 were fully depreciated in 1999. Therefore, for 2000 and
2001, DEPRSL returns a figure that includes the depreciation expense for the assets
acquired in 1997 only.
DEPRSOYD
The DEPRSOYD function calculates the depreciation expenses for a series of assets.
DEPRSOYD uses the sum-of-years'-digits method, as described in "Calculation
Method Used by DEPRSOYD" on page 7-121, to depreciate the assets over the
specified lifetime of the assets. The starting and ending values are specified for the
assets acquired in each time period.
Return Value
DECIMAL, dimensioned by all the dimensions of start-exp.
Syntax
DEPRSOYD(start-exp end-exp n [STATUS] [{FULL|HALF| portion-exp} [time-dimension]])
Arguments
start-exp
A numeric expression that contains the starting values of the assets. The start-exp
expression must be dimensioned by a time dimension. For each value of the time
dimension, start-exp contains the initial value of the assets acquired during that time
period. In addition to a time dimension, start-exp can also have non-time dimensions.
end-exp
A numeric expression that contains the ending values of the assets. The end-exp
expression must be dimensioned by the same dimensions as start-exp. For each value
of the time dimension, end-exp contains the final (or salvage) value for the assets
acquired during that time period. Each value of start-exp must have a corresponding
end-exp value. For example, when the assets acquired in 1995 have a salvage value of
$200, then the value of end-exp for 1995 is $200.
n
An INTEGER expression that contains the depreciation lifetime of the assets. The n
expression can have any of the non-time dimensions of start-exp, but it cannot have a
time dimension.
STATUS
Specifies that DEPRSOYD should use the current status list (that is, only the
dimension values currently in status in their current status order) when computing the
depreciation expenses. By default DEPRSOYD uses the default status list.
FULL
(Default) Specifies that the full amount of a time period's depreciation expense is
charged to the time period in which assets were acquired. Charges the full amount to
all of the assets in the series.
HALF
Specifies that half of the full amount of a time period's depreciation expense is charged
to the time period in which assets were acquired. Charges half the full amount to all of
the assets in the series. When you specify HALF as the portion of depreciation
expenses to charge to the period of acquisition, the HALF factor is applied to each
period. Half of each period's full depreciation expense is rolled to the next period, and
the final half period of depreciation expense takes place in the n + 1 time period. You
might want to use HALF when assets are acquired during the second half of the time
period.
portion-exp
When you want to charge the full amount for some assets and half the amount for
other assets, you can supply a portion-exp expression that is dimensioned by any of the
non-time dimensions of start-exp. The portion-exp expression must be a text expression
with values of FULL or HALF.
time-dimension
The name of the time dimension by which start-exp and end-exp are dimensioned.When
the time dimension has a type of DAY, WEEK, MONTH, QUARTER, or YEAR, the
time-dimension argument is optional.
Notes
In this case, the cut is 1/15th of the total depreciation. When the initial asset is $1,000
and its salvage value is $100, then the total depreciation is $900.00, and x is $60
($900/15). For the first time period, the depreciation is $300 ($60 x 5). For the second
time period, the depreciation is $240 ($60 x 4) and so on.
Examples
Suppose you assign the following values to the variables assets and salvage.
YEAR ASSETS SALVAGE
-------------- ---------- ----------
Yr95 1,000.00 100.00
Yr96 0.00 0.00
Yr97 0.00 0.00
Yr98 0.00 0.00
Yr99 0.00 0.00
Yr00 0.00 0.00
The variable assets contains the starting value of assets acquired in 1995. The
variable salvage contains the ending value of the assets acquired in 1995.
The following statement reports the values of assets and salvage, and uses
DEPRSOYD to calculate depreciation expenses for each year, specifying an asset
lifetime of 5 years.
REPORT assets salvage W 12 HEADING 'Depreciation' -
DEPRSOYD(assets salvage 5 FULL year)
Example 7–74 Using DEPRSOYD to Calculate the Depreciation Expenses for Assets
Acquired in Multiple Periods
You can also use DEPRSOYD to calculate the depreciation expenses for a series of
assets. Suppose you change the values for the year 1997 in the variables assets and
salvage to the values shown in the following report.
YEAR ASSETS SALVAGE
-------------- ---------- ----------
Yr95 1,000.00 100.00
Yr96 0.00 0.00
Yr97 500.00 50.00
Yr98 0.00 0.00
Yr99 0.00 0.00
Yr00 0.00 0.00
Yr01 0.00 0.00
Yr02 0.00 0.00
Now assets and salvage contain nonzero values for 1995 and for 1997.
The following statement reports asset and salvage values along with depreciation
expenses for the assets. Note that the call to DEPRSOYD to calculate the depreciation
expenses specifies an asset lifetime of 5 periods (in this case, years).
REPORT assets salvage W 12 HEADING 'Depreciation' -
DEPRSOYD(assets salvage 5 FULL year)
Notice that as a result of the second asset, the depreciation expenses increase in 1997.
The depreciation is the total depreciation of $180.00 ($60 x 3) for the first asset and
$150.00 ($30 x 5) for the second asset.
ENDDATE
Return Value
DATE-only or text
Syntax
ENDDATE(expression)
Arguments
expression
The expression must have exactly one dimension that has the type of DAY, WEEK,
MONTH, QUARTER, or YEAR. When all the values of the expression are NA,
ENDDATE returns NA.
Examples
ENDOF
Return Value
DATE-only or text
Syntax
ENDOF(dwmqy-dimension)
Arguments
dwmqy-dimension
A dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR. When you have
explicitly defined your own relation between dimensions of this type, you can use the
name of this time relation here.
Examples
EVERY
The EVERY function returns YES when every value of a Boolean expression is TRUE,
or NO when any value of the expression is FALSE.
Return Value
BOOLEAN
Syntax
EVERY(boolean-expression [CACHE] [dimension...])
Arguments
boolean-expression
The Boolean expression whose values are to be evaluated.
CACHE
Specifies slightly different internal behavior. Specify this keyword only when the
original performance is extrememly slow.
dimension
The name of a dimension of the result; or, the name of a relation between one of the
dimensions of boolean-expression and another dimension that you want as a dimension
of the result.
By default, EVERY returns a single YES or NO value. When you indicate one or more
dimensions for the result, EVERY tests for TRUE values along the dimensions that are
specified and returns an array of values. Each dimension must be either a dimension
of boolean-expression or related to one of its dimensions.
Notes
Examples
EXISTS
Return Value
BOOLEAN
Syntax
EXISTS(name-expression)
Arguments
name-expression
A text expression that specifies the name you want to test.
Notes
Examples
EXP
The EXP function returns e raised to the nth power, where e equals 2.71828183....
Return Value
NUMBER
Syntax
EXP (n)
Arguments
n
The power by which you want to raise e.
Examples
54.59815
EVERSION
The EVERSION function returns a text value that specifies the internal Oracle OLAP
build number.
Return Value
TEXT
Syntax
EVERSION
Notes
Examples
EXTBYTES
Return Value
TEXT
Syntax
EXTBYTES(text-expression [start [length]])
Arguments
text-expression
A TEXT expression from which a portion is to be extracted. When text-expression is a
multiline TEXT value, EXTBYTES preserves the line breaks in the returned value.
start
An INTEGER that represents the byte position at which to begin extracting. The
position of the first byte in text-expression is 1. When you omit this argument,
EXTBYTES starts with the first byte.
length
An INTEGER that represents the number of bytes to be extracted. When length is not
specified, or exceeds the number of bytes from start to the end of text-expression, the
part from start to the end of text-expression is extracted.
Examples
■ The statement
SHOW EXTBYTES('hellotherejoe', 11)
EXTCHARS
Tip: When you are using a multibyte character set, you can use the
EXTBYTES function instead of the EXTCHARS function.
Return Value
TEXT or NTEXT
Syntax
EXTCHARS(text-expression [start [length]])
Arguments
text-expression
A TEXT or NTEXT expression from which a portion is to be extracted. When
text-expression is a multiline text value, EXTCHARS preserves the line breaks in the
returned value.
start
An INTEGER that represents the character position at which to begin extracting. The
position of the first character in text-expression is 1. When you omit this argument,
EXTCHARS starts with the first character.
length
An INTEGER that represents the number of characters to be extracted. When length is
not specified, or exceeds the number of characters from start to the end of
text-expression, the part from start to the end of text-expression is extracted.
Examples
■ The statement
SHOW EXTCHARS('hellotherejoe', 11)
EXTCOLS
The EXTCOLS function extracts specified columns from each line of a multiline text
value. The function returns a multiline text value that includes only the extracted
columns. Columns refer to the character positions in each line of a multiline text value.
The first character in each line is in column one, the second is in column two, and so
on.
Return Value
TEXT or NTEXT
EXTCOLS always returns a text value that has the same number of lines as
text-expression, though some of the lines may be empty.
Syntax
EXTCOLS(text-expression [start [numcols]])
Arguments
text-expression
The TEXT or NTEXT expression from which the specified columns should be extracted.
When text-expression is a multiline text value, the characters in the specified columns
are extracted from each one of its lines.
start
An INTEGER, between 1 and 4000, that represents the column position at which to
begin extracting. The column position of the first character in each line of
text-expression is 1. When you specify a starting column that is to the right of the last
character in a given line in text expression, the corresponding line in the return value
will be empty.
numcols
An INTEGER that represents the number of columns to be extracted. When you do not
specify numcols, EXTCOLS extracts all the characters from the starting column to the
end of each line. When you specify a length that exceeds the number of characters that
follow the starting position in a given line in text expression, the corresponding line in
the return value will include only existing characters. EXTCOLS does not return
spaces at the end of the line to fill in the missing columns.
Examples
■ The statement
SHOW citylist
Boston
Houston
Chicago
■ The statement
SHOW EXTCOLS(citylist 2 4)
EXTLINES
Return Value
TEXT or NTEXT
Syntax
EXTLINES(text-expression [start [numlines]])
Arguments
text-expression
A multiline TEXT or NTEXT expression from whose values one or more lines are to be
extracted.
start
An INTEGER that represents the line number at which to begin extracting. The
position of the first line in text-expression is 1. When you omit this argument,
EXTLINES begins with line 1.
numlines
An INTEGER representing the number of lines to be extracted. When you do not
specify numlines, or when you specify a number greater than the number of lines from
start to the end of text-expression, all the lines from start to the end of text-expression are
copied.
Examples
The statement
SHOW EXTLINES(mktglist 2 1)
EXTRACT
The EXTRACT function extracts and returns the value of a specified datetime value
from a datetime or interval value expression. This function can be very useful for
manipulating datetime values in very large variables.
Return Values
The value returned varies:
■ When extracting from a datetime with a time zone value, the function returns a
value in UTC.
■ When you extract a TIMEZONE_REGION or TIMEZONE_ABBR (abbreviation),
the function returns a a text string that is the appropriate time zone name or
abbreviation.
■ When you extract any of the other values, the function returns a value in the
Gregorian calendar.
■ When the values you specify results in an ambiguity, the function returns NA.
Syntax
EXTRACT(time |timezone_hour_or_nimute |timezone_regn_or_abbr FROM datetime_exp| interval_exp )
Arguments
time
One of the following keywords: YEAR, MONTH, DAY, HOUR, MINUTE, or SECOND
which specify the portion of the time that you want the function to return.
timezone_hour_or_minute
One of the following keywords: TIMEZONE_HOUR or TIMEZONE_MINUTE which
specify that you want the function to return either the hour or minute portion of a
TIMESTAMP_TZ expression.
timezone_regn_or_abbr
One of the following keywords: TIMEZONE_REGION or TIMEZONE_ABBR which
specify that you want the function to return a string that is either the region name or
its abbreviation.
datetime_exp
A DATETIME, TIMESTAMP, TIMESTAMP_TZ, or TIMESTAMP_LTZ expression. See
"Datetime Expressions" on page 2-35 for information on how to specify these
expressions.
interval_exp
A DSINTERVAL or YMINTERVAL expression. See "Interval Expressions" on page 2-35
for information on how to specify these expressions.
Notes
The value you are extracting must be a value of the appropriate datetime_exp or
interval_exp. For example, you can extract only YEAR, MONTH, and DAY from a
DATETIME value. Likewise, you can extract TIMEZONE_HOUR and TIMEZONE_
MINUTE only from the TIMESTAMP_TZ data type.
Examples
MYTIMESTAMPTZ
------------------------------
26-MAR-06 12.00.00 AM -04:00
FCOPEN
The FCOPEN function creates a forecasting context and returns a handle to this
context.
You must use the FCOPEN function in combination with other OLAP DML statements
as outlined in "Forecasting Programs" on page 4-20.
Return Value
INTEGER
Syntax
FCOPEN(text-expression [prototype-handle])
Arguments
text-expression
The name of the forecasting context.
prototype-handle
An INTEGER expression that is the handle to a different forecasting context that was
previously-created using the FCOPEN function. Oracle OLAP initializes the new
forecasting context with the same options as the forecasting context specified by this
parameter. (See the FCSET command for descriptions of the options that specify the
characteristics of a forecasting context.)
Examples
For an example of a forecasting program, see Example 9–118, "A Forecasting Program"
on page 9-245.
FCQUERY
The FCQUERY function queries the results of a forecast created when the FCEXEC
command executed.
You must use the FCQUERY function in combination with other OLAP DML
statements as outlined in "Forecasting Programs" on page 4-20.
Return Value
The return value depends on the option that you use as described in the tables for this
entry.
Syntax
FCQUERY(HANDLELIST|handle-expression option -
[TRIAL trial-num] [CYCLE cycle-num])
Arguments
HANDLELIST
When you specify the HANDLELIST keyword, the FCQUERY function returns a
multiline text expression that is a list of the handles to forecasting contexts that are
currently open.
handle-expression
An INTEGER expression that is the handle to forecast context that you want to query
and that was previously opened using the FCOPEN function.
option
The specific information that you want to retrieve:
■ When you want information about the options specified for the entire forecast, do
not use the TRIAL keyword. In this case, option can be any of the options that you
can specify using the FCSET command and any of the options listed in Table 7–7,
" Options That You Can Specify for the Entire Forecast" on page 7-139.
Table 7–7 Options That You Can Specify for the Entire Forecast
Keyword Return type Description
HANDLEID TEXT The name of the forecasting context when a value was
specified when the forecasting context was opened using
the FCOPEN command; or NA when no name was
specified at that time.
TRIALSRUN INTEGER The number of trials for which data is available; or NA
when no trials were run.
■ When you want information about a specific trial, use the TRIAL trial-num phrase.
In this case, option can be any of the options listed in Table 7–8, "Options That You
Can Specify for an Individual Trial" on page 7-140.
Table 7–8 Options That You Can Specify for an Individual Trial
Option Return Value Description
ALLOCLAST BOOLEAN Indicates whether the risk of over-adjustment should be
reduced by allocating, instead of forecasting, the last
cycle.
ALPHA DOUBLE The value of Alpha for this trial of the forecast. Alpha is
the level or baseline parameter that is used for the Single
Exponential Smoothing, Double Exponential Smoothing,
and Holt-Winters forecasting methods.
BETA DOUBLE The value of Beta for this trial of the forecast. Beta is the
trend parameter that controls the estimate of the trend.
Beta is used for the Double Exponential Smoothing and
Holt-Winters forecasting methods.
COMPSMOOTH BOOLEAN Indicates whether optimization should be done on the
median smoothed data series.
CYCDECAY DOUBLE The value of the cyclic decay parameter for this trial of
the forecast. Cyclical decay pertains to how seriously
Oracle OLAP considers deviations from baseline activity
when it performs linear and nonlinear regressions.
GAMMA DOUBLE The value of Gamma for this trial of the forecast. Gamma
is the seasonal parameter that is used for the
Holt-Winters forecasting method.
HISTUSED INTEGER The number of historical periods actually used, after all
leading NA values are bypassed.
MAD DOUBLE The mean absolute deviation (MAD) for this trial of the
forecast.
MAPE DOUBLE The mean average percent error (MAPE) for this trial of
the forecast.
MAXFCFACTO DECIMAL The upper bound of the forecast data.
R
METHOD TEXT The forecasting method that Oracle OLAP used for this
trial of the forecast. See the METHOD option of the
FCSET command for descriptions of the various methods.
MINFCFACTOR DECIMAL The lower bound of the forecast data.
MPTDECAY DOUBLE The value of the parameter that Oracle OLAP used when
it adjusted the decay of estimates of base values that were
used when it unraveled the predictions on the moving
periodic total (MPT) series for this trial of the forecast.
NCYCLES INTEGER The number of cycles specified using the PERIODICITY
argument to FCSET.
PERIODICITY INTEGER The length, in periods, of one or more cycles. The return
value depends on the way you call the FCQUERY
function:
When you specify the CYCLE argument, PERIODICITY
returns the number of periods in the specified cycle.
When you do not specify the CYCLE argument and
FCSET ALLOCLAST is NO, PERIODICITY returns the
product of all cycle lengths.
When you do not specify the CYCLE argument and
FCSET ALLOCLAST is YES, PERIODICITY returns the
product of all cycle lengths leaving out the length of the
last (least aggregate) cycle.
Table 7–8 (Cont.) Options That You Can Specify for an Individual Trial
Option Return Value Description
RMSE DOUBLE The root mean squared error (RMSE) for this trial of the
forecast.
SMOOTHING BOOLEAN Indicates whether Oracle OLAP smoothed the data for
this trial of the forecast. YES indicates that Oracle OLAP
smoothed the data; NO indicates that Oracle OLAP did
not smooth the data.
TRANSFORM TEXT The data filter that Oracle OLAP used for this trial of the
forecast. See the TRANSFORM option of the FCSET
command for descriptions of the various filters.
TRENDHOLD DOUBLE The value of the trend hold parameter for this trial of the
forecast. trend hold parameter that indicates trend
reliability in Double Exponential Smoothing and
Holt-Winters forecasting methods.
trial-num
An INTEGER expression that is the number of the trial for which you want to retrieve
information.
cycle-num
An INTEGER expression that specifies a cycle for which you want information from
the PERIODICITY option (see Table 7–8, " Options That You Can Specify for an
Individual Trial" on page 7-140). When you specified a series of cycles using the
PERIODICITY argument in the FCSET command, then the value of cycle-num indicates
the position of the cycle of interest in the specified series. For example, assume that
FCSET PERIODICITY <52,7> was specified. In this case, a cycle-num of 1 returns 52
and a cycle-num of 2 returns 7. When you did not specify a series of cycles using the
PERIODICITY argument in the FCSET command, then it is unnecessary to specify this
argument.
Notes
Using Options
You can retrieve information about the options specified for the entire forecast or
information about a specific trial.
■ When you want information about the options specified for the entire forecast, do
not use the TRIAL keyword. In this case, option can be HANDLEID, TRIALSRUN,
or any of the options that you can specify using the FCSET command.
■ When you want information about a specific trial, use the TRIAL trial-num phrase.
In this case, option can be ALPHA, BETA, CYCDECAY, GAMMA, MAD, MAPE,
METHOD, MPTDECAY, RMSE, SMOOTHING, TRANSFORM, or TRENDHOLD.
■ In a QUAL function, FCQUERY returns data for the specified values of the
qualified dimensions.
■ In all other cases, FCQUERY returns data for the first value in status of each of its
dimensions.
Examples
A sample report created from the output of the QUERYALL program follows.
3 TRIALS
1 METHOD HOLT/WINTERS
1 TRANSFORM TRNOSEA
1 SMOOTHING NO
1 ALPHA 0.2
1 BETA 0.3
1 GAMMA 0.3
1 TRENDHOLD 0.8
1 CYCDECAY -1
1 MPTDECAY -1
1 MAD 324.97047
1 MAPE 23.6192147
1 RMSE 389.40202
2 METHOD HOLT/WINTERS
2 TRANSFORM TRNOSEA
2 SMOOTHING NO
2 ALPHA 0.2
2 BETA 0.3
2 GAMMA 0.2
2 TRENDHOLD 0.8
2 CYCDECAY -1
2 MPTDECAY -1
2 MAD 324.97047
2 MAPE 23.6192147
2 RMSE 389.40202
3 METHOD HOLT/WINTERS
3 TRANSFORM TRNOSEA
3 SMOOTHING NO
3 ALPHA 0.2
3 BETA 0.3
3 GAMMA 0.1
3 TRENDHOLD 0.8
3 CYCDECAY -1
3 MPTDECAY -1
3 MAD 324.97047
3 MAPE 23.6192147
3 RMSE 389.40202
FILEERROR
The FILEERROR function returns information about the first error that occurred when
you are processing a record from an input file with the data reading statements
FILEREAD and FILEVIEW. It can tell you what type of error occurred and where
Oracle OLAP was in the record. The keyword you specify as an argument determines
the kind of information that is returned.
You should call FILEERROR once to find out the type of error. Then, you can call
FILEERROR again to get more details about what caused the error. The return values
for the type of error are also FILEERROR keywords. When FILEERROR returns a
value other than NA, then you would probably call FILEERROR a second time using
the return value itself as an argument.
The abbreviation for FILEERROR is FILEERR
Return Value
Varies depending on the specified keyword.
Syntax
FILEERROR (TYPE|POSITION|WIDTH|VALUE|DIMENSION)
Arguments
TYPE
Returns a text expression that specifies the type of error that has occurred. The types of
errors and their meanings are listed in Table 7–9, " Types of Errors Returned by
FILEERROR".
POSITION
Returns an INTEGER that is the column number (for RULED records) or field number
(for STRUCTURED records) when the error occurred.
WIDTH
Returns an INTEGER that is the current field width. It will return NA when NA was
specified as the width or the error was a POSITION error. A POSITION error stops
processing before the width can be evaluated.
VALUE
When the error type is VALUE, it returns a text expression that is the value that could
not be converted. When the data is packed, the invalid value is shown as hexadecimal
escapes. When the error type is DIMENSION, it returns the value that did not match
any existing dimension value. For other error types, it returns NA.
DIMENSION
When the error type was DIMENSION, it returns a text expression that is the name of
the dimension that had no matching dimension values. For other error types, it returns
NA.
Notes
Flow of Control
When an error occurs in FILEREAD or FILEVIEW, processing of the current record
stops and Oracle OLAP displays an appropriate error message. Then, when your
program has a trap label, control branches to the label where you might call
FILEERROR to investigate the problem. When you branch back to a FILEREAD or
FILENEXT function, processing continues with the next record. When there are more
errors in the record, they will not be evaluated.
Examples
FILEGET
The FILEGET function returns text from a non-binary file that has been opened for
reading. When FILEGET reaches the end of the file, it returns NA. All text read with
FILEGET is translated into the database character set. FILEGET cannot read data that
cannot be represented in the database character set.
Return Value
TEXT
Syntax
FILEGET(fileunit [LENGTH int-expression])
Arguments
fileunit
AnINTEGER value that was assigned to a file opened for reading in a previous call to
the FILEOPEN function.
LENGTH int-expression
An INTEGER expression specifying the number of bytes FILEGET returns from the
file. When an end-of-line character is reached in the input file, FILEGET simply starts a
new line in the result it is constructing. When LENGTH is omitted, FILEGET reads one
line or record regardless of how many bytes it contains.
Notes
Examples
FILENEXT
The FILENEXT function makes a record available for processing by the FILEVIEW
command. It returns YES when it was able to read a record and NO when it reached the
end of the file.
Return Value
BOOLEAN
Syntax
FILENEXT(fileunit)
Arguments
fileunit
An INTEGER value that is assigned to a file that is opened for reading in a previous
call to the FILEOPEN function or by the OUTFILE command.
Notes
Processing Data
After reading a record with FILENEXT, use a FILEVIEW statement to process the
record. FILEVIEW processes input data and assigns the data to analytic workspace
objects or local variables according to a description of each field. You can call
FILEVIEW more than once for continued processing of the same record. To process
another record, call FILENEXT again.
Automatic Looping
When all the records are being processed in essentially the same way, the FILEREAD
command is easier to use because it loops over the records in a file automatically.
Writing Records
To write selected records to an output file, see the FILEPUT command.
Record Numbers
Use the RECNO function to get the current record number for any file that is opened
for read-only access.
Examples
You want to process records only for your division, whose code is A. The following
program excerpt opens the file, reads the lines of the file, determines if the data is for
division A and, if so, reads the sales data, then closes the file. The file name is given as
an argument on the statement line after the program name.
VARIABLE fil.unit INTEGER
. . .
fil.unit = FILEOPEN(arg(1) READ)
LIMIT month TO &arg(2)
WHILE FILENEXT(fil.unit)
DO
FILEVIEW fil.unit WIDTH 1 rectype
IF rectype EQ 'A'
THEN FILEVIEW fil.unit COLUMN 2 WIDTH 10 district -
WIDTH 10 product -
COLUMN 30 WIDTH 4 BINARY sales -
WIDTH 4 BINARY UNITS
DOEND
FILECLOSE fil.unit
FILEOPEN
The FILEOPEN function opens a file, assigns it a fileunit number (an arbitrary
INTEGER), and returns that number. You use the fileunit number, rather than a file
name, in any further references to the file. When Oracle OLAP cannot open the file, an
error occurs.
Return Value
INTEGER
Syntax
FILEOPEN(file-name {READ|WRITE|APPEND} [BINARY]) [NLS_CHARSET charset-exp]
Arguments
file-name
A text expression specifying the name of the file you want to open. Unless the file is in
the current directory, you must include the name of the directory object in the name of
the file.
Note: Directory objects are defined in the Database, and they control
access to directories and file in those directories. You can use a CDA
statement to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
READ
(Abbreviated R) Opens the file for reading.
WRITE
(Abbreviated W) Opens the file for writing. File access begins at the top of the file.
Therefore, opening an existing file in WRITE mode erases its contents completely even
before anything is written to the file.
APPEND
Opens the file for writing. File access begins at the end of the file, and data is added to
the existing contents.
BINARY
Opens a binary-format file (a file with packed or binary data). When you specify
BINARY, Oracle OLAP considers every character in the file to be data. Rather than
using newline characters to tell when records end, it assumes records of a fixed length,
which you can set with FILESET(...LSIZE). The default record length is 80.
NLS_CHARSET charset-exp
Specifies the character set that Oracle OLAP will use when reading data from the file
specified by file-name. When this argument is omitted, then Oracle OLAP handles the
data in the file as having the database character set, which is recorded in the NLS_
LANG option.
Notes
Access Modes
The mode of access, READ, WRITE, or APPEND, must be appropriate to the file.
Examples
FILEQUERY
The FILEQUERY function returns information about a file. The attribute argument you
specify in your FILEQUERY function call determines the type of information that is
returned.
Return Value
The data type of the return value depends on the attribute you specify. See Table 7–10,
" File Attributes Returned by FILEQUERY" on page 7-154 for more information.
Syntax
FILEQUERY(file-id attrib-arg)
Arguments
file-id
A fileunit number or a file name.
■ A fileunit number is a number that Oracle OLAP assigned to a file you opened
through a previous call to the FILEOPEN function or through the OUTFILE
command. You can use the return value of the FILEOPEN function or the value of
the OUTFILEUNIT option.
■ A file name is a text expression specifying the name of the file you want to move
or rename. Unless the file is in the current directory, you must include the name of
the directory object in the name of the file.
Note: Directory objects are defined in the Database, and they control
access to directories and file in those directories. You can use a CDA
statement to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
Some attributes require that you specify a fileunit number; others require the file
name. In many cases, you can specify either. See Table 7–10, " File Attributes Returned
by FILEQUERY" on page 7-154 for more information.
attrib-arg
Specifies the type of information you want to retrieve about the file. The data type of
FILEQUERY's return value depends on the attribute you specify. The attribute you
specify must be appropriate for the file; otherwise, an error occurs. Table 7–10, " File
Attributes Returned by FILEQUERY" on page 7-154 lists the valid keywords for
attrib-arg and, for each keyword, provides a description and indicates whether you
specify a file-unit-number of a file-name for the file-id argument.
EXISTS TRUE when the file exists; FALSE when it is not. BOOLEAN Fileunit number
or file name
FILENAME The file name associated with the fileunit. TEXT Fileunit number
LINENUM The current line number. Resets after each page break when INTEGER Fileunit number
PAGING is on; keeps incrementing when PAGING is off. When
file is currently open in READ mode, returns the current record
number.
LINESLEFT The number of lines left on the page. INTEGER Fileunit number
LSIZE For a file that is open for writing, the line length for the standard INTEGER Fileunit number
Oracle OLAP page heading. (See the STDHDR program.) For a
fileunit that is open for reading, specifies the record length for
binary input files.
NAMELIST The name of the file (such as demo), without an extension. TEXT Fileunit number
or file name
NLS_CHARSET The character set being used for this fileunit. See the FILEOPEN TEXT Fileunit number
function for more information.
NUMBYTES The size of the file in bytes. INTEGER Fileunit number
or file name
ORIGIN The type of computer on which the file was created. The TEXT Fileunit number
ORIGIN attribute, which is relevant only for files that are open
for reading, is set when you issue a FILESET statement.
PAGENUM The current page number. See "Paging Attributes" on page 7-155. INTEGER Fileunit number
PAGEPRG The Oracle OLAP program or statement that produces headings TEXT Fileunit number
when output is paged. See "Paging Attributes" on page 7-155.
PAGESIZE The number of lines on each page. See "Paging Attributes" on INTEGER Fileunit number
page 7-155.
PAGING TRUE when the output is formatted in pages; FALSE when it is BOOLEAN Fileunit number
not. See "Paging Attributes" on page 7-155.
PAUSEATPAGEEND TRUE when Oracle OLAP will pause after each page; FALSE BOOLEAN Fileunit number
when it will not. See "Paging Attributes" on page 7-155.
R[EAD] TRUE when the file is open for reading; FALSE when it is not. BOOLEAN Fileunit number
RO TRUE when the file's read-only attribute is set; FALSE when it is BOOLEAN Fileunit number
not. or file name
SPECLIST The name and extension of the file. TEXT Fileunit number
or file name
TABEXPAND TRUE when the tab characters will be expanded when the file is BOOLEAN Fileunit number
read by FILEGET or FILEREAD; FALSE when they will not. See or file name
"Tab Treatment" on page 7-155.
TMARGIN The number of blank lines that form the top margin. INTEGER Fileunit number
UNIT The file unit for the specified file name. INTEGER File name
W[RITE] TRUE when the file is open for writing; FALSE when it is not. BOOLEAN Fileunit number
Notes
Tab Treatment
When you want tab characters in the source file to be expanded when read by
FILEGET or FILEREAD, you can specify the TABEXPAND attribute with the FILESET
command. When TABEXPAND is zero, tab characters will not be expanded. A value
greater than 0 indicates the distance, in bytes, between tab stops. The default value of
TABEXPAND is 8.
Paging Attributes
The paging attributes apply only to files that currently, unless otherwise noted, have
PAGING set to YES and are open in WRITE mode -- such as files opened with
FILEOPEN(...WRITE) or FILEOPEN(...APPEND). You can set any of the paging
attributes with the FILESET command.
Wildcard Characters
(Unix only) When querying for Unix file names, wildcard characters (that is, * ?) are
allowed when searching with the NAMELIST, SPECLIST, and EXISTS attribute
arguments.
Examples
Example 7–93 Setting Paging Options for a File Opened for Writing
The following statements show how the paging options are set for a file opened for
writing.
DEFINE fil.unit INTEGER
fil.unit = FILEOPEN('REPORT' WRITE)
■ The statement
SHOW FILEQUERY(fil.unit PAGING)
■ The statement
SHOW FILEQUERY(fil.unit PAGESIZE)
■ The statement
SHOW FILEQUERY(fil.unit TMARGIN)
FILTERLINES
The FILTERLINES function applies a filter expression that you create to each line of a
multiline text expression.
Return Value
TEXT or NTEXT
This function accepts TEXT values and NTEXT values as arguments. The data type of
the return value depends on the data type of the values specified for the arguments:
■ When all arguments are TEXT values, the return value is TEXT.
■ When all arguments are NTEXT values, the return value is NTEXT.
■ When the arguments include both TEXT and NTEXT values, the function converts
all TEXT values to NTEXT before performing the function operation, and the
return value is NTEXT.
Syntax
FILTERLINES(source-expression filter-expression)
Arguments
source-expression
A multiline text expression whose lines should be modified according to
filter-expression.
filter-expression
An expression to be applied as a filter to each line of source-expression. The terms of the
filter expression dictate the processing that FILTERLINES will perform on each line of
the source expression.
The filter expression may produce NA, which means that there is no line in the
resulting text expression corresponding to the current line of the source expression.
You can use the keyword VALUE in your filter expression to represent the current line
of the source expression.
Notes
Examples
myfile1.txt
file2.txt
myfile3
file4.txt
the statement
SHOW FILTERLINES(FILELIST -
IF FINDCHARS(VALUE '.') GT 0 -
THEN EXTCHARS(VALUE 1 FINDCHARS(VALUE '.') -1) -
ELSE VALUE)
FINDBYTES
The FINDBYTES function returns the byte position of the beginning of a specified
group of bytes within a text expression.
Tip: When you are using a single-byte character set, you can use the
FINDCHARS function instead of the FINDBYTES function.
Return Value
INTEGER
Syntax
FINDBYTES(text-expression, bytes [starting-pos [LINENUM]])
Arguments
text-expression
The TEXT expression in which you are searching for the specified bytes. The value of
text-expression can be a multiline value. In this case, FINDBYTES searches all lines for
the specified bytes. The match must be exact, including a match of upper- and
lowercase characters.
Tip: When you must use this function on NTEXT values, use the
CONVERT or TO_CHAR function to convert the NTEXT value to
TEXT.
bytes
The group of bytes for which you are searching. When bytes is a multiline value,
FINDBYTES ignores all lines except the first one.
When bytes is not found in text-expression, FINDBYTES returns zero. When the group
of bytes occurs more than once, FINDBYTES returns the position of its first occurrence.
starting-pos
An INTEGER expression that specifies the byte position where the search in
text-expression should start. The default is at position 1 (the first byte) in text-expression.
LINENUM
Specifies that FINDBYTES should return the line number instead of the byte position
of the beginning of the specified text.
Examples
The statement
SHOW FINDBYTES('hellotherejoe', 'al')
FINDCHARS
Tip: When you are using a multibyte character set, you can use the
FINDBYTES function instead of the FINDCHARS function.
Return Value
INTEGER
Syntax
FINDCHARS(text-expression, characters [starting-pos [LINENUM]])
Arguments
text-expression
The text expression in which you are searching for the specified characters.
Text-expression can be a multiline value. In this case, FINDCHARS searches all lines for
the specified characters. The match must be exact, including a match of upper- and
lowercase characters.
FINDCHARS accepts TEXT values and NTEXT values as arguments. When only one
argument is NTEXT, then FINDCHARS automatically converts the other argument to
NTEXT before performing the function operation
characters
The group of characters for which you are searching. When characters is a multiline
value, FINDCHARS ignores all lines except the first one.
When characters is not found in text-expression, FINDCHARS returns zero. When the
group of characters occurs more than once, FINDCHARS returns the position of its
first occurrence.
starting-pos
An INTEGER expression that specifies the character position where the search in
text-exp should start. The default is at position 1 (the first character) in text-exp.
LINENUM
Specifies that FINDCHARS should return the line number instead of the character
position of the beginning of the specified text.
Examples
The statement
SHOW FINDCHARS('hellotherejoe', 'al')
FINDLINES
The FINDLINES function determines the position of one or more lines in a multiline
text expression.
Return Value
INTEGER
Syntax
FINDLINES(text-expression, lines)
Arguments
text-expression
A text expression within whose values you want to locate a certain line or group of
lines. FINDLINES searches text-expression for the specified lines. The match must be
exact, including a match of uppercase and lowercase characters. Also, when you
specify two or more lines, FINDLINES searches for all the specified lines as a single
continuous block in text-expression. When all the lines occur in text-expression, but are
not in a continuous block, FINDLINES returns 0 (not found).
FINDLINES accepts TEXT values and NTEXT values as arguments. When only one
argument is NTEXT, then FINDLINES automatically converts the other argument to
NTEXT before performing the function operation.
Note that when the value of text-expression is NA, FINDLINES returns NA.
lines
A second text expression containing the line(s) for which you are searching. When
lines is not found in text-expression, FINDLINES returns 0. When lines occurs more than
once, FINDLINES returns the line number of its first occurrence.
Examples
The characters "\n" in the lines argument to the following FINDLINES function call
indicates a line break to show that "product" and "services" are separate lines.
SHOW FINDLINES(newlist, 'products\nservices')
FINTSCHED
The FINTSCHED function calculates the interest portion of the payments on a series of
fixed-rate installment loans that are paid off over a specified number of time periods.
For each time period, you specify the amount of the loans incurred during that time
period and a single interest rate that will apply to those loans over their lifetime.
FINTSCHED calculates the result for a given time period as the sum of the interest due
on each loan that is incurred or outstanding in that period.
Return Value
DECIMAL
The result returned by the FINTSCHED function is dimensioned by the union of all
the dimensions of loans, rates, n, and the dimension used as the time-dimension
argument.
Syntax
FINTSCHED(loans, rates, n, [time-dimension] [STATUS])
Arguments
loans
A numeric expression that contains the initial amounts of the loans. When loans does
not have a time dimension, or when loans is dimensioned by more than one time
dimension, the time-dimension argument is required.
rates
A numeric expression that contains the interest rates charged for loans. When rates is a
dimensioned variable, it can be dimensioned by any dimension, including a different
time dimension. When rates is dimensioned by a time dimension, you specify the
interest rate in each time period that will apply to the loans incurred in that period.
The interest rate for the time period in which a loan is incurred applies throughout the
lifetime of that loan. The rates are expressed as decimal values; for example, a 5
percent rate is expressed as.05.
n
A numeric expression that specifies the number of payments required to pay off the
loans in the series. The n expression can be a dimensioned variable, but it cannot be
dimensioned by the time dimension argument. One payment is made in each time
period of the time dimension by which loans is dimensioned or in each time period of
the dimension specified in the time-dimension argument. For example, one payment is
made each month when loans is dimensioned by MONTH.
time-dimension
The name of the dimension along which the interest payments are calculated. When
the time dimension has a type of DAY, WEEK, MONTH, QUARTER, or YEAR, the
time-dimension argument is optional, unless loans has more than one time dimension.
STATUS
Specifies that FINTSCHED should use the current status list (that is, only the
dimension values currently in status in their current status order) when computing the
interest portion of the payments. By default FINTSCHED uses the default status list.
Notes
Table 7–11 Effect of NASKIP When Loan or Rate Values are NA for a Time Period
Loan Value Rate Value Result When NASKIP = YES Result When NASKIP = NO
Non-NA NA Error Error
NA Non-NA Interest values NA for the affected time
periods
(NA loan value is treated as
zero)
NA NA NA for affected time periods NA for the affected time
periods
Examples
Suppose you assign the following values to the variables loans and rates.
YEAR LOANS RATES
-------------- ---------- ----------
Yr95 100.00 0.05
For each year, loans contains the initial value of the fixed-rate loan incurred during
that year. For each year, the value of rates is the interest rate that will be charged for
any loans incurred in that year; for those loans, this same rate is charged each year
until the loans are paid off.
The following statement specifies that each loan is to be paid off in three payments,
calculates the interest portion of the payments on the loans,
REPORT W 20 HEADING 'Payment' FINTSCHED(loans, rates, 3, year)
The interest payment for 1995 is interest on the loan of $100 incurred in 1995, at 5
percent. The interest payment for 1996 is the sum of the interest on the remaining
principal of the 1995 loan, at 5 percent, plus interest on the loan of $200 incurred in
1996, at 6 percent. The 1997 interest payment is the sum of the interest on the
remaining principal of the 1995 loan, at 5 percent; interest on the remaining principal
of the 1996 loan, at 6 percent; and interest on the loan of $300 incurred in 1997, at 7
percent. Since the 1995 loan is paid off in 1997, the payment for 1998 represents
interest on the remaining principal of the 1996 and 1997 loans. In 1999, the interest
payment is on the remaining principal of the 1997 loan.
FLOOR
The FLOOR function returns the largest whole number equal to or less than a specified
number.
Return Value
NUMBER
Syntax
FLOOR(n)
Arguments
n
A number.
Examples
Example 7–99 Displaying the Largest Integer Equal to or Less Than a Number
The following statements show results returned by the FLOOR function.
■ The following SHOW FLOOR statement produces the result that follows it.
SHOW FLOOR(15.7)
15
■ The following SHOW FLOOR statement produces the result that follows it.
SHOW FLOOR(4)
■ The following SHOW FLOOR statement produces the result that follows it.
SHOW FLOOR(-6.457)
-7
FPMTSCHED
The FPMTSCHED function calculates a payment schedule (principal plus interest) for
paying off a series of fixed-rate installment loans over a specified number of time
periods. For each time period, you specify the amount of the loans incurred during
that time period and a single interest rate that will apply to those loans over their
lifetime.
FPMTSCHED calculates the payment for a given time period as the sum of the
principal and interest due on each loan that is incurred or outstanding in that period.
Return Value
DECIMAL
The result returned by the FPMTSCHED function is dimensioned by the union of all
the dimensions of loans and rates and the dimension used as the time-dimension
argument.
Syntax
FPMTSCHED(loans, rates, n, [time-dimension] [STATUS])
Arguments
loans
A numeric expression that contains the initial amounts of the loans. When loans does
not have a time dimension, or when loans is dimensioned by more than one time
dimension, the time-dimension argument is required.
rates
A numeric expression that contains the interest rates charged for loans. When rates is a
dimensioned variable, it can be dimensioned by any dimension, including a different
time dimension. When rates is dimensioned by a time dimension, you specify the
interest rate in each time period that will apply to the loans incurred in that period.
The interest rate for the time period in which a loan is incurred applies throughout the
lifetime of that loan. The rates are expressed as decimal values; for example, a 5
percent rate is expressed as.05.
n
A numeric expression that specifies the number of payments required to pay off the
loans in the series. The n expression can be dimensioned, but it cannot be dimensioned
by the time dimension argument. One payment is made in each time period of the
time dimension by which loans is dimensioned or in each time period of the dimension
specified in the time-dimension argument. For example, one payment each month is
made when loans is dimensioned by month.
time-dimension
The name of the dimension along which the interest payments are calculated. When
the time dimension for loans has a type of DAY, WEEK, MONTH, QUARTER, or
YEAR, the time-dimension argument is optional, unless loans has more than one time
dimension.
STATUS
Specifies that FPMTSCHED should use the current status list (that is, only the
dimension values currently in status in their current status order) when computing the
payment schedule. By default FPMTSCHED uses the default status list.
Notes
Examples
Suppose you assign the following values to the variables loans and rates.
year loans rates
-------------- ---------- ----------
Yr95 100.00 0.05
Yr96 200.00 0.06
Yr97 300.00 0.07
Yr98 0.00 0.00
Yr99 0.00 0.00
For each year, loans contains the initial value of the fixed-rate loan incurred during
that year. For each year, the value of rates is the interest rate that will be charged for
any loans incurred in that year; for those loans, this same rate is charged each year
until the loans are paid off.
The following statement specifies that each loan is to be paid off in three payments,
calculates the schedule for paying off the principal and interest on the loans,
REPORT W 20 HEADING 'Payment' FPMTSCHED(loans, rates, 3, year)
The payment for 1995 is the principal due on the loan of $100 incurred in 1995, plus
interest on the loan at 5 percent. The payment due in 1996 is the sum of the second
payment on the loan incurred in 1995 (principal plus 5 percent interest), plus the first
payment on the loan of $200 incurred in 1996 (principal plus 6 percent interest). The
1997 payment is the sum of the third and final payment on the loan incurred in 1995,
the second of the three payments on the 1996 loan, and the first payment on the loan of
$300 incurred in 1997 (principal plus 7 percent interest). Since the 1995 loan is paid off
in 1997, the payment for 1998 covers the principal and interest for the 1996 and 1997
loans. The payment for 1999 is the final payment of principal and interest for the 1997
loan.
FROM_TZ
Return Values
TIMESTAMP_TZ
Syntax
FROM_TZ (timestamp_value , time_zone_value)
Arguments
timestamp_value
A text expression with a TIMESTAMP data type.
time_zone_value
A text expression that returns a string in the format TZH:TZM or in TZR with optional
TZD format.
Examples
Example 7–102 Creating a TIMESTAMP_TZ Value from a Timestamp Value and a Time
Zone
DEFINE mytimestamp VARIABLE TIMESTAMP
DEFINE mytimezone VARIABLE TEXT
DEFINE mytimestamptz VARIABLE TIMESTAMP_TZ
mytimestamp = '26-MAR-06'
mytimezone = '-04:00'
mytimestamptz = FROM_TZ (mytimestamp mytimezone)
REPORT mytimestamptz
MYTIMESTAMPTZ
------------------------------
26-MAR-06 12.00.00 AM -04:00
GET
The GET function requests input from the current input stream. The input may be a
single item of data, a dimension value, an analytic workspace object, or simply the
next item in the input stream. The simplest form of the GET function requests a value
of a certain data type.
GET(datatype)
Return Value
The return value depends on the input that you request, as described in the syntax.
Syntax
GET({RAW TEXT|[NEW|VALID|POSLIST] input} -
[VERIFY condition-exp [IFNOT result-exp]])
where input is one of the following:
dim-name
NAME
datatype
Arguments
dim-name
A text expression specifying the name of a dimension. When you specify dim-name,
GET requests a value of this dimension as input and verifies that the input is a valid
value of the dimension.
RAW TEXT
Specifies that GET should return the next item in the input stream exactly as it is
entered. See "GET with RAW TEXT" on page 7-173.
NEW dim-name
The NEW keyword with the dim-name argument causes GET to request a new value
for the dimension. When requesting a dimension value with NEW, GET verifies that
the input is not already a value of the dimension.
VALID dim-name
The VALID keyword with the dim-name argument causes GET to request either a new
value or an existing value of the dimension. When requesting a dimension value with
VALID, GET verifies that the input is either an existing dimension value or a valid
new dimension value.
POSLIST dim-name
The POSLIST keyword with the dim-name argument causes GET to request a
dimension value identified by its position in the dimension. When requesting a
dimension value with POSLIST, GET verifies that the input is an existing position
number in the dimension. See "GET with POSLIST" on page 7-174.
NAME
Indicates that GET is requesting the name of an object in the current analytic
workspace. When you specify NAME, GET verifies that the input is an object that
exists in the current analytic workspace. The object name must not be enclosed in
single quotes, and it must follow the rules for valid object names explained in the main
DEFINE entry. GET automatically converts the object name to uppercase.
NEW NAME
The NEW NAME keywords cause GET to request a name for a new analytic
workspace object. When requesting an analytic workspace object name with NEW,
GET verifies that the input is not already the name of an object in any attached analytic
workspace (including EXPRESS.DB).
VALID NAME
The VALID NAME keywords cause GET to request a name for an analytic workspace
object. When requesting an analytic workspace object name with VALID, GET verifies
that the input follows the rules for valid object names, even when there is no current
analytic workspace and regardless of whether the name already exists.
POSLIST NAME
The POSLIST NAME keywords cause GET to request an analytic workspace object
name identified by its position in the NAME dimension. When requesting an analytic
workspace object name with POSLIST, GET verifies that the input is an existing
position number in the NAME dimension.
datatype
Specifies the type of data being requested by GET. This can be any of the Oracle OLAP
data types: INTEGER, SHORTINTEGER, DECIMAL, SHORTDECIMAL, BOOLEAN,
ID, TEXT, or DATE. GET accepts a value of NA when requesting any data type.
The IFNOT clause specifies a text expression to provide for occasions when the input
does not satisfy condition-exp. For example, you might jump to an error-handling
routine in your program. When you do not use IFNOT and an error occurs, GET
produces an error message and then resumes waiting for input.
Notes
TEXT or ID Values
TEXT and ID values provided as input to GET retain the case in which they were
entered. You do not need to enclose TEXT and ID values in quotes unless they begin
with single or double quotes, or contain embedded blanks or escape sequences, such
as \dnnn or \n. (Remember to precede any single quote in the value with a backslash
(\') so Oracle OLAP will interpret it literally.)
DATE-only Values
When GET requests a DATE value, you can provide the input in any of the valid styles
for dates, as explained in "Date-only Input Values" on page 2-6. Oracle OLAP uses the
current value of the DATEORDER option to resolve any ambiguity in the DATE-only
value.
Numeric Values
GET rounds a SHORTDECIMAL or DECIMAL value when converting it into an
INTEGER value. When GET requests an INTEGER or SHORTINTEGER value and the
input is a number beyond the range for that data type, GET produces an error message
and resumes waiting for input.
Examples
GREATEST
The GREATEST function returns the largest expression in a list of expressions. All
expressions after the first are implicitly converted to the data type of the first
expression before the comparison.
To retrieve the smallest expression in a list of expressions, use LEAST.
Return Value
The data type of the first expression.
Syntax
GREATEST (expr [, expr]...)
Arguments
expr
An expression.
Examples
Example 7–104 Finding the the Text Expression that is Last Alphabetically
The following statement selects the string that is last in alphabetic sequence.
SHOW GREATEST ('Harry', 'Harriot', 'Harold')
Harry
GROUPINGID function
Return Values
NUMBER
Syntax
GROUPINGID (gidrel...)
Arguments
gidrel
A grouping id relation for the hierarchical dimension that you previously created
using the GROUPINGID command.
Examples
GROWRATE
The GROWRATE function calculates the growth rate of a time-series expression, based
on the first and last values of the series.
GROWRATE bases its calculation on the values of expression that correspond to the
first and last values in the status of time-dimension. The intervening values of
expression are ignored. GROWRATE uses the following calculation.
GROWRATE = ((last/first)**(1/(n-1))-1
In the exponent, n is the number of values in the status of the time dimension.
Return Value
DECIMAL
The result returned by GROWRATE is dimensioned by all the dimensions of expression
except the dimension specified by time-dimension.
Syntax
GROWRATE(expression [time-dimension])
Arguments
expression
A numeric expression for which you want to calculate the growth rate. The expression
must be dimensioned by a time dimension.The following rules apply to the first and
last values of expression:
■ The first value of expression cannot be zero. (This is to avoid a division by zero in
the GROWRATE calculation.)
■ The first and last values of expression must both be positive or both negative. (Or
the last value of expression can be zero, regardless of whether the first value is
positive or negative.)
■ Neither the first value nor the last value of expression can be NA.
time-dimension
The name of the time dimension by which expression is dimensioned. When the time
dimension has a type of DAY, WEEK, MONTH, QUARTER, or YEAR, the
time-dimension argument is optional, unless loans has more than one time dimension.
Examples
------------------ACTUAL-------------------
-------------------MONTH-------------------
DIVISION Dec95 Jan96 Feb96 Mar96
-------------- ---------- ---------- ---------- ----------
Camping 4,378.09 19,915.13 22,510.38 34,731.63
Sporting 6,297.02 13,180.29 17,429.17 18,819.14
Clothing 87,471.74 107,257.85 133,566.01 127,132.55
HIERCHECK
The HIERCHECK function checks the hierarchy in the specified relation or all of the
relations of the specified aggmap to see if there is any circularity. You can also specify
that HIERCHEK check the hierarchy for other conditions. HIERCHECK always stops
in the first error message.
Return Value
BOOLEAN
Syntax
As Command
HIERCHECK relation-name [STATUS|NOSTATUS|valueset-name] [MULTIPATH] [CONSISTENT]-
[BALANCED levelrelation-name]
or
HIERCHECK aggmap-name [MULTIPATH] [CONSISTENT]levelrelation-name]
Arguments
relation-name
A text expression indicating the name of the parent relation to be checked.
You can use OLAP DML statements to create a parent relation. To do so, you define a
relation that relates a dimension to itself, and then you can specify the parent of each
dimension value in the relation. This makes the dimension hierarchical.
aggmap-name
A text expression indicating the name of the aggmap. HIERCHECK checks all of the
relations in the aggmap.
STATUS
Specifies that HIERCHECK uses the current status of the relation dimension.
valueset
Specifies the values of the relation dimension that HIERCHECK considers in status.
NOSTATUS
Specifies that HIERCHECK uses the default status of the relation dimension.
MULTIPATH
Specifies that HEIRCHECK checks whether there are multiple (more than one) paths
from any child to its parent.
CONSISTENT
Specifies that HIERHECK checks whether the hierarchy is consistent. If the hierarchy
is consistent, that means all nodes in the different hierarchies should have the same
children.
BALANCED levelrel-name
Using the level relation identified by levelrel-name, specifies that HIERHECK checks to
see if all of the following are true:
■ All of the elements of a hierarchy which have an NA level are either roots with no
leaves or leaves.
■ All of the elements of a hierarchy at the same (non NA) level have the same depth
from the root (roots) of the hierarchy.
■ Elements of a hierarchy for different levels (non NA) have different depth.
Notes
Examples
Next, relate the dimension to itself. The following statement defines a parent relation
called GEOG.GEOG, which relates the GEOGRAPHY dimension to itself.
define geog.geog RELATION geography <geography>
You would then specify the hierarchy of the dimension values. In this example, there
will be three levels in the hierarchy: country, regions, and cities. When you specify the
hierarchy, you assign parent dimension values (such as East) to child dimension
values (such as Boston) for every level except the highest level. To do this, you store
values in the relation. First, group the children together with a LIMIT command, then
assign a parent to those children.
LIMIT geography TO 'East' 'Central' 'West'
geog.geog = 'U.S.'
LIMIT geography TO 'Boston' 'Atlanta'
geog.geog = 'East'
LIMIT geography TO 'Chicago' 'Dallas'
geog.geog = 'Central'
LIMIT geography TO 'Denver' 'Seattle'
geog.geog = 'West'
Now you can check for loops in the parent relation geog.geog, as shown by the
following statement.
HIERCHECK geog.geog
In this case, HIERCHECK produces no message output, which means there are no
loops in geog.geog. It sets HIERCHK.LOOPFND to NO, and leaves
HIERCHK.LOOPVALS and HIERCHK.XTRADIMS set to NA.
Now suppose the following mistake had been made in the storing of values in the
relation.
LIMIT geography TO 'East' 'Central' 'West'
geog.geog = 'East'
The preceding statements inadvertently make East its own parent, which would
cause an aggregation to loop infinitely. When you now check the geog.geog relation
for loops, the following statement produces the following error message.
HIERCHECK geog.geog
ERROR: HIERCHECK has detected one or more loops in the hierarchy represented by GE
OG.GEOG. The values involved are 'East'.
HIERHEIGHT function
The HIERHEIGHT function returns the value of a node at a specified level for the first
value in the current status list of a hierarchical dimension.
To populate a previously-defined relation with the values of a specified hierarchical
dimension by level, use the HIERHEIGHT command.
Return Value
The data type returned by HIERHEIGHT is the data type of the dimension value of
parentrel.
Syntax
HIERHEIGHT(fparentrel [,] level)
Arguments
parentrel
A child-parent self-relation for the hierarchical dimension. See "Parentrel Relation" on
page 1-11 for more information.
level
An INTEGER value that represents a level of the hierarchical dimension. The value 1
(one) represents the lowest-level of the hierarchical dimension.
Notes
Examples
GEOGRAPHY G0.STANPARENT
---------------- ----------------
World NA
Americas World
Canada Americas
Toronto Canada
Montreal Canada
Ottawa Canada
... ...
USA Americas
Boston USA
LosAngeles USA
... ...
Mexico Americas
Mexicocity Mexico
Argentina Americas
BuenosAires Argentina
Brazil Americas
Saopaulo Brazil
Colombia Americas
Bogota Colombia
Australia World
East.Aust Australia
Sydney East.Aust
Madrid Spain
Budapest Hungary
Athens Greece
Vienna Austria
Melbourne East.Aust
Central.aust Australia
... ...
Perth West.Aust
Bombay India
Malaysia Asia
Europe World
France Europe
Caen France
Paris France
Now you limit geography to the value Americas by issuing the following OLAP
DML statement.
LIMIT geography TO 'Americas'
When you use the HIERHEIGHT function to find the node for Americas for the
lowest-level of the hierarchy (level 1) by issuing the following OLAP DML statement.
REPORT HIERHEIGHT(g0.stanparent 1)
When you use the HIERHEIGHT function to find the node for Americas for the
highest-level of the hierarchy (level 4) by issuing the following OLAP DML statement.
REPORT HIERHEIGHT(g0.stanparent 4)
------------------------------
World
When you use the HIERHEIGHT function to find the node for Americas for the
levels 2 and 3 of the hierarchy by issuing the following OLAP DML statements.
REPORT HIERHEIGHT(g0.stanparent 2)
REPORT HIERHEIGHT(g0.stanparent 3)
HIERHEIGHT(G0.STANPARENT
COUNTER)
------------------------------
Americas
Notice that the output for each level corresponds in between the values that are
created for a relation created using HIERHEIGHT command. For example, assume
you created a relation named geog.stanhierrel for the standard hierarchy for
geography and limit geography to 'Americas. A report of geog.stanhierrel
would show the same geography values for each level.
LIMIT geography TO 'AMERICAS'
REPORT DOWN geography geog.stanhierrel
---------------------------GEOG.STANHIERREL--------------------
----------------------------GEOG.LVLDIM------------------------
GEOGRAPHY 1 2 3 4
---------------- ---------------- ---------------- ---------------- ------------
Americas NA NA Americas World
Assume also that you limit geography to Americas and Asia and call the
HIERHEIGHT function for each level of the Standard hierarchy by issuing the
following OLAP statements.
LIMIT geography TO 'Americas', 'Asia'
CALL findnodes
The output of the findnodes program for the geography values Americas and
Asia is follows. The program first reports on the value of each level for Americas is
provided. Then it reports on the value of each level for Asia.
HIERHEIGHT(G0.STANPARENT
COUNTER)
------------------------------
NA
HIERHEIGHT(G0.STANPARENT
COUNTER)
------------------------------
NA
HIERHEIGHT(G0.STANPARENT
COUNTER)
------------------------------
Americas
HIERHEIGHT(G0.STANPARENT
COUNTER)
------------------------------
World
HIERHEIGHT(G0.STANPARENT
COUNTER)
------------------------------
NA
HIERHEIGHT(G0.STANPARENT
COUNTER)
------------------------------
NA
HIERHEIGHT(G0.STANPARENT
COUNTER)
------------------------------
Asia
HIERHEIGHT(G0.STANPARENT
COUNTER)
------------------------------
World
Notice that the output for each level corresponds in between the values that are
created for a relation created using the HIERHEIGHT command
LIMIT geography TO 'Americas' 'Asia'
REPORT DOWN geography geog.stanhierrel
---------------------------GEOG.STANHIERREL--------------------
----------------------------GEOG.LVLDIM------------------------
GEOGRAPHY 1 2 3 4
---------------- ---------------- ---------------- ---------------- ------------
Americas NA NA Americas World
Asia NA NA Asia World
INFO
The INFO function obtains information that has been produced by a FORECAST,
PARSE, or REGRESS statement or that has been produced for a model in your analytic
workspace.
Because the syntax of the INFO function is different depending on the type of
information being obtained, four separate entries are provided:
■ INFO (FORECAST)
■ INFO (MODEL)
■ INFO (PARSE)
■ INFO (REGRESS)
INFO (FORECAST)
When you try to extract information without having calculated a forecast, INFO
produces an error. You can use the keyword AVAILABLE to determine whether any
results are currently available.
Return Value
The return value depends on the keyword you use, as described in the tables in this
entry. INFO returns NA when you use an index that is out of range or for any choice
that does not apply to the forecasting method last used. For example, when your
forecast formula has two coefficients and you request the twelfth one, INFO returns
NA.
Syntax
INFO(FORECAST choice [index])
Arguments
FORECAST
Indicates that you want to obtain information produced by a FORECAST statement.
choice
The specific information you want. The choices available for FORECAST are listed in
Table 7–12, " Choices for All Methods", Table 7–13, "Choices for TREND and
EXPONENTIAL Forecasts", and Table 7–14, " Choices for WINTERS Forecasts".
Choices marked as indexed require the index argument.
index
An INTEGER expression that specifies which result you want for a choice that can
have several different results. For example, a trend equation might have several
coefficients. You would use index to specify which coefficient you want information
about. When you omit index for a choice that requires it, an error occurs.
Examples
The next statement obtains the mean absolute percent error for your forecast.
SHOW INFO(FORECAST MAPE)
INFO (MODEL)
The INFO (MODEL) function obtains information that is produced for the models in
your analytic workspace and stored internally by Oracle OLAP. Through the use of
keywords, INFO lets you extract specific pieces of information about the structure of a
compiled model or the status of a model that you have run in your current session.
Use INFO with the keyword AVAILABLE to determine whether any model results are
currently available. When you try to extract any other information without having
considered or defined a model in your current session, INFO produces an error.
Return Value
The return value depends on the keyword you use, as described in the tables in this
entry. INFO returns NA when you use an index that is out of range or when you
request information that is not relevant. For example, if the model contains 5
statements and you request information about statement 6, INFO returns NA; or if you
specify the DIMENSION REFERENCE choice when the assignment target is actually a
variable, INFO returns NA.
Syntax
INFO(MODEL choice [index1 [index2 [index3]]])
where index is an argument specifies the result you want for a choice that can have
several different results. Depending on the keyword choice, you can supply one or
more of the following index arguments:
block-num
dimension-num
element-num
model-num
qualifier-num
source-num
stmnt-num
Arguments
MODEL
Indicates that you want to obtain information about a model in your analytic
workspace. INFO returns information about the model that you have most recently
defined or considered in the current session (see the DEFINE MODEL and CONSIDER
commands).
choice
A keyword that specifies the information you want. The choices available for models
are listed in the following tables that represent different informational categories:
■ Table 7–15, " INFO (MODEL) Choices to Retrieve General Information About the
Model" on page 7-191.
■ Table 7–16, " INFO (MODEL) Choices to Retrieve Information about the Structure
of the Model" on page 7-191.
■ Table 7–17, " INFO (MODEL) Choices to Retrieve Information about Target,
Sources, and Dependencies" on page 7-192. These choices provide information
about statements that are equations. Equations have the form assignment target =
expression. The expression can refer to one or more data sources. Assignment
targets and data sources can be either variables or dimension values, and they can
have qualifiers that affect their dimensionality.
■ Table 7–18, " INFO (MODEL) Choices to Retrieve Information About Execution
Status" on page 7-193. All of these choices (except XEQSTATUS) are relevant only
after running a model with a simultaneous block. When the current model has not
been compiled, Oracle OLAP returns an error when you use any choice except
AVAILABLE or NAME.
Each table consists of four columns that provide the following information: keyword,
data type of returned value; index argument associated with the keyword; and
meaning.
Table 7–15 INFO (MODEL) Choices to Retrieve General Information About the Model
Keywords Data Type Index Arguments Meaning
AVAILABLE BOOL (No arguments) Is there a model for which information is available?
NAME TEXT [MODEL model-num] Without model-num (or with model-num equal to 0), the name of the
current model. With model-num greater than 0, the name of the
included model that is the specified model-num within the current
model.
COUNT STATEMENTS INT (No arguments) The number of statements in the current model. The count
includes comments, equations, and DIMENSION and INCLUDE
commands (if any), it but does not include the statements in an
included model.
STATEMENT TEXT stmnt-num The text of statement stmnt-num.
SIMULTANEOUS BOOL (No arguments) Does the current model contain a simultaneous block?
Table 7–16 INFO (MODEL) Choices to Retrieve Information about the Structure of the Model
Keyword(s) Data Type Index Argument(s) Meaning
COUNT ELEMENTS INT [BLOCK block-num] Without block-num, the number of blocks in the current model.
With block-num, the total number of statements and nested
blocks within block block-num in the current model.
When you request further information about a particular
element (for example, with the TYPE ELEMENT choice), you
always specify the block number to which the element
belongs as well as the number of the element within that
block.
TYPE ELEMENT TEXT element-num BLOCK Returns BLOCK or STATEMENT, depending on whether
block-num element element-num of block block-num is a nested block or a
statement.
NUMBER BLOCK INT element-num BLOCK The block number of the nested block that is element
block-num element-num of block block-num.
Table 7–16 (Cont.) INFO (MODEL) Choices to Retrieve Information about the Structure of the Model
Keyword(s) Data Type Index Argument(s) Meaning
COUNT DIMS INT [BLOCK block-num] Without block-num, the number of model dimensions of the
current model. With block-num, the number of step-forward,
step-backward, or simultaneous dimensions of block
block-num within the current model.
DIMENSION TEXT dimension-num [BLOCK Without block-num, the name of model dimension
block-num] dimension-num of the current model. With block-num, the name
of the specified step-forward, step-backward, or simultaneous
dimension of block block-num.
NUMBER INT element-num BLOCK The statement number of the statement that is element
STATEMENT block-num element-num of block block-num.
The statement number refers to the position of the statement
within its own model. To request further information about
the statement (for example, with the HIDDEN choice), its
model must be the model that you are currently considering.
HIDDEN BOOL stmnt-num Has statement stmnt-num been masked by a subsequent
statement?
NUMBER MODEL INT element-num BLOCK The number of the included model from which the statement
block-num that is element element-num of block block-num is taken.
Table 7–17 INFO (MODEL) Choices to Retrieve Information about Target, Sources, and Dependencies
Keyword(s) Data Type Index Argument Meaning
COUNT SOURCES INT STATEMENT stmnt-num The number of data sources in statement
stmnt-num within the current model.
TYPE REFERENCE TEXT STATEMENT stmnt-num Without source-num, the object type of the
[SOURCE source-num] assignment target of statement stmnt-num. With
source-num, the object type of data source
source-num in statement stmnt-num. The object
type is VARIABLE when the reference is to a
variable. The type is DIMENSION when the
reference is to the value of a dimension.
VARIABLE REFERENCE TEXT STATEMENT stmnt-num Without source-num, the name of the variable
[SOURCE source-num] that is the assignment target of statement
stmnt-num. With source-num, the name of the
variable that is data source source-num in
statement stmnt-num.
VALUE REFERENCE TEXT STATEMENT stmnt-num Without source-num, the dimension value that is
[SOURCE source-num] the assignment target of statement stmnt-num.
With source-num, the dimension value that is
data source source-num in statement stmnt-num.
DIMENSION REFERENCE TEXT STATEMENT stmnt-num Without source-num, the model dimension of the
[SOURCE source-num] target dimension value in statement stmnt-num.
With source-num, the model dimension of source
dimension value source-num in statement
stmnt-num.
Table 7–17 (Cont.) INFO (MODEL) Choices to Retrieve Information about Target, Sources, and
Keyword(s) Data Type Index Argument Meaning
COUNT QUALIFIERS INT STATEMENT stmnt-num Without source-num, the number of qualifiers of
[SOURCE source-num] the assignment target in statement stmnt-num.
With source-num, the number of qualifiers of data
source source-num in statement stmnt-num.
TYPE QUALIFIER TEXT qualifier-num STATEMENT Without source-num, the qualifier type of
stmnt-num [SOURCE qualifier qualifier-num of the target of statement
source-num] stmnt-num. With source-num, the qualifier type of
qualifier qualifier-num of data source source-num
in statement stmnt-num. The qualifier type can
indicate dimensional dependence: LAG
(previous dimension values only), LEAD (later
values only), BOTH (both previous and later
values), and VARIABLE (either previous or later
values, depending on the value of a variable
when the model is run). The qualifier type can
also be QDR (qualified data reference).
DIMENSION QUALIFIER TEXT qualifier-num STATEMENT qualifier-num STATEMENT stmnt-num [SOURCE
stmnt-num [SOURCE source-num]
source-num]
Without source-num, the dimension of qualifier
qualifier-num of the assignment target in
statement stmnt-num. With source-num, the
dimension of qualifier qualifier-num of data
source source-num in statement stmnt-num.
Table 7–18 INFO (MODEL) Choices to Retrieve Information About Execution Status
Keyword(s) Data Type Index Argument Meaning
XEQSTATUS TEXT [BLOCK block-num] Without block-num, the execution status of the model as a
whole; when the model has not been run, the status is NOT
EXECUTED. With block-num, the execution status of block
block-num; when the model has not been run, an error is
returned. When the model has been run, the status for the
model as a whole or for a block can be SOLVED,
DIVERGED, or FAILED TO CONVERGE. The status of an
outer-level block can be EXECUTION INCOMPLETE when
a nested block within it diverged or failed to converge.
COUNT ITERATIONS INT BLOCK block-num The number of iterations that were performed for block
block-num before it was solved or it diverged or failed to
converge.
DAMP DEC (No arguments) The value of the MODDAMP option when the model was
run. (Relevant only when the solution method is GAUSS.)
DIVERGSTMT INT BLOCK block-num The element number of the statement that diverged during
the calculations for block block-num.
GAMMA INT (No arguments) The value of the MODGAMMA option when the model was
run.
MAXITERS INT (No arguments) The value of the MODMAXITERS option when the model
was run.
OVERFLOW INT (No arguments) The value of the MODOVERFLOW option when the model
was run.
SIMULTYPE TEXT (No arguments) The value of the MODSIMULTYPE option when the model
was run: AITKENS or GAUSS.
TOLERANCE INT (No arguments) The value of the MODTOLERANCE option when the model
was run.
block-num
An INTEGER expression that specifies the block for which you want information.
Block-num corresponds to the block numbers that are identified in the report produced
by the MODEL.COMPRPT program.
dimension-num
An INTEGER expression that specifies the model dimension or block dimension for
which you want information. For the model as a whole, the first dimension listed for
the model is dimension-num 1, and so on. For example, assume that the
MODEL.COMPRPT specifies the model dimensions as <line month>. In this case,
line is dimension-num 1 and month is dimension-num 2. For a simultaneous block in
the current model, the first dimension of the block is dimension-num 1, and so on. A
step-forward or step-backward block has a single dimension, so the dimension of the
block is always dimension-num 1. To see a list of the dimensions for the model as a
whole and for each block of the model, you can run the MODEL.COMPRPT program.
element-num
An INTEGER expression that specifies the element for which you want information.
When you request information about an element, you always specify the block
number to which the element belongs. An element is either a statement in the specified
block, or it is a nested block within the specified block. The element numbers
correspond to the order of the statements and blocks in the compiled model. You can
run the MODEL.COMPRPT program to see the list of elements in the compiled model.
For example, suppose the current model has the following compiled structure.
block 1
statement a
block 2
statement b
statement c
END block 2
statement d
END block 1
When you request information about block 1 in the preceding model, statement a
is element-num 1; block 2 is element-num 2; and statement d is element-num 3. When
you request information about block 2, statement b is element-num 1 and
statement c is element-num 2.
model-num
For a hierarchy of included models, an INTEGER expression that specifies the model
for which you want information. The model you are currently considering is
model-num 0 (zero), the model it includes is model-num 1, and so on. The root model
has the highest model number in the hierarchy.
qualifier-num
An INTEGER expression that specifies the qualifier for which you want information.
Qualifiers change the dimensionality of a variable or dimension value reference. The
reference can be qualified by a function, such as LAG, LEAD, or TOTAL or by a
qualified data reference (QDR). To see the qualifiers for a statement, you can run the
MODEL.DEPRT program for the model that contains the statement.
For each equation in the model, the MODEL.DEPRT report lists the assignment target
and its qualifiers on one line, followed by the data sources. Each data source is listed
on a separate line, together with its qualifiers. The MODEL.DEPRTreport also specifies
the type of each qualifier: LAG, LEAD, BOTH, VARIABLE, or QDR (see the TYPE
QUALIFIER choice in the third group of INFO keyword choices).
For the target and each source, qualifier-num corresponds to the order in which the
qualifiers are listed in the MODEL.DEPRT report.
source-num
An INTEGER expression that specifies the data source for which you want
information. In a calculation, each reference to a variable or a dimension value is
counted as a source of data for the assignment target. A constant value is not counted
as a source.
To see the data sources in a statement, you can run the MODEL.DEPRT program for
the model that contains the statement. For each equation in the model, the
MODEL.DEPRT report lists the assignment target on one line, followed by its data
sources. Each data source is listed on a separate line.
stmnt-num
An INTEGER expression that specifies the statement for which you want information.
Stmnt-num always refers to a statement from the model you are currently considering.
It does not refer to a statement taken from an included model.
To see the statement numbers in the current model, you can run the
MODEL.COMPRPT program. To the left of each statement, the report lists the model
from which the statement is taken and the statement number within that model.
Examples
You can run the MODEL.DEPRPT program to see the qualifiers of the target and
sources in this statement.
MODEL.DEPRPT income.plan
This report shows that the assignment target, budget, has two data sources, actual
and plan.factor.
INFO (PARSE)
The INFO (PARSE) function obtains information produced by a PARSE statement and
stored internally by Oracle OLAP. Through the use of keywords, INFO lets you extract
specific pieces of information about the expression that you have parsed.
Return Value
The return value depends on the keyword you use, as described in Table 7–19. When
you try to extract unavailable information or use an index that is out of range, INFO
returns NA. For example, if you parse a phrase that contains four expressions and then
ask for the twelfth FORMULA, INFO will return NA.
Syntax
INFO(PARSE choice [index])
Arguments
PARSE
Indicates that you want to obtain information produced by a PARSE statement.
choice
The specific information you want. The choices available for PARSE are listed in
Table 7–19, " INFO PARSE Keywords". Choices marked as indexed can take the
optional index argument.
index
An INTEGER expression that specifies which result you want for a choice that can
have several different results. For example, when you parse text that contains three
expressions, each expression has its own formula and data type. You would use index
to specify which expression you are interested in.
When you omit index, INFO returns all the information as a multiline value.
Examples
When users run the program, they can supply either the name of a variable (sales) or
an expression (sales-expense) or both as arguments.
The following statement
REPORT1 sales sales-expense
INFO (REGRESS)
Return Value
The return value depends on the keyword you use, as described in Table 7–20, " INFO
REGRESS Keywords".
Syntax
INFO(REGRESS choice [index])
Arguments
REGRESS
Indicates that you want to obtain information produced by an REGRESS statement.
choice
The specific information you want. The choices available for REGRESS are listed in
Table 7–20, " INFO REGRESS Keywords". Choices marked as indexed require the index
argument.
index
An INTEGER expression that specifies which result you want for a choice that can
have several different results. For example, in a regression there may be more than one
independent variable. You would use index to specify which independent variable you
want information about. When you omit index for a choice that requires it, an error
occurs.
Notes
Examples
INITCAP
The INITCAP function returns a specified text expression, with the first letter of each
word in uppercase and all other letters in lowercase. Words are delimited by white
space or characters that are not alphanumeric.
Return Value
The same data type as the expression.
Syntax
INITCAP (text-exp)
Arguments
text-exp
A text expression.
Examples
INLIST
The INLIST function determines whether every line of a text value is a line in a second
text value. Normally, INLIST is used to determine whether all the lines of a list (in the
form of a multiline text value) can be found in a master list (in the form of a second
multiline text value).
INLIST accepts TEXT values and NTEXT values as arguments. When only one
argument is NTEXT, then INLIST automatically converts the other argument to
NTEXT before performing the function operation.
Return Value
BOOLEAN
Syntax
INLIST(masterlist list)
Arguments
masterlist
A multiline text expression to which the lines of list are compared.
list
A multiline text expression whose lines are compared with the lines of masterlist.
When every line of list can be found as a line of masterlist, INLIST returns the value
YES. When one or more lines of list are not found in masterlist, INLIST returns the
value NO.
Examples
The first function call compares a list, which is specified as a text literal, with the
master list. The return value is YES.
INLIST(depts, 'Accounting\nPersonnel')
The second function call compares a variable newlist that has the following values,
Development
Accounting
INSBYTES
The INSBYTES function inserts one or more bytes into a text expression.
When you are using a single-byte character set, you can use INSCHARS.
Return Value
TEXT
Syntax
INSBYTES(text-expression bytes [after])
Arguments
text-expression
A TEXT expression into which the bytes are to be inserted. When text-expression is a
multiline TEXT value, INSBYTES preserves the line breaks in the returned value.
bytes
One or more bytes that you insert into text-expression.
after
An INTEGER that represents the byte position after which the specified bytes are to be
inserted. The position of the first byte in text-expression is 1. To insert bytes at the
beginning of the text, specify 0 for after. When you omit this argument, INSBYTES
inserts the bytes after the last byte in text-expression.
When you specify a value for after that is greater than the length of text-expression,
INSBYTES adds blanks to the last line of text-expression. The number of inserted blanks
is the difference between the value of after and the length of text-expression. For
example, insbytes('abc' 'def' 4) inserts one blank space before adding def to
abc, resulting in.
abc def
Examples
INSCHARS
The INSCHARS function inserts one or more characters into a text expression.
When you are using a multibyte character set, you can use the INSBYTES function
instead of the INSCHARS function.
Return Value
TEXT or NTEXT
This function accepts TEXT values and NTEXT values as arguments. The data type of
the return value depends on the data type of the values specified for the arguments:
■ When all arguments are TEXT values, the return value is TEXT.
■ When all arguments are NTEXT values, the return value is NTEXT.
■ When the arguments include both TEXT and NTEXT values, the function converts
all TEXT values to NTEXT before performing the function operation, and the
return value is NTEXT.
Syntax
INSCHARS(text-expression characters [after])
Arguments
text-expression
The expression into which the characters are to be inserted. When text-expression is a
multiline TEXT value, INSCHARS preserves the line breaks in the returned value.
characters
One or more characters that you insert into text-expression.
after
An INTEGER that represents the character position after which the specified characters
are to be inserted. The position of the first character in text-expression is 1. To insert
characters at the beginning of the text, specify 0 for after. When you omit this
argument, INSCHARS inserts the characters after the last character in text-expression.
When you specify a value for after that is greater than the length of text-expression,
INSCHARS adds blanks to the last line of text-expression. The number of inserted
blanks is the difference between the value of after and the length of text-expression. For
example, INSCHARS('abc' 'def' 4) inserts one blank before adding 'def' to
'abc', resulting in.
abc def
Examples
hellotherejoe
INSCOLS
The INSCOLS function inserts into the columns of a multiline TEXT value all the
columns of another TEXT value. The inserted columns are placed after the column
position you specify, and the original columns in each line are moved to the right. The
function returns a multiline TEXT value composed of the resulting columns.
Return Value
TEXT or NTEXT
This function accepts TEXT values and NTEXT values as arguments. The data type of
the return value depends on the data type of the values specified for the arguments:
■ When all arguments are TEXT values, the return value is TEXT.
■ When all arguments are NTEXT values, the return value is NTEXT.
■ When the arguments include both TEXT and NTEXT values, the function converts
all TEXT values to NTEXT before performing the function operation, and the
return value is NTEXT.
The number of lines in the return value is always the same as the number of lines in
text-expression. When the columns TEXT expression has fewer lines, INSCOLS repeats
its last line in each subsequent line of the return value.
Syntax
INSCOLS(text-expression columns [after])
Arguments
text-expression
The expression into which you want to insert columns.
columns
The expression containing one or more columns in each line. All the columns of this
expression will be inserted into the corresponding lines of text-expression.
after
An INTEGER between 0 and 4,000 representing the column position after which
columns should be inserted. The column position of the first character in each line is 1.
When you do not specify after, insertion begins at the end of each line. The total length
of a line cannot exceed 4,000 columns of single-byte characters or 2,000 columns of
double-byte characters.
When you specify an after column that is to the right of the last character in a given
line in text-expression, the corresponding line in the return value will have spaces
filling in the intervening columns.
Examples
INSLINES
The INSLINES function inserts one or more lines into a multiline text expression.
Return Value
TEXT or NTEXT
This function accepts TEXT values and NTEXT values as arguments. The data type of
the return value depends on the data type of the values specified for the arguments:
■ When all arguments are TEXT values, the return value is TEXT.
■ When all arguments are NTEXT values, the return value is NTEXT.
■ When the arguments include both TEXT and NTEXT values, the function converts
all TEXT values to NTEXT before performing the function operation, and the
return value is NTEXT.
Syntax
INSLINES(text-expression lines [after])
Arguments
text-expression
A multiline expression into whose values one or more lines are to be inserted.
lines
An expression that represents one or more lines of text that you insert into
text-expression.
after
An INTEGER that represents the line number after which the specified lines are to be
inserted. The position of the first line in text-expression is 1 (one). To insert lines at the
very beginning, specify 0 (zero) for after. When you omit this argument, INSLINES
inserts the new lines after the last line of text-expression.
Examples
INSTAT
Return Value
BOOLEAN
YES if the value is in the current status list or in a valueset and NO if it is not.
Syntax
INSTAT(dimension, value)
Arguments
dimension
The name of the dimension, dimension surrogate, or valueset.
value
The dimension or dimension surrogate value you want to test, either a text literal
(enclosed in single quotes) or an expression that specifies the value. To specify the
value of a conjoint dimension or a concat dimension, enclose the value in angle
brackets. For a conjoint dimension, separate the base dimension values with a comma
and space. For a concat dimension, separate the base dimension and its value with a
colon and a space.
Notes
Examples
Assume, also, that you define a mygeogs valueset and identify a value for that
valueset using the following statements.
DEFINE mygeogs VALUESET geog
LIMIT mygeogs TO 'Belgium'
You cannot issue a REPORT on a valueset. If you attempt to, Oracle OLAP issues an
error message.
REPORT mygeogs
ORA-34104: INSTATTEST!MYGEOGS is not a type of object that contains data values.
However, you can use the INSTAT function to display which values of a dimension
are in a valueset.
REPORT INSTAT (mygeogs, geog)
IF INSTAT(month onemonth)
THEN sales_report
ELSE GOTO error
...
To specify base dimension text values, use a statement such as the following.
SHOW INSTAT(reg.prod.ccdim '<product: Tents>')
YES
INSTR functions
The INSTR functions (INSTR, INSTRB, INSTRC, INSTR2, and INSTR4) searches a
string for a substring using characters and returns the position in the string that is the
first character of a specified occurrence of the substring. The functions vary in how
they determine the position of the substring to return.
■ INSTR calculates lengths using characters as defined by the input character set.
■ INSTRB calculates lengths using bytes.
■ INSTRC calculates lengths using Unicode complete characters.
■ INSTR2 calculates lengths using UCS2 code points.
■ INSTR4 calculates lengths using UCS4 code points.
Return Value
A nonzero INTEGER when the search is successful or 0 (zero) when it is not.
Syntax
{INSTR | INSTRB | INSTRC | INSTR2 | INSTR4} (string , substring [, position [, occurrence]])
Arguments
string
The text expression to search.
substring
The string to search for.
position
A nonzero INTEGER indicating where in string the function begins the search. INSTR
calculates position using characters as defined by the input character set. INSTRB
calculates position using bytes. INSTRC calculates position using Unicode complete
characters. INSTR2 calculates position using UCS2 code points. INSTR4 calculates
position using UCS4 code points.
When position is negative, then INSTR counts and searches backward from the end of
string. The default value of position is 1, which means that the function begins
searching at the beginning of string.
occurrence
An INTEGER indicating which occurrence of string the function should search for. The
value of occurrence must be positive. The default values of occurrence is 1, meaning the
function searches for the first occurrence of substring.
Examples
Example 7–127 Using Character Position to Search Forward to Find the Position of a
Substring
The following example searches the string "Corporate Floor", beginning with the third
character, for the string "or". It returns the position in "Corporate Floor" at which the
second occurrence of "or" begins.
Example 7–128 Using Character Position to Search Backward to Find the Position of a
Substring
In this next example, the function counts backward from the last character to the third
character from the end, which is the first "o" in "Floor". The function then searches
backward for the second occurrence of "or", and finds that this second occurrence
begins with the second character in the search string.
SHOW INSTR('Corporate Floor','or', -3, 2)
2
Example 7–129 Using a Double-Byte Character Set to Find the Position of a Substring
This example assumes a double-byte database character set.
SHOW INSTRB('Corporate Floor','or',5,2)
27
INTPART
The INTPART function calculates the integer part of a decimal number by truncating
its decimal fraction.
Return Value
INTEGER
Syntax
INTPART(expression)
Arguments
expression
The decimal expression whose integer part is to be returned.
Notes
Large Values
When expression has a value larger than is allowed for an INTEGER (a value between
-2,147,483,647 and 2,147,483,647), INTPART returns an NA value.
Examples
IRR
The IRR function computes the internal rate of return associated with a series of cash
flow values. Each value of the result is calculated to be the discount rate for each
period that makes the net present value of the corresponding cash flows equal to zero.
Return Value
DECIMAL (For example, n 8.25 percent internal rate of return produces a result value
of .0825.)
The result returned by the IRR function is dimensioned by all the dimensions of
cashflows except its time dimension. When cashflows is dimensioned only by the time
dimension, IRR returns a single value.
Syntax
IRR(cashflows, [time-dimension])
Arguments
cashflows
A numeric expression dimensioned by time-dimension, that specifies the series of cash
flow values.
Note: All the cash flows used to compute a result value are assumed
to occur at the same relative point within the period with which they
are associated. Cash flows that corresponds to out-of-status dimension
positions are ignored
time-dimension
A name that specifies the time dimension. When cashflows has a dimension of type
DAY, WEEK, MONTH, QUARTER, or YEAR, the time-dimension argument is optional
since IRR automatically uses the DAY, WEEK, MONTH, QUARTER, or YEAR
dimension of cashflows when you do not specify a value for time-dimension.
Notes
Examples
ISDATE
The ISDATE program determines whether a text expression represents a valid date.
ISDATE only tests a text expression to see if it can be converted to a DATE-only value;
it does not actually make the conversion. You must use CONVERT to make the
conversion.
Return Value
BOOLEAN
YES when the text expression represents a valid date; NO when it does not.
Syntax
ISDATE(test-date)
Arguments
test-date
A single-line ID or TEXT expression to be examined to see if it represents a valid date,
as defined by the DATE-only data type. For a description of the valid styles for
entering dates, see "Date-only Input Values" on page 2-6.
Examples
ISEMPTY
The ISEMPTY function identifies if a variable or one or more of its partitions has
values.
Return Value
BOOLEAN
FALSE when the specified variable or partitions have values; TRUE when they are
emtpy.
Syntax
ISEMPTY( variable [(partition ...)])
Arguments
variable
The name of the variable that you want to check for values.
partition
The name of one or more partitions, separated by commas, that you want to check for
values.
ISSESSION
Return value
BOOLEAN
YES when the member is a temporary member; NO when it is not.
Syntax
ISSESSION( [RECURSIVE]dimension)
Arguments
RECURSIVE
Specifies that for a dimension with base dimensions, that Oracle OLAP will test the
values of the base dimensions when making its determination.
dimension
The name of the dimension whose current member value is to be tested by Oracle
OLAP.
ISVALUE
Return Value
BOOLEAN
Syntax
ISVALUE(name, value)
Arguments
name
The name of the dimension or the composite to be checked.
When the composite is unnamed, use the SPARSE keyword to refer to the composite
(for example, SPARSE <market product>).
value
The value you want to test, either a text literal or text expression for an ID or TEXT
dimension, an INTEGER for an INTEGER dimension, or a combination of values
enclosed by angle brackets for composites and conjoint dimensions.
Examples
JOINBYTES
The JOINBYTES function joins two or more text values as a single line.
JOINBYTES ignores any arguments that have a value of NA and removes line breaks
from the text it joins. (To preserve the breaks in a multiline text expression, use the
INSCHARS.) Also, when the length of the joined line exceeds 4,000 (The maximum
length of a joined line), JOINBYTES automatically breaks the line and puts the
remaining bytes on the next line. The line break could occur between the two bytes of
a double-byte character. JOINBYTES would then end one line with the first byte of the
double-byte character and start the next line with the second byte of the character.
Return Value
TEXT
Syntax
JOINBYTES(first-expression, next-expression...)
Arguments
first-expression
An expression to which JOINBYTES joins next-expression. When the first-expression has
a data type other than TEXT or NTEXT, JOINBYTES converts it to TEXT. Use the
CONVERT or TO_CHAR function to convert a NTEXT expression to TEXT.
next-expression…
One or more expressions to join with first-expression. When an expression you want to
concatenate has a data type other than TEXT or NTEXT, JOINBYTES converts it to
TEXT. Use the CONVERT or TO_CHAR function to convert a NTEXT expression to
TEXT.
Examples
JOINCHARS
The JOINCHARS function joins two or more non-NA expressions as a single line text.
JOINCHARS removes line breaks from the text it joins. (Use INSCHARS to preserve
line breaks.)
When the length of the joined line exceeds 4,000 bytes, JOINCHARS automatically
breaks the line and puts the remaining characters on the next line. When the line break
would occur between the two bytes of a double-byte character, JOINCHARS does not
split the double-byte character; instead, it puts both bytes of the double-byte character
on the next line.
Tip: When you are using a multibyte character set, you can use the
JOINBYTES function instead of the JOINCHARS function.
Return Value
TEXT or NTEXT
The data type of the return value depends on the data type of the values specified for
the arguments:
■ When all arguments are TEXT values, the return value is TEXT.
■ When all arguments are NTEXT values, the return value is NTEXT.
■ When the arguments include both TEXT and NTEXT values, the function converts
all TEXT values to NTEXT before performing the function operation, and the
return value is NTEXT.
Syntax
JOINCHARS(first-expression, next-expression...)
Arguments
first-expression
An expression to which JOINCHARS joins next-expression.
When the first-expression has a data type other than TEXT or NTEXT, JOINCHARS
converts it to TEXT.
next-expression...
One or more expressions to join with first-expression. When an expression you want to
concatenate has a data type other than TEXT or NTEXT, JOINCHARS converts it to
TEXT.
Examples
JOINCOLS
The JOINCOLS function joins the corresponding lines of two or more multiline text
values. The function returns a multiline text value composed of the concatenated lines
up to a length of 498 bytes (the maximum length of a single concatenated line).
The number of lines in the return value is always the same as that in the argument
expression that has the most lines. When a given argument expression has fewer lines,
JOINCOLS repeats its last line in each subsequent line of the return value. This
repeating feature is useful when an argument expression is a single-line separator,
such as a space or hyphen. See Example 7–137, "Joining the Columns of Two Text
Expressions" on page 7-223.
Return Value
TEXT or NTEXT
When all arguments are TEXT values, the return value is TEXT. When all arguments
are NTEXT values, the return value is NTEXT. When the arguments include both
TEXT and NTEXT values, the function converts all TEXT values to NTEXT before
performing the function operation, and the return value is NTEXT.
Syntax
JOINCOLS(first-expression, next-expression...)
Arguments
first-expression
An expression whose lines JOINCOLS joins with those of next-expression. When the
expression has a data type other than TEXT or NTEXT, JOINCOLS converts it to TEXT.
JOINCOLS ignores any arguments that have a value of NA
next-expression...
One or more expressions to join with first-expression. When an expression you want to
concatenate has a data type other than TEXT or NTEXT, JOINCOLS converts it to
TEXT. JOINCOLS ignores any arguments that have a value of NA
Examples
JOINLINES
The JOINLINES function joins the values of two or more expressions into a single
multiline textual value. When multiline text values are joined, all the lines of the first
expression appear first, followed by all the lines of the second expression, and so forth.
Normally the arguments for JOINLINES are text values, but they can have other data
types.
Return Value
TEXT or NTEXT
When all arguments are TEXT values, the return value is TEXT. When all arguments
are NTEXT values, the return value is NTEXT. When the arguments include both
TEXT and NTEXT values, the function converts all TEXT values to NTEXT before
performing the function operation, and the return value is NTEXT.
Syntax
JOINLINES(first-expression next-expression...)
Arguments
first-expression
An expression to which JOINLINES adds next-expression. When the expression has a
data type other than TEXT or NTEXT, JOINLINES converts it to TEXT. JOINLINES
ignores any arguments that have a value of NA.
next-expression...
One or more expressions to join with first-expression. When an expression you want to
concatenate has a data type other than TEXT, JOINLINES converts it to TEXT.
JOINLINES ignores any arguments that have a value of NA.
Examples
The statement
newlist = JOINLINES(mktglist 'Regions')
KEY
The KEY function returns the value of the specified base dimension for a value of a
conjoint dimension or a composite.
Return Value
The return value depends on the data type of the specified base dimension.
Syntax
KEY(dimension-exp, base-dimension-exp)
Arguments
dimension-exp
An expression that specifies a value of a conjoint dimension or a composite. When you
specify the conjoint dimension itself, KEY uses the first value in status. When you
specify the composite itself, KEY uses the first value in status for every base dimension
in the composite.
base-dimension-exp
An expression that specifies the name of a base dimension of the previously specified
conjoint dimension or composite for which you want to know the dimension value.
Examples
The program excerpt shows dsales for three months. The base values of the conjoint
dimension value each occupy their own column. For contrast, the second loop uses the
conjoint dimension directly, without the KEY function. The conjoint dimension values
are displayed in one column, with angle brackets.
LIMIT month TO FIRST 3
FOR proddist
ROW KEY(proddist district) KEY( proddist product) ACROSS month: dsales
BLANK 2
FOR proddist
ROW W 25 proddist ACROSS month: dsales
This chapter provides reference topics for the second set (in alphabetical order) of the
OLAP DML functions. There is one topic for each of the OLAP DML functions that
begins with the letters L-Z, beginning with LAG.
Alphabetical and categorical listings of the OLAP DML functions and reference topics
for the remaining OLAP DML functions appear in Chapter 7, "OLAP DML Functions:
A - K".
For other OLAP DML reference topics, see Chapter 5, "OLAP DML Properties",
Chapter 6, "OLAP DML Options", Chapter 9, "OLAP DML Commands: A-G", and
Chapter 10, "OLAP DML Commands: H-Z".
LAG
Return Value
The data type of the variable argument or NA when you try to lag prior to the first
period of a time dimension.
Syntax
LAG(variable n, dimension, [STATUS|NOSTATUS|limit-clause])
Arguments
variable
A variable or expression that is dimensioned by dimension.
n
The offset (that is, the number of dimension values) to lag. LAG uses this value to
determine the number of values that LAG should go back in dimension to retrieve the
value of variable.
Typically, n is a positive INTEGER that indicates the number of time periods (or
dimension values) before the current one. When you specify a negative value for n, it
indicates the number of time periods after the current o ne. In other words, using a
negative value for n turns LAG into a LEAD function.
dimension
The dimension along which the lag occurs. While this can be any dimension, it is
typically a hierarchical time dimension of type TEXT that is limited to a single level
(for example, the month or year level) or a dimension with a type of DAY, WEEK,
MONTH, QUARTER, or YEAR.
When variable has a dimension with a type of DAY, WEEK, MONTH, QUARTER, or
YEAR and you want LAG to use that dimension, you can omit the dimension
argument.
STATUS
Specifies that LAG should use the current status list (that is, only the dimension values
currently in status in their current status order) when computing the lag.
NOSTATUS
(Default) Specifies that LAG should use the default status (that is, a list all the
dimension values in their original order) when computing the lag.
limit-clause
Specifies that LAG should use the default status limited by limit-clause when
computing the lag.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the the limit-type argument such as "TO"). For the syntax of these arguments, see
LIMIT (using values) command, LIMIT using LEVELREL command, LIMIT command
(using parent relation), LIMIT (using related dimension) command, LIMIT
NOCONVERT command, and LIMIT command (using POSLIST).
To specify that LAG should use the current status limited by limit-clause when
computing the lag, specify a LIMIT function for limit-clause.
Notes
Examples
Assume also that those object have the values shown in the following reports.
REPORT timelevelrel
TIME TIMELEVELREL
-------------- ----------
AllYears AllYears
2004 Years
2005 Years
2006 Years
Jan2005 Months
Feb2005 Months
Mar2005 Months
Apr2005 Months
... ...
Oct2006 Months
Nov2006 Months
Dec2006 Months
REPORT product
PRODUCT
--------------
TVs
DVDs
Computers
REPORT district
DISTRICT
--------------
All Districts
Mass
Conn
Boston
Springfield
Hartford
New Haven
Now assume that you issue the following LIMIT statements to limit product, district,
and time.
LIMIT product TO 'TVs'
LIMIT district TO 'Hartford'
LIMIT time TO 'Jan2006' 'Feb2006' 'Mar2006' 'Apr2006' 'May2006' 'Jun2006'
'Jul2006' 'Aug2006' 'Sep2006' 'Oct2006' 'Nov2006' 'Dec2006'
You can issue a REPORT statement with LAG to show the value of sales for months in
both 2006 and for 2005.
REPORT DOWN time HEADING 'Sales 2006' sales HEADING 'Sales 2005' LAG(sales, 12, time, RELATION timelevelrel)
DISTRICT: Hartford
-------PRODUCT-------
---------TVs---------
TIME Sales 2006 Sales 2005
-------------- ---------- ----------
Jan2006 1,542.91 1,627.51
Feb2006 1,786.07 1,100.13
Mar2006 1,794.43 1,667.61
Apr2006 1,942.92 1,346.66
May2006 1,530.08 1,509.51
Jun2006 1,613.60 1,242.47
Jul2006 1,666.35 1,307.17
Aug2006 1,413.79 1,033.93
Sep2006 1,526.98 1,773.96
Oct2006 1,112.85 1,103.78
Nov2006 1,193.41 1,132.39
Dec2006 1,851.19 1,543.62
LAGABSPCT
The LAGABSPCT function returns the percentage difference between the value of a
dimensioned variable or expression at a specified offset of a dimension prior to the
current value of that dimension and the current value of the dimensioned variable or
expression.
Unlike the LAGPCT function, which always uses the sign of the previous period value
in calculating the result, LAGABSPCT uses the absolute value of the previous period
value and therefore provides the direction of the percentage difference.
Return Value
DECIMAL value that corresponds to a percent difference or NA when you try to lag
prior to the first period of a time dimension.
Syntax
LAGABSPCT(variable, n, dimension, [STATUS|NOSTATUS|limit-clause] )
Arguments
time-series
A variable or expression that is dimensioned by dimension.
n
The offset (that is, the number of dimension values) to lag. LAGABSPCT uses this
value to determine the number of values that LAGABSPCT should go back in
dimension to retrieve the value of variable.
Typically, n is a positive INTEGER that indicates the number of time periods (or
dimension values) before the current one. When you specify a negative value for n, it
indicates the number of time periods after the current one. In this case, LAGABSPCT
compares the current value of the time series with a subsequent value.
dimension
The dimension along which the lag occurs. While this can be any dimension, it is
typically a hierarchical time dimension of type TEXT that is limited to a single level
(for example, the month or year level) or a dimension with a type of DAY, WEEK,
MONTH, QUARTER, or YEAR.
When variable has a dimension with a type of DAY, WEEK, MONTH, QUARTER, or
YEAR and you want LAGABSPCT to use that dimension, you can omit the dimension
argument.
STATUS
Specifies that LAGABSPCT should use the current status list (that is, only the
dimension values currently in status in their current status order) when computing the
lag.
NOSTATUS
(Default) Specifies that LAGABSPCT should use the default status (that is, a list all the
dimension values in their original order) when computing the lag.
limit-clause
Specifies that LAGABSPCT should use the default status limited by limit-clause when
computing the lag.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
To specify that LAG should use the current status limited by limit-clause when
computing the lag, specify a LIMIT function for limit-clause.
Notes
When the Previous Value of the Time Series Used by LAGABSPCT is Zero
When the previous value of the time series used by LAGABSPCT is zero, the result
LAGABSPCT returns is determined by the DIVIDEBYZERO option. When
DIVIDEBYZERO is set to NO, an error occurs. When DIVIDEBYZERO is set to YES,
LAGABSPCT returns NA.
Examples
LAGDIF
The LAGDIF function returns the difference between the value of a dimensioned
variable or expression at a specified offset of a dimension prior to the current value of
that dimension and the current value of the dimensioned variable or expression.
Return Value
DECIMAL or NA when you try to lag prior to the first period of a time dimension.
Syntax
LAGDIF(variable, n, dimension, [STATUS|NOSTATUS|limit-clause] )
Arguments
variable
A variable or expression that is dimensioned by dimension.
n
The offset (that is, the number of dimension values) to lag. LAGDIF uses this value to
determine the number of values that LAGDIF should go back in dimension to retrieve
the value of variable. Typically, n is a positive INTEGER that indicates the number of
time periods (or dimension values) before the current one. When you specify a
negative value for n, it indicates the number of time periods after the current one. In
this case, LAGDIF compares the current value of the time series with a subsequent
value.
dimension
The dimension along which the lag occurs. While this can be any dimension, it is
typically a hierarchical time dimension of type TEXT that is limited to a single level
(for example, the month or year level) or a dimension with a type of DAY, WEEK,
MONTH, QUARTER, or YEAR.
When variable has a dimension with a type of DAY, WEEK, MONTH, QUARTER, or
YEAR and you want LAGDIF to use that dimension, you can omit the dimension
argument.
STATUS
Specifies that LAGDIF should use the current status list (that is, only the dimension
values currently in status in their current status order) when computing the lag.
NOSTATUS
(Default) Specifies that LAGDIF should use the default status (that is, a list all the
dimension values in their original order) when computing the lag.
limit-clause
Specifies that LAGDIF should use the default status limited by limit-clause when
computing the lag.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
Examples
For an example of using LAGDIF, see Example 8–2, "Using LAGDIF and
LAGABSPCT" on page 8-6.
LAGPCT
The LAGPCT function returns the percentage difference between the value of a
dimensioned variable or expression at a specified offset of a dimension prior to the
current value of that dimension and the current value of the dimensioned variable or
expression.
Return Value
DECIMAL or NA when you try to lag prior to the first period of a dimension of a time
dimension.
Syntax
LAGPCT(variable, n, [dimension], [STATUS|NOSTATUS|limit-clause] )
Arguments
variable
A variable or expression that is dimensioned by dimension.
n
The offset (that is, the number of dimension values) to lag. LAGPCT uses this value to
determine the number of values that LAGPCT should go back in dimension to retrieve
the value of variable. Typically, n is a positive INTEGER that indicates the number of
time periods (or dimension values) before the current one. When you specify a
negative value for n, it indicates the number of time periods after the current one. In
this case, LAGPCT compares the current value of the time series with a subsequent
value.
dimension
The dimension along which the lag occurs. While this can be any dimension, it is
typically a hierarchical time dimension of type TEXT that is limited to a single level
(for example, the month or year level) or a dimension with a type of DAY, WEEK,
MONTH, QUARTER or YEAR.
When variable has a dimension with a type of DAY, WEEK, MONTH, QUARTER, or
YEAR and you want LAGPCT to use that dimension, you can omit the dimension
argument.
STATUS
Specifies that LAGPCT should use the current status list (that is, only the dimension
values currently in status in their current status order) when computing the lag.
NOSTATUS
(Default) Specifies that LAGPCT should use the default status (that is, a list all the
dimension values in their original order) when computing the lag.
limit-clause
Specifies that LAGPCT should use the default status limited by limit-clause when
computing the lag.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
To specify that LAG should use the current status limited by limit-clause when
computing the lag, specify a LIMIT function for limit-clause.
Notes
When the Previous Value of the Time Series Used by LAGPCT is Zero
When the previous value of the time series used by LAGPCT is zero, the result
LAGPCT returns is determined by the DIVIDEBYZERO option. When
DIVIDEBYZERO is set to NO, an error occurs. When DIVIDEBYZERO is set to YES,
LAGPCT returns NA.
Examples
LARGEST
The LARGEST function returns the largest value of an expression. You can use this
function to compare numeric values or date values.
Return Value
The data type of the expression. It can be INTEGER, LONGINT, DECIMAL, or DATE.
Syntax
LARGEST(expression [CACHE] [dimension...])
Arguments
expression
The expression whose largest value is to be returned.
CACHE
Specifies slightly different internal behavior. Specify this keyword only when the
original performance is extrememly slow.
dimension
The name of a dimension of the result; or, the name of a relation between one of the
dimensions of expression and another dimension that you want as a dimension of the
result.
By default, LARGEST returns a single value. When you indicate one or more
dimensions for the result, LARGEST tests for values along the dimensions that are
specified and returns an array of values. Each dimension must be either a dimension
of expression or related to one of its dimensions.
Notes
between the dimensions. To control the mapping of one DAY, WEEK, MONTH,
QUARTER, or YEAR dimension to another (for example, from weeks to months), you
can define an explicit relation between the two dimensions and specify the name of the
relation as the dimension argument to the LARGEST function.
For each time period in the related dimension, Oracle OLAP finds the largest data
value in any source time period that ends in the target time period. This method is
used regardless of which dimension has the more aggregate periods.
Examples
LAST_DAY
The LAST_DAY function returns the last day of the month in which a particular date
falls.
Return Value
DATETIME
Syntax
LAST_DAY(datetime-expression)
Arguments
datetime-expression
An expression that has the DATETIME data type.
Examples
When today's date is September 8, 2000, then this statement returns the following.
Days left: 22
LEAD
Return Value
The data type of the variable argument or NA when you try to retrieve a value from
beyond the last period defined for the time dimension.
Syntax
LEAD(variable, n, [time-dimension], [[STATUS|NOSTATUS|limit-clause] )
Arguments
variable
A variable or expression that is dimensioned by dimension.
n
The offset (that is, the number of dimension values) to lead. LEAD uses this value to
determine the number of values that LEAD should go ahead in dimension to retrieve
the value of variable. To count the values, LEAD uses the default status, unless you
use the STATUS keyword or the limit-clause argument to specify a different dimension
status.
Normally, n is a positive INTEGER that indicates the number of time periods (or
dimension values) after the current one. When you specify a negative value for n, it
indicates the number of time periods before the current one. In effect, using a negative
value for n turns LEAD into a LAG function.
dimension
The dimension along which the lead occurs. While this can be any dimension, it is
typically a hierarchical time dimension of type TEXT that is limited to a single level
(for example, the month or year level) or a dimension with a type of DAY, WEEK,
MONTH, QUARTER, or YEAR.
When variable has a dimension with a type of DAY, WEEK, MONTH, QUARTER, or
YEAR and you want LEAD to use that dimension, you can omit the dimension
argument.
STATUS
Specifies that LEAD should use the current status list (that is, only the dimension
values currently in status in their current status order) when computing the lead.
NOSTATUS
Specifies that LEAD should use the default status (that is, a list all the dimension
values in their original order) when computing the lead.
limit-clause
Specifies that LEAD should use the default status limited by limit-clause when
computing the lead.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
To specify that LAG should use the current status limited by limit-clause when
computing the lag, specify a LIMIT function for limit-clause.
Examples
Also, assume that there is a dimension named timelevels that contains the names of
the levels of the time dimension (that is, Month and Year) and a relation named
timelevelrel that is dimensioned by time and that has values from timelevels
(that is, the related dimension of timelevelrel is timelevels). A report of
timelevelrel shows these relationships.
TIME TIMELEVELREL
-------------- ------------
1999 Year
2000 Year
Jan1999 Month
Feb1999 Month
... ...
Dec1999 Month
Jan2000 Month
Feb2000 Month
... ...
Dec2000 Month
Suppose you want to compare racquet sales in Dallas for the first two months of 1999
with sales for the corresponding months of 2000. You can use the LEAD function to
produce the values from 2000 in the same report with the 1999 values. The following
statements
LIMIT product TO 'Racquets'
LIMIT district TO 'Dallas'
LIMIT time TO 'JAN1999' 'FEB1999'
REPORT DOWN time sales HEADING 'Following Year' LEAD(sales, 12, time, time
LEVELREL timelevelrel)
LEAST
The LEAST function returns the smallest expression in a list of expressions. All
expressions after the first are implicitly converted to the data type of the first
expression before the comparison.
To retrieve the largest expression in a list of expressions, use GREATEST.
Return Value
The data type of the first expression.
Syntax
LEAST (expr [, expr]...)
Arguments
expr
An expression.
Examples
Example 8–7 Finding the the Text Expression that is First Alphabetically
The following statement returns the string that is first in alphabetic sequence.
SHOW LEAST('Harry','Harriot','Harold')
Harold
LENGTH functions
The LENGTH functions return the length of a text expression including trailing
blanks. LENGTH calculates length using characters as defined by the input character
set. LENGTHB uses bytes instead of characters. LENGTHC uses Unicode complete
characters. LENGTH2 uses UCS2 code points. LENGTH4 uses UCS4 code points.
Return Value
NUMBER or NA if the expression is an empty string or NA
Syntax
{ LENGTH | LENGTHB | LENGTHC | LENGTH2 | LENGTH4}(char)
Arguments
char
A text expression.
LIMIT function
The LIMIT function returns the dimension or dimension surrogate values that result
from a specified LIMIT command or a specified dimension status stack. A dimension
and any surrogate for that dimension share the same status. The LIMIT function does
not change the status of a dimension or a valueset.
Return Value
The return value varies depending on the use of the function and whether or not you
specify the INTEGER keyword:
■ When the LIMIT function is an argument to an OLAP DML statement (including a
user-defined command or function) that expects a valueset, it returns a valueset.
■ When the LIMIT function returns an empty valueset, it returns it as a valueset
with null status.
■ In all other cases, the LIMIT function returns either a TEXT value or an INTEGER
value depending on whether or not you include the INTEGER keyword. When it
returns a TEXT value that represents empty status, it returns it as NA.
Syntax
The syntax of the LIMIT function varies depending on whether you want to retrieve
the values of the dimension or dimension surrogate values that result from a specified
LIMIT command or the values of a a specified dimension status stack.
Arguments
See the LIMIT command for a complete description of all arguments other than the
INTEGER and STATDEPTH keywords.
limit-type
See the LIMIT command for a complete description of this argument.
limit-clause
Specifies the values to use for the limit. There are several types of limit clauses— for
example, a limit clause you can use to specifying the limit using values (including
using a valueset) and a limit clause you can use to specify the limit using a related
dimension. Each of these types of limit clauses has a very complex syntax. Because the
syntax is complex, the syntax for the various types of limit clauses are documented
separately as part of the following topics:
In the syntax of each of these LIMIT command topics, the limit-clause is that portion of
the syntax following the limit-type argument.
INTEGER
When you use the INTEGER keyword, the function returns the position numbers of
the values in the default dimension status rather than the names. When you use
INTEGER with a valueset, the function returns the position numbers of the values in
the default dimension status, not in the valueset.
STATDEPTH
Specifies that Oracle OLAP retrieve the status list values for the status list stack for the
specified dimension.
stack-position
An INTEGER value that specifies the position in the status list stack from which to
retrieve the values. Keep the following in mind when specifying a value:
■ Values from 0 to 1-STATDEPTH(dimension) retrieve stacked values from the
top (current status) to the bottom (oldest status.)
■ Values from 1 to STATDEPTH(dimension) retrieve stacked values from the
bottom of the stack (that is, the oldest status) to the top of the stack (that is, the
current status).
See the STATDEPTH function for more information about status list stacks.
Notes
LIMIT(reg.dist.ccdim TO district)
You can also limit a concat dimension to a set of the values of one of its component
dimensions as in the following statement.
LIMIT(reg.dist.ccdim TO district 'Boston' 'Chicago' 'Seattle')
Suppose you want a list of products whose sales exceed $90,000 for the status shown
in the preceding report. The LIMIT function will evaluate the product sales in each
month and district combination and will produce a list that is dimensioned by the
months and districts in status.
A REPORT limit (product TO sales GT 90000) statement produces the
following output.
---LIMIT (PRODUCT TO SALES GT---
-------------90000)-------------
-------------MONTH--------------
DISTRICT Jan95 Feb95 Mar95
--------- ---------- ---------- ----------
Boston Footwear NA Canoes
Footwear
Examples
After the preceding LIMIT statement, a STATUS month statement produces this
output.
The current status of MONTH is:
MAR97 TO MAY97
LIMITMAPINFO
Return Value
A TEXT expression.
Syntax
LIMITMAPINFO ([aw], limit-map, column-name)
Arguments
aw
The name of the analytic workspace that contains the analytic workspace object.
limit-map
The limit map as a text expression.
column-name
The name of the column of a relational table as it appears in limit-map.
Examples
To retrieve the name of the analytic workspace object from which data for the et_
prod column will be retrieved, you issue the following OLAP DML statement.
show LIMITMAPINFO ('myaw', mylimitmap, 'et_prod')
The following value displays because the et_prod column is mapped to the aw_
product dimension.
aw_product
LNNVL
The LNNVL function provides a concise way to evaluate a condition when one or both
operands of the condition may be null. LNNVL can be used anywhere a scalar
expression can appear, even in contexts where the IS [NOT] NULL, AND, or OR
conditions are not valid but would otherwise be required to account for potential
nulls.
Return Values
TRUE if the condition is false or unknown and FALSE if the condition is true.
Syntax
LNNVL(condition)
Arguments
condition
An expression constructed using any scalar values. Note that you cannot specify an
expression that contains AND, OR, or BETWEEN.
Examples
LOCALTIMESTAMP
The LOCALTIMESTAMP function returns the current date and time in the session
time zone as a value of data type TIMESTAMP.
When you want to retrieve the current date and time in the session time zone as a
TIMESTAMP_TZ value, use the CURRENT_TIMSTAMP function.
Return Values
TIMESTAMP
Syntax
LOCALTIMESTAMP [ (timestamp-precision) ]
ARGUMENTS
timestamp-precision
Specifies the fractional second precision of the time value returned
Examples
LOG function
Note: Do not confuse the LOGfunction with the function of the same
name whichcreates a log file..
Return Value
DECIMAL
Syntax
LOG([base,] expression)
Arguments
base
The base by which to compute the logarithm. When you do not specify a value, the
function computes the natural logarithm of the expression by using e for the base
where e is equal to 2.718281828459.
expression
A numeric expression which is greater than zero. When the value is equal to or less
than zero, LOG returns an NA value.
Examples
LOG10
Return Value
DECIMAL
Syntax
LOG10(expression)
Arguments
expression
The value of expression must be greater than zero. When the value is equal to or less
than 0 (zero), LOG10 returns an NA value.
Examples
LOWCASE
The LOWCASE function converts all alphabetic characters in a text expression into
lowercase.
Return Value
TEXT or NTEXT
When the expression is TEXT, the return value is TEXT. When the expression is
NTEXT, the return value is NTEXT
Syntax
LOWCASE(text-expression)
Arguments
text-expression
The text expression whose characters are to be converted.
Examples
LPAD
The LPAD function returns an expression, left-padded to a specified length with the
specified characters; or, when the expression to be padded is longer than the length
specified after padding, only that portion of the expression that fits into the specified
length.
To right-pad a text expression, use RPAD.
Return Value
TEXT or NTEXT based on the data type of the expression you want to pad (text-exp).
Syntax
LPAD (text-exp , length [, pad-exp])
Arguments
text-exp
A text expression that you want to pad.
length
The total length of the return value as it is displayed on your screen. In most character
sets, this is also the number of characters in the return value. However, in some
multibyte character sets, the display length of a character string can differ from the
number of characters in the string.
When you specify a value for length that is shorter than the length of text-exp, then this
function returns only that portion of the expression that fits into the specified length.
pad-exp
A text expression that specifies the padding characters. The default value of pad-exp is
a single blank.
Examples
LTRIM
The LTRIM function removes characters from the left of a text expression, with all the
leftmost characters that appear in another text expression removed. The function
begins scanning the base text expression from its first character and removes all
characters that appear in the trim expression until reaching a character that is not in
the trim expression and then returns the result.
To trailing characters, use RTRIM. To trim both leading or trailing characters, use
TRIM.
Return Value
TEXT or NTEXT based on the data type of the first argument.
Syntax
LTRIM (text-exp [, trim-exp])
Arguments
text-exp
A text expression that you want trimmed.
trim-exp
A text expression that is the characters to trim. The default value of trim-exp is a single
blank.
Examples
MAKEDATE
The MAKEDATE function returns the DATE value that corresponds to specified
INTEGER values for a year, month, and day.
Return Value
DATE or text
Syntax
MAKEDATE(year month day)
Arguments
year
An INTEGER expression that represents the year of the test date. For any year, you can
specify the year as a four-digit number in the range 1000 to 9999. For years in the range
1950 to 2049 (the default) or some other range (as set through the YRABSTART
option), you have the alternative of specifying a two-digit number that represents the
last two digits of the year (96 represents 1996, for example).
month
Any INTEGER expression, normally in the range 1 to 12. When you specify an
INTEGER less than 1 or greater than 12, MAKEDATE returns a date in a year prior to
or later than the year specified by the INTEGER expression for year.
For example, if the arguments to MAKEDATE are (97 14 21), MAKEDATE returns
the date February 21, 1998 since, in effect, February 1998 is the fourteenth month
of 1997.
day
An INTEGER expression in the range 1 to 31.
Notes
Invalid Dates
When the arguments to MAKEDATE do not represent a valid date between
January 1, 1000, and December 31, 9999, MAKEDATE returns an NA value.
Examples
Example 8–20 Calculating a Date Using YYOR, MMOF, and DDOF Functions
The following statement calculates the date one year from today, and sends the output
to the current outfile. The TODAY function returns today's date. The INTEGER
functions YYOF, MMOF, and DDOF return the INTEGER values that correspond to
the year, month, and day of today's date.
SHOW MAKEDATE(YYOF(TODAY) + 1 MMOF(TODAY) DDOF(TODAY))
When today's date is January 15, 1995, this statement produces the following output.
January 15, 1996
MAX
Return Value
DECIMAL. The results of MAX are dimensioned by the union of the dimensions of the
two expressions
Syntax
MAX(expression1, expression2)
Arguments
expression1
One expression to be compared.
expression2
The other expression to be compared.
Examples
MAXBYTES
The MAXBYTES function counts the number of bytes in the longest line of a multiline
text expression. The result returned by MAXBYTES has the same dimensions as the
specified expression.
Return Value
INTEGER
Syntax
MAXBYTES(text-expression)
Arguments
text-expression
The TEXT expression whose bytes for each line are to be counted.
Examples
Example 8–22 Finding the Length of the Longest Line Using Bytes
You would like to know the length of the longest line in a text variable called mytext.
The following example shows the value of the variable and the result returned by
MAXBYTES.
The statement
SHOW mytext
The statement
SHOW MAXBYTES(mytext)
MAXCHARS
The MAXCHARS function counts the number of characters in the longest line of a
multiline text expression. The result returned by MAXCHARS has the same
dimensions as the specified expression.
Tip: When you are using a multibyte character set, you can use the
MAXBYTES function instead of the MAXCHARS function.
Return Value
INTEGER
Syntax
MAXCHARS(text-expression)
Arguments
text-expression
The text expression whose characters for each line are to be counted. MAXCHARS
accepts either a TEXT or NTEXT argument. It does not perform an automatic
conversion to either data type. It returns the information that is correct for the data
type of the specified argument.
Examples
Example 8–23 Finding the Length of the Longest Line Using Characters
You would like to know the length of the longest line in a text variable called mytext.
The following example shows the value of the variable and the result returned by
MAXCHARS.
The statement
SHOW mytext
The statement
SHOW MAXCHARS(mytext)
MEDIAN
The MEDIAN function calculates the median of the values of an expression. The
median is the middle number in a given sequence of numbers.
Return Value
DECIMAL
Syntax
MEDIAN(expression [CACHE] [dimension...])
Arguments
expression
The expression whose median value is to be calculated.
CACHE
Specifies slightly different internal behavior. Specify this keyword only when the
original performance is extrememly slow.
dimension
The name of a dimension of the result; or, the name of a relation between one of the
dimensions of expression and another dimension that you want as a dimension of the
result.
By default, MEDIAN returns a single value. When you indicate one or more
dimensions for the result, MEDIAN calculates values along the dimensions that are
specified and returns an array of values. Each dimension must be either a dimension
of expression or related to one of its dimensions.
Notes
Examples
MIN
Return Value
DECIMAL. The results of MIN are dimensioned by the union of the dimensions of the
two expressions.
Syntax
MIN(expression1, expression2)
Arguments
expression1
One expression to be compared.
expression2
The other expression to be compared.
Examples
MMOF
The MMOF function returns an INTEGER in the range of 1 to 12, giving the month in
which a specified date falls. The result returned by MMOF has the same dimensions as
the specified DATE expression.
Return Value
INTEGER
Syntax
MMOF(date-expression)
Arguments
date-expression
An expression that has the DATE data type, or a text expression that specifies a date.
The values of the text expression are converted automatically to DATE values, using
the current setting of the DATEORDER option to resolve any ambiguity.
Examples
When today's date is January 15, 1996, this statement produces the following output.
1
MODE
The MODE function returns the mode (the most frequently occurring value) of a
numeric expression. When there are no duplicate values in the data, then MODE
returns NA.
Return Value
DECIMAL
Syntax
MODE(expression [CACHE} [dimensions])
Arguments
expression
The numeric expression whose mode is to be calculated.
CACHE
Specifies slightly different internal behavior. Specify this keyword only when the
original performance is extrememly slow.
dimensions
The dimensions of the result. When you do not specify any dimensions, MODE
calculates the mode over all the dimensions of expression and it returns a single value.
When you specify one or more dimensions (but fewer than all of the dimensions of
expression) in the dimension argument, then MODE calculates the mode for each value
of the dimensions that you specified and returns an array of values. Each dimension
must be a dimension of expression.
Notes
Examples
■ This statement reports the mode that is calculated over the geography
dimension.
REPORT W 22 MODE(sales2, geography)
■ This statement reports the mode that is calculated over the items dimension.
REPORT W 18 MODE(sales2, items)
■ This statement reports the mode that is calculated over all of the dimensions of the
sales2 variable.
REPORT MODE(sales2)
MODULO
The MODULO function, like the SQL MOD function, returns the remainder after a
number is divided by another ; or the number if the divisor is 0 (zero).
Return Values
Numeric.
Oracle determines the argument with the highest numeric precedence, implicitly
converts the remaining arguments to that data type, and returns that data type
Syntax
MOD(dividend, divisor)
Arguments
dividend
A numeric expression (or an expression that Oracle OLAP can implicitly convert to a
numeric expression) that is the number you want to divide.
divisor
A numeric expression (or an expression that Oracle OLAP can implicitly convert to a
numeric expression) that is the divisor.
Examples
MONTHS_BETWEEN
Return Value
NUMBER
Syntax
MONTHS_BETWEEN(datetime_expression1, datetime_expression2)
Arguments
datetime-expression1
One expression that has the DATETIME data type, or a text expression that specifies a
date.
datetime-expression2
A second expression that has the DATETIME data type, or a text expression that
specifies a date.
Examples
MOVINGAVERAGE
Return Value
DECIMAL
Syntax
MOVINGAVERAGE(expression, start, stop, step, -
[dimension [STATUS|limit-clause]])
Arguments
expression
A numeric variable or calculation whose values you want to average; for example,
units or sales-expense.
start
A whole number that specifies the starting point of the range over which you want to
average. The range is specified relative to the current value of dimension. Zero (0)
refers to the current value, and -1 refers to the value preceding the current value. A
comma is required before a negative start number.
Each average is based on data for a specified range of dimension values preceding,
including, or following the one for which the average is being calculated. To count the
values in the range, MOVINGAVERAGE uses the default status, unless you use the
STATUS keyword or the limit-clause argument to specify a different dimension status.
stop
A whole number that specifies the ending point of the range over which you want to
average. A negative stop number must be preceded by a comma.
step
A positive whole number that specifies whether to average over every value in the
range, every other value, every third value, and so on. A value of 1 for step means
average over every value. A value of 2 means average over the first value, the third
value, the fifth value, and so on. For example, when the current month is Jun96 and
the start and stop values are -3 and 3, a step value of 2 means average over Mar96,
May96, Jul96, and Sep96.
dimension
The dimension over which the moving average is calculated. While this can be any
dimension, it is typically a hierarchical time dimension of type TEXT that is limited to
a single level (for example, the month or year level) or a dimension with a type of
DAY, WEEK, MONTH, QUARTER, or YEAR.
When expression has a dimension with a type of DAY, WEEK, MONTH, QUARTER, or
YEAR and you want MOVINGAVERAGE to use that dimension, you can omit the
dimension argument.
STATUS
Specifies that MOVINGAVERAGE should use the current status list (that is, only the
dimension values currently in status in their current status order) when calculating the
moving average.
limit-clause
Specifies that MOVINGAVERAGE should use the default status limited by limit-clause
when calculating the moving average.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
To specify that MOVINGAVERAGE should use the current status limited by
limit-clause when calculating, specify a LIMIT function for limit-clause.
Examples
After you have limited product and sales, you issue the following report statement.
REPORT DOWN time sales -
HEADING 'Running Yearly\nTotal' MOVINGTOTAL(sales, -4, 0, 1, time, -
LEVELREL time.levelrels) -
HEADING 'Minimum\nQuarter' MOVINGMIN(sales, -4, 0, 1, time, -
LEVELREL time.levelrels) -
HEADING 'Maximum\nQuarter' MOVINGMAX(sales, -4, 0, 1, time, -
LEVELREL time.levelrels) -
HEADING 'Average\nQuarter' MOVINGAVERAGE(sales, -4, 0, 1, time, -
LEVELREL time.levelrels)
MOVINGMAX
Return Value
DECIMAL
Syntax
MOVINGMAX(expression, start, stop, step, [dimension [STATUS|limit-clause]])
Arguments
expression
A numeric variable or calculation from whose values you want to find the maximum
values; for example, units or sales-expense.
start
A whole number that specifies the starting point of the range over which you want to
search. The range is specified relative to the current value of dimension. Zero (0) refers
to the current value, and -1 refers to the period preceding the current value. A comma
is required before a negative start number.
Each maximum value is based on data for a specified range of dimension values
preceding, including, or following the one for which the maximum value is being
returned. To count the values in the range, MOVINGMAX uses the default status,
unless you use the STATUS keyword or the limit-clause argument to specify a different
dimension status.
stop
A whole number that specifies the ending point of the range over which you want to
search. A negative stop number must be preceded by a comma.
step
A positive whole number that specifies whether to search every value in the range,
every other value, every third value, and so on. A value of 1 for step means search
every value. A value of 2 means check the first value, the third value, the fifth value,
and so on. For example, when the current month is Jun96 and the start and stop
values are -3 and 3, a step value of 2 means search the months Mar96, May96, Jul96,
and Sep96 and return the maximum value that occurs in one of those four months.
dimension
The dimension over which the moving maximum is calculated. While this can be any
dimension, it is typically a hierarchical time dimension of type TEXT that is limited to
a single level (for example, the month or year level) or a dimension with a type of
DAY, WEEK, MONTH, Quarter, or YEAR.
When expression has a dimension with a type of DAY, WEEK, MONTH, QUARTER, or
YEAR and you want MOVINGMAX to use that dimension, you can omit the
dimension argument.
STATUS
Specifies that MOVINGMAX should use the current status list (that is, only the
dimension values currently in status in their current status order) when calculating the
moving maximum.
limit-clause
Specifies that MOVINGMAX should use the default status limited by limit-clause when
calculating the moving maximum.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT commandafter
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
To specify that MOVINGMAX should use the current status limited by limit-clause ,
specify a LIMIT function for limit-clause.
Examples
For an example of calculating maximum sales, see Example 8–31, "Calculating a
Moving Average" on page 8-46.
MOVINGMIN
Return Value
DECIMAL
Syntax
MOVINGMIN(expression, start, stop, step, [dimension [STATUS|limit-clause]])
Arguments
expression
A numeric variable or calculation from whose values you want to find the minimum
values; for example, UNITS or SALES-EXPENSE.
start
A whole number that specifies the starting point of the range over which you want to
search. The range is specified relative to the current value of dimension. Zero (0) refers
to the current value, and -1 refers to the value preceding the current value. A comma
is required before a negative start number.
Each minimum value is based on data for a specified range of dimension values
preceding, including, or following the one for which the minimum value is being
returned. To count the values in the range, MOVINGMIN uses the default status,
unless you use the STATUS keyword or the limit-clause argument to specify a different
dimension status.
stop
A whole number that specifies the ending point of the range over which you want to
search. A negative stop number must be preceded by a comma.
step
A positive whole number that specifies whether to search every value in the range, or
every other value, or every third value, and so on. A value of 1 for step means search
every value. A value of 2 means check the first value, the third value, the fifth value,
and so on. For example, when the current month is Jun96 and the start and stop
values are -3 and 3, a step value of 2 means search the months Mar96, May96, Jul96
and Sep96 and return the minimum value that occurs in one of those four months.
dimension
The dimension over which the moving minimum is calculated. While this can be any
dimension, it is typically a hierarchical time dimension of type TEXT that is limited to
a single level (for example, the month or year level) or a dimension with a type of
DAY, WEEK, MONTH, Quarter, or YEAR.
When expression has a dimension with a type of DAY, WEEK, MONTH, QUARTER, or
YEAR and you want MOVINGMIN to use that dimension, you can omit the dimension
argument.
STATUS
Specifies that MOVINGMIN should use the current status list (that is, only the
dimension values currently in status in their current status order) when calculating the
moving minimum.
limit-clause
Specifies that MOVINGMIN should use the default status limited by limit-clause when
calculating the moving minimum.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
To specify that MOVINGMIN should use the current status limited by limit-clause,
specify a LIMIT function for limit-clause.
Examples
For an example of calculating minimum sales, see Example 8–31, "Calculating a
Moving Average" on page 8-46.
MOVINGTOTAL
Return Value
DECIMAL
Syntax
MOVINGTOTAL(expression, start, stop, step, [dimension [STATUS|limit-clause]])
Arguments
expression
A numeric variable or calculation whose values you want to total; for example, UNITS
or SALES-EXPENSE.
start
A whole number that specifies the starting point of the range over which you want to
total. The range is specified relative to the current value. Zero (0)refers to the current
value, and -1 refers to the value preceding the current value. A comma is required
before a negative start number.
Each total is based on data for a specified range of dimension values preceding,
including, or following the one for which the total is being calculated. To count the
values in the range, MOVINGTOTAL uses the default status, unless you use the
STATUS keyword or the limit-clause argument to specify a different dimension status.
stop
A whole number that specifies the ending point of the range over which you want to
total. A negative stop number must be preceded by a comma.
step
A positive whole number that specifies whether to total over every value in the range,
every other value, every third value, and so on. A value of 1 for step means total over
every value. A value of 2 means total over the first value, the third value, the fifth
value, and so on. When the current month is Jun96 and the start and stop values are
-3 and 3, a step value of 2 means total over Mar96, May96, Jul96, and Sep96.
dimension
The dimension over which the moving total is calculated. While this can be any
dimension, it is typically a time dimension.
When expression has a dimension with a type of DAY, WEEK, MONTH, QUARTER, or
YEAR and you want MOVINGTOTAL to use that dimension, you can omit the
dimension argument.
STATUS
Specifies that MOVINGTOTAL should use the current status list (that is, only the
dimension values currently in status in their current status order) when calculating the
moving total.
limit-clause
Specifies that MOVINGTOTAL should use the default status limited by limit-clause
when calculating the moving total.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
To specify that MOVINGTOTAL should use the current status limited by limit-clause
when computing the lag, specify a LIMIT function for limit-clause.
Examples
For an example of calculating a moving total sales, see Example 8–31, "Calculating a
Moving Average" on page 8-46.
NA2
Used for debugging and testing variables defined with nulltracking, the NA2 function
returns an NA value that takes the NA2 bit into consideration.
Return Value
An NA value with the NA flag set to TRUE.
Syntax
NA2
Examples
See Example 9–103, "Defining a Variable with Null Tracking" on page 9-219
NAFILL
The NAFILL function returns the values of the source expression with any NA values
replaced with the specified fill expression.
Return Value
The value returned is the same data type as source-expression. When the fill and source
expressions do not have the same data type, Oracle OLAP converts the fill expression
to the data type of the source expression when possible. Otherwise, an error is
produced. When both the source and fill expressions equal NA, then NAFILL returns
NA.
Syntax
NAFILL(source-expression fill-expression)
Arguments
source-expression
The expression being evaluated. For values of source-expression that do not equal NA,
NAFILL returns the corresponding values of source-expression. Source-expression
determines the dimensions and data type of the result.
fill-expression
The expression to be substituted in the return value. Fill-expression must have the same
data type as source-expression. Fill-expression is only evaluated for values of
source-expression that equal NA.
Notes
Examples
NAFLAG
Used for debugging and testing variables defined with nulltracking, the function
identifies whether or not a value is a NA2 value or a non-NA value.
Return Values
INTEGER
0 for a non-NA value, 2 if the NA value is an NA2 value, or 1 for all other NA values
Syntax
NAFLAG (expression)
Arguments
expression
An OLAP DML expression.
Examples
See Example 9–103, "Defining a Variable with Null Tracking" on page 9-219
NEW_TIME
The NEW_TIME function converts a date and time from one time zone to another.
Return Value
DATETIME
Syntax
NEW_TIME(datetime-exp this_zone new_zone)
Arguments
this_zone
A text expression that indicates the time zone from which you want to convert
datetime-exp. It must be a valid time zone, as listed in the following table.
new_zone
A text expression that indicates the time zone into which you want to convert
datetime-exp. It is the time zone of the return value. It must be a valid time zone, as
listed in Table 8–1, "Time Zones".
Examples
When the date and time in Eastern Standard Time are October 20, 2000, at 1:20 A.M.,
then the date in Pacific Standard Time, which is three hours earlier, is
October 19, 2000. Because SYSDATE uses the format specified by NLS_DATE_
FORMAT, which by default only shows the date, the time is not displayed.
19-OCT-00
Then this statement produces the same result, without requiring the use of TO_CHAR.
SHOW NEW_TIME(TO_DATE('11-27-00 22:15:00', 'MM-DD-YY HH24:MI:SS'), -
'HST' 'PST')
NEXT_DAY
The NEXT_DAY function returns the date of the first instance of a particular day of the
week that follows the specified date.
Return Value
DATETIME
Syntax
NEXT_DAY(datetime-expression, weekday)
Arguments
datetime-expression
An expression that has the DATETIME data type.
weekday
A text expression that identifies a day of the week (for example, Monday). Valid
names are controlled by the NLS_DATE_LANGUAGE option.
Examples
NLSSORT
The NLSSORT function returns a string of bytes used to sort a text string. You can use
this function to specify sorting and comparison operations based on a linguistic sort
sequence rather than on the binary value of a string.
Return Value
RAW
Syntax
NLSSORT(char [, ’NLS_SORT = sort[_ai |_ci]' ])
Arguments
char
A text expression.
sort
An NLS language.
_ai
Specifies an accent-insensitive sort.
_ci
Specifies a case-insensitive sort.
Examples
Example 8–36 Determining the Bytes by Which Values Are Sorted Bsed on Linguistic
Sort Sequence
Assume you want to know the bytes by which a single value is sorted in the German
language without regard to case. To do this you can execute the following SHOW
command.
show NLSSORT('Mary Ann' , 'NLS_SORT = German_ai' )
501464820114555500010101010201010100
To see this same data for all of the values in a text dimension named myname are
sorted, you can execute the following statement.
REPORT NLSSORT(MYname , 'NLS_SORT = German_ci' )
NONE
The NONE function returns YES when none of the values of a Boolean expression are
TRUE. It returns NO when any value of the expression is TRUE.
Return Value
BOOLEAN or NA if all the values of the expression are NA
Syntax
NONE(boolean-expression [CACHE] [dimension...])
Arguments
boolean-expression
The Boolean expression to be evaluated.
CACHE
Specifies slightly different internal behavior. Specify this keyword only when the
original performance is extrememly slow.
dimension
The name of a dimension of the result; or, the name of a relation between one of the
dimensions of boolean-expression and another dimension that you want as a dimension
of the result.
By default, NONE returns a single YES or NO value. When you indicate one or more
dimensions for the result, NONE tests for TRUE values along the dimensions that are
specified and returns an array of values. Each dimension must be either a dimension
of boolean-expression or related to one of its dimensions.
Notes
Examples
NORMAL
The NORMAL function returns a random value from a normal distribution with a
specified mean and standard deviation. The result returned by NORMAL is
dimensioned by all the dimensions of the mean and standard deviation expressions.
Return Value
DECIMAL
Syntax
NORMAL(mean standard-deviation)
Arguments
mean
A numeric expression that represents the mean of a normal distribution. When mean is
NA, NORMAL returns NA.
standard-deviation
A numeric expression that represents the standard deviation of a normal distribution.
When standard-deviation is NA, NORMAL returns the mean.
Examples
However, when you execute the same statement again, it might produce the following
result.
0.87
NPV
The NPV function computes the net present value of a series of cash flow values.
Return Value
DECIMAL
The result returned by the NPV function is dimensioned by all the dimensions of
cashflows except its time dimension. When cashflows is dimensioned only by the time
dimension, NPV returns a single value.
Syntax
NPV(cashflows, discount-rate, [time-dimension])
Arguments
cashflows
A numeric expression that is dimensioned by time-dimension and specifies the series of
cash flow values.
Note: All cash flows are assumed to occur at the beginning of the
time period with which they are associated. The cash flows are
discounted back to the beginning of the earliest time period that
appears in the current status of the time dimension. NPV ignores cash
flows that corresponds to out-of-status dimension positions.
discount-rate
A numeric expression that specifies the interest rate for each period to be used to
discount the cash flow values. It can either be a single value or an array of values with
one or more non-time dimensions. You should express the discount rate as a decimal
quantity; for example, 8.25 percent as .0825.
NPV accepts any positive discount rate, and it also accepts a negative discount rate
when the rate is greater than minus one (that is, rate > -1). When you supply a
negative rate, you must precede it with a comma.
time-dimension
A name that specifies the time dimension. When cashflows has a dimension of type
DAY, WEEK, MONTH, QUARTER, or YEAR, NPV will automatically use that
dimension, and you can omit the time-dimension argument.
Notes
NA Discount Rate
When the discount rate used to compute a result value is equal to NA, then that result
value is NA.
result of the NPV function by the following quantity: one plus the discount rate, raised
to an appropriate positive or negative power.
Examples
uses a discount rate of 8 percent to create the following report of the net present value
of the cflow data.
NPV(CFLOW,
PROJECT .08, YEAR)
-------------- ----------
a -21.67
b 281.82
c 56.65
d 8.88
e -5.38
NULLIF
The NULLIF function compares one expression with another and returns NA when the
expressions are equal, or the base expression when they are not.
Return Value
NA when the expressions are equal, or the base expression when they are not.
Syntax
NULLIF (expr1 , expr2)
Arguments
expr1
An expression. The base expression for the comparison
expr2
An expression to compare to expr1.
Examples
NUMBYTES
The NUMBYTES function counts the number of bytes in a text expression. When the
value is a multiline text value, NUMBYTES returns the total number of bytes in all the
lines. The result returned by NUMBYTES has the same dimensions as the specified
expression.
Return Value
INTEGER
Syntax
NUMBYTES(text-expression)
Arguments
text-expression
The TEXT expression whose bytes are to be counted.
Examples
NUMCHARS
The NUMCHARS function counts the number of characters in a text expression. When
the value is a multiline text value, NUMCHARS returns the total number of characters
in all the lines. The result returned by NUMCHARS has the same dimensions as the
specified expression.
Tip: When you are using a multibyte character set, you can use the
NULLIF function instead of the NUMCHARS function.
Return Value
INTEGER
Syntax
NUMCHARS(text-expression)
Arguments
text-expression
The text expression whose characters are to be counted. NUMCHARS accepts either a
TEXT or NTEXT argument. It does not perform an automatic conversion to either data
type. It returns the information that is correct for the data type of the specified
argument.
Examples
NUMLINES
The NUMLINES function counts the number of lines in each value of a text
expression. The result returned by NUMLINES has the same dimensions as the
specified expression.
NUMLINES accepts either a TEXT or NTEXT argument. It does not perform an
automatic conversion to either data type.
Return Value
INTEGER
Syntax
NUMLINES(text-expression)
Arguments
text-expression
The text expression whose lines are to be counted.
Examples
The statement
SHOW NUMLINES(lastnames)
NUMTODSINTERVAL
Syntax
NUMTODSINTERVAL (number, interval_unit)
Arguments
number
Any NUMBER value or an expression that can be implicitly converted to a NUMBER
value.
interval_unit
A text value that specifies the unit of number and must resolve to one of the following
string values: DAY, HOUR, MINUTE, or SECOND.
interval_unit is case insensitive. Leading and trailing values within the parentheses are
ignored. By default, the precision of the return is 9.
NUMTOYMINTERVAL
Syntax
NUMTOYMINTERVAL (number, interval_unit)
Arguments
number
Any NUMBER value or an expression that can be implicitly converted to a NUMBER
value.
interval_unit
A text value that specifies the unit of number and must resolve to one of the following
string values: YEAR or MONTH.
interval_unit is case insensitive. Leading and trailing values within the parentheses are
ignored. By default, the precision of the return is 9.
NVL
Return Value
The specified replacement value when the value of the base expression is NA, or the
base expression when the value of the base expression is not NA. The data type of the
return value is always the same as the data type of the base expression.
Syntax
NVL (exp , replacement-exp)
Arguments
expr
The expression that you want to replace when it has a NA value or an empty string.
replacement-exp
The value with which you want to replace a NA value.
Examples
NVL2
The NVL2 function returns one value when the value of a specified expression is not
NA or an empty string, or another value when the value of the specified expression is
an empty string or NA.
To merely replace a NA value or an empty string with a string, use NVL.
Return Value
The data type of the return value is always the data type of expr2 (that is, the
expression whose value is returned when the value of expr1 is not NA).
Syntax
NVL2 (expr1 , expr2 , expr3)
Arguments
expr1
The expression whose value this function evaluates.
expr2
An expression whose value is returned when the value of expr1 is not an empty string
or NA.
expr3
An expression whose value is returned when the value of expr1 is NA.
Notes
Examples
OBJ
Return Value
The return value depends on the value specified for choice. Also, when choice is
applicable to only a specific type of object, and you specify a different type of object
for object-name, then OBJ returns NA unless otherwise noted.
Syntax
OBJ(choice [object-name])
Arguments
object-name
A TEXT expression that is the name of the object that you want to retrieve information
about.
choice
A keyword or keyword phrase which indicates the type of information you want. See
Table 8–2, " Keywords for the choice argument of the OBJ Function" on page 8-74 for
the syntax, data type of the returned value and description of valid keywords.
Table 8–2 Keywords for the choice argument of the OBJ Function
Keyword for choice Data Type Description of Returned Value
ACQUIRED BOOLEAN Whether the specified object has been acquired for modification in multiwriter
mode.
AGGMAP TEXT The specification of the specified aggmap.
(multiline)
AGGMAPLIST TEXT The names of the aggmap objects in the specified formula.
(multiline)
ALIASLIST TEXT The names of the alias dimensions for the specified dimension.
(multiline)
ALIASOF TEXT The name of the base dimension for the specified alias dimension.
AW TEXT The name of an attached workspace that contains the specified object. When the
specified object is in only one attached workspace, AW returns the name of the
workspace. When the specified object is in more than one attached workspace,
AW still returns only one workspace name. You must use the AWLIST keyword
to get all the relevant workspace names. When the object is not in any attached
workspace, AW returns NA.
AWLIST TEXT The names of the attached workspaces that contain an object with the specified
(multiline) name. When you specify a qualified object name for the object, AWLIST returns
only the relevant workspace name. When no workspace contains the specified
object, AWLIST returns NA.
BTREE BOOLEAN Whether a BTREE index was defined for the specified conjoint dimension or
composite.
CACHEEMPTY BOOLEAN Whether a session cache has been emptied of data for the specified variable. A
cache can be emptied by using a CLEAR statement with the CACHE keyword.
When object-name is not a variable or when it has no session cache, then
CACHEEMPTY returns NA. (For more information on the session cache, see
"What is an Oracle OLAP Session Cache?" on page 6-148.)
Table 8–2 (Cont.) Keywords for the choice argument of the OBJ Function
Keyword for choice Data Type Description of Returned Value
CACHECOUNT LONG The number of non-NA cells in the session cache for the specified variable. When
INTEGER object-name is not a variable or when it does not have a no session cache, then
CACHECOUNT returns NA. (For more information on the session cache, see
"What is an Oracle OLAP Session Cache?" on page 6-148.).)
CHANGED BOOLEAN Whether the specified object has been modified since the last UPDATE.
CLASS TEXT The storage class of the specified object. Possible return values are:
■ TEMPORARY — An object whose values are not saved in the workspace;
applicable to valuesets, variables, relations, and worksheets.
■ An empty string — A permanent object whose values, when modified, are
stored in a new place in the workspace until you update and are then
included in the update; applicable to all object types.
DATA TEXT The data type of the specified object.
■ For dimensions, variables, and formulas, possible return values are
INTEGER, SHORTINTEGER, LONGINTEGER, DECIMAL, NUMBER, SHORT (for
SHORTDECIMAL), BOOLEAN, ID, TEXT, NTEXT, DATE or DATETIME.
■ For a relation, it returns the name of the related dimension.
■ For a concat dimension, conjoint dimension, composite, or partition
template, it returns the names of the base dimensions of an object as a
multiline text value.
■ For a program defined with a data type, it returns the name of the data
type. For a program defined to return a value of a dimension, returns the
name of the dimension.
■ For a valueset, it returns the name of the dimension for which the valueset
was defined.
■ For other types of objects, it returns NA.
DEFINE TEXT The description of the specified object. The value is the same value that
(multiline) DESCRIBE would display for the object minus the words DEFINE and the name
of the object.
DFNCHANGED BOOLEAN Whether the definition of the specified object has changed since the last
UPDATE.
DFNDIMS TEXT The names of the dimensions and composites in the dimension list that is used
(multiline) to define the specified object. Note that:
■ For an unnamed composite, it returns the form used in the object
definition: SPARSE<dim1 dim2 ...>.
■ For a dimension surrogate, it returns the name of the dimension for which
the surrogate was defined.
■ When no dimension list was used when the specified object was defined, it
returns NA.
DIMMAX INTEGER The number of values in the specified dimension. For other object types, it
returns 0 (zero).
Note: When you use the DIMMAX choice with a dimension that has a read
permission that restricts access to the dimension values, the result returned
depends on whether the dimension has previously been loaded. Permissions are
evaluated when an object is loaded. Generally, the first time you refer to an
object in your session, Oracle OLAP loads the object and evaluates its
permissions. However, the OBJ function does not load objects, since it is just
providing information about them. When you use DIMMAX with a dimension
that has not yet been loaded, the result reflects the entire number of values in
the dimension, regardless of whether the dimension has read permissions.
When a dimension with permissions has already been loaded, then the
DIMMAX choice reflects the permitted size. To ensure that the DIMMAX choice
returns the permitted size, you can execute a LOAD statement before using the
OBJ function.
Table 8–2 (Cont.) Keywords for the choice argument of the OBJ Function
Keyword for choice Data Type Description of Returned Value
DIMS TEXT The names of the dimensions of the specified object. Specifically:
(multiline)
■ For dimensions, simple, concat, or conjoint, it returns the name of the
dimension itself. To find out the base dimensions of a concat or conjoint
dimension, use the DATA keyword.
■ For composites, it returns the base dimensions of the composite.
■ For a dimension surrogate, it returns the name of the dimension for which
the surrogate was defined.
■ For dimensioned objects, it returns the names of the dimensions of the
object.
■ When an object has no dimensions, it returns NA.
DIMTYPE TEXT The type of the specified dimension. Specifically:
■ For a concat dimension, it returns CONCAT.
■ For a conjoint dimension, it returns CONJOINT.
■ For a composite, it returns COMPOSITE.
■ For a simple dimension, it returns the data type of the dimension.
■ For a partition template object, it returns PARTITION TEMPLATE.
■ For all other objects, it returns NA.
DISKSIZE INTEGER The total number of pages used to store the specified object.
Note: For a temporary object, OBJ(DISKSIZE) returns a value of 0 (zero),
because the values of a temporary object are stored in temporary storage and
not in the Database file.
FORMULA TEXT The expression in the definition of the specified formula.
HASAGGCOUNT BOOLEAN Whether an Aggcount object is associated with the specified variable. (For more
information on Aggcount variables, see "Aggcount Variables" on page 9-208.)
HASCACHE BOOLEAN Whether a session cache that is local to the session has been established to store
data for the specified variable. (For more information on the session cache, see
"What is an Oracle OLAP Session Cache?" on page 6-148.)
HASH BOOLEAN Whether a HASH index was defined for the specified conjoint dimension or
composite.
HASHSIZE INTEGER The number of pages allocated for the specified hashed dimension's TBLSPACE
(that is, the page space containing the anchors for the hash table's K/V node
lists). Note that this does not include the number of pages used for the actual
Key/Value nodes, which are allocated from the RANSPACE's page space
(KVPAGES).
HASPROPERTY prop-name BOOLEAN Whether the property specified by prop-name exists for the specified object.
(Abbreviated HASPRP)
HIDDEN BOOLEAN Whether the text of the specified program or model has been hidden. (For more
information on hiding programs and models, see the HIDE and UNHIDE
commands.)
INDEXSIZE INTEGER The total size of all inversions associated with the specified relation or conjoint
dimension.
INORDER BOOLEAN Whether the logical order of the values of the underlying dimensions of the
specified object matches the physical order in the analytic workspace.
INORDER returns TRUE when the logical order of the values of the dimension
has not been specified using MAINTAIN with the keywords ADD FIRST, ADD
AFTER, ADD BEFORE, or MOVE.
Table 8–2 (Cont.) Keywords for the choice argument of the OBJ Function
Keyword for choice Data Type Description of Returned Value
ISBY [RECURSIVE] dimname BOOLEAN When you supply object-name, whether the specified object is dimensioned by,
related to, or a surrogate for the specified dimension (dimname). When you
supply only dimname, whether an object is dimensioned by the dimension you
specify in dimname; or when the object is an aggmap, whether the specified
dimension is a dimension of any relations or models in the aggmap.
■ RECURSIVE specifies that Oracle OLAP should search for dimname in the
base dimensions of the specified object, at any level. the. See Example 8–49,
"OBJ With ISBY" on page 8-82.
■ dimname is a text expression that is the name of a dimension. (Oracle OLAP
automatically converts the name to uppercase.) When dimname is a
composite, the value returned by ISBY indicates whether or not an object
was defined with the composite.
Specify a value for object-name when the object is a dimension surrogate,
variable, relation, or valueset name to learn if that object is dimensioned by or
related to or a surrogate for the specified dimension. You can omit object-name
when you are looping through the list of workspace objects to obtain
information about more than one object, or when you are using OBJ to limit the
NAME dimension.
ISCOMPILED BOOLEAN Whether the compilation status of the specified compilable object (such as a
program, model, or formula). The value returned depends on the type of object
and on whether a compilation error was found in that object. For example:
■ For programs, returns YES when the program has been processed by the
compiler since the last time it was modified. A return value of YES does
not necessarily indicate that all lines of the program are compiled. See the
COMPILE command for more information.
■ For formulas, returns YES only when the formula was compiled without
finding a single error and when the formula can be saved. When the
formula contains ampersand substitution, it cannot be saved. When the
formula is empty, the ISCOMPILED choice returns NO.
■ For models, returns YES only when the model was compiled without a
single error found or when the model is empty.
■ For programs, formulas, and models, returns NO when you delete an object
that the program, formula, or model references.
ISCOMPRESSED BOOLEAN Whether the specified object is a compressed composite.
ISLATEST BOOLEAN Whether the specified object is the latest version of the object. This is the
equivalent of OBJ(VERSION)EQ OBJ(LATESTVER).
ISSOLVED BOOLEAN When the specified object is a variable which is dimensioned by a compressed
composite, whether the variable has been aggregated.
KVSIZE INTEGER The number of pages currently allocated to hash and BTREE indexes.
LATESTVER INTEGER The current state of the specified object, referring to the most recently
committed version of the object. The returned value is either equal to or greater
than the value returned by OBJ(VERSION). When the value returned by
LATESTVER is greater than that returned by OBJ(VERSION), then another user
has updated this object since the analytic workspace was attached in read-only
or read-write mode, or, if the analytic workspace was attached in multiwriter
mode, since the last resynchronization.
LD TEXT The LD (long description) of the specified object.
(multiline)
MODEL TEXT The specification of the specified model.
(multiline)
NACACHECOUNT INTEGER The total number of NA cached cells.
NACACHEEMPTY BOOLEAN Whether the NA cache is empty.
NAPAGES INTEGER The number of pages that contain only NA values and are not stored in the
Database.
NOHASH BOOLEAN Whether the specified conjoint dimension uses the NOHASH index algorithm to
load and access data.
Table 8–2 (Cont.) Keywords for the choice argument of the OBJ Function
Keyword for choice Data Type Description of Returned Value
NUMCELLS INTEGER The total number of physical cells within the specified variable. Oracle OLAP
determines this value by finding the Cartesian product of the OBJ(DIMMAX)
values for the dimensions of the variable, taking composites into account.
NUMDELS DECIMAL The number of deleted cells for the specified dimensioned object.
NUMDFNDIMS INTEGER The number of dimensions or composites in the dimension list used to define
the specified object. For this count, each composite counts as one, and the
dimensions within the dimension list of the composite are not counted. An
object defined with a dimension list could be a variable, relation, formula,
valueset, concat or conjoint dimension, dimension surrogate, or composite.
When no dimension list was used when defining the object (as for single-cell
variables, programs, and so on.), it returns 0 (zero).
NUMDIMS INTEGER The number of dimensions of the specified dimensioned object; or the number
of base dimensions of the specified composite. When the specified object is a
dimension is a dimension or dimension surrogate, it returns 1 , and for all other
objects, it returns 0 (zero).
NUMSEGS INTEGER The number of analytic workspace segments associated with the specified object
when that object has more than one dimension. (Note that Oracle OLAP uses
segments internally to keep track of the physical storage of the object's values.
Too many segments may slow the retrieval of information.)
NUMVALS INTEGER The number of values or cells in the specified object. For a compressed
composite or a variable dimensioned by a compressed composite, returns an
INTEGER value that is the number of logical values in the object (that is, the
value that would be returned if the composite was a b-tree composite).
OWNSPACE BOOLEAN When the specified object is a conjoint dimension or a composite defined with a
BTREE index algorithm, whether the object is using private page space to store
BTREE nodes. When the specified object is a variable-width text dimension, a
relation, or a variable-width text variable, whether the data for the object is
stored in one or more private page spaces that are associated with that object.
PARTBY TEXT The names of the partition dimensions of the specified partitioned variable or
(multiline) partition template object. The names are returned as a multiline text value (one
line for each dimension).
PARTDIMS partitions TEXT The names of the dimensions of the partitions of the specified partition template
(multiline) or a partitioned variable. The value is returned as a multiline text value (one line
for each dimension).
partitions is a multiline text value (one line for each partition name) that specifies
which partitions you're asking about. When you specify a partition name that is
not a valid partition in partitions, an error occurs.
PARTITION partitions TEXT For a partitioned variable or a partition template object, a textual description of
(multiline) the partitions of the specified partition template or a partitioned variable. When
called on a partition template, the returned description is similar to the DEFINE
PARTITION TEMPLATE statement. When called on a partitioned variable, the
returned description is similar to the DEFINE VARIABLE statement.
partitions is a multiline text value (one line for each partition name) that specifies
which partitions you're asking about.When you specify a partition name that is
not a valid partition in partitions, an error occurs.
PARTMETH TEXT The method (RANGE or LIST) by which the specified partition template or a
partitioned variable is partitioned.
PARTNAMES TEXT A multiline TEXT value containing the names of all the defined partitions of the
(multiline) specified partition template. When name is the name of a partitioned variable,
returns a multiline TEXT value containing the names of all the partitions of the
variable.
Note: Not all of the partitions defined by a partition template necessarily exist in
each partitioned variable. Calling OBJ(PARTNAMES)on a partitioned variable
returns only those partitions that actually exist within the variable.
PARTRANGE partitions TEXT The values of the LESS THAN clause for each of the partitions for the specified
(multiline) RANGE partition template or RANGE partitioned variable.
partitions is a multiline text value (one line for each partition name) that specifies
which partitions you're asking about. When you specify a partition name that is
not a valid partition in partitions, an error occurs.
Table 8–2 (Cont.) Keywords for the choice argument of the OBJ Function
Keyword for choice Data Type Description of Returned Value
PERIOD TEXT When the specified object is a dimension of type DAY, WEEK, MONTH,
QUARTER, or YEAR, the type of the dimension plus an indication of multiple
periods or phasing, if any.
PHYSMAX INTEGER The maximum physical value for positions within the specified dimension or
composite.
PMTMAINTAIN TEXT The permission condition for the maintain permission associated with the
specified dimension. When there is no maintain permission for the dimension, it
returns NA.
PMTPERMIT TEXT The permission condition for the permit permission associated with the
specified object. When there is no permit permission for the object, it returns NA.
PMTREAD TEXT The permission condition for the read permission associated with the specified
object. When there is no read permission for the object, it returns NA.
PMTWRITE TEXT The permission condition for the write permission associated with the specified
object. When there is no write permission for the object, it returns NA.
PRECISION INTEGER The precision of the specified NUMBER dimension or variable. The precision is
the total number of digits. When the variable was defined without a precision
specification, then OBJ returns NA.
PROGRAM TEXT The text of the specified program.
(multiline)
PROPCHANGED BOOLEAN Whether the properties of the specified object have changed since the last
UPDATE.
PROPERTY prop-name WORKSHEET The value of the specified object’s property as specified by prop-name which is a
text expression that specifies the name of the property. The data type of the
return value is determined at runtime. When the named property does not exist,
it returns NA. (Abbreviated PRP)
PROPERTYLIST TEXT The names of the properties associated with the specified object, one property
(multiline) on a line. The names are in uppercase letters and are stored in the collating
sequence for ASCII characters. For objects without properties, it returns NA.
(Abbreviated PRPLIST)
PROPERTYTYPE prop-name TEXT The data type of object’s property as specified by prop-name which is a text
expression that specifies the name of the property. The type is derived from the
expression used in the PROPERTY statement that created the property. Possible
return values are BOOLEAN, TEXT, ID, DATE, DATETIME, NUMBER, INTEGER,
LONGINTEGER, DECIMAL, and SHORT.When the named property does not exist
or has a value of NA, it returns NA. (Abbreviated PRPTYPE)
PUSHCOUNT INTEGER The number of times PUSH has executed for the specified executed This is the
same as the number of pushed values currently saved for the specified object..
REFERS text-expression TEXT The words found in the specified compilable object (for example, a program)
(multiline) that match the ones you specify in text-expression. REFERS returns NA when it
does not find any of the specified words, when the specified object is not a
compilable object, or when the workspace does not contain any compilable
objects. When you supply both arguments, REFERS searches only the specified
object for the listed words. When you omit object-name, REFERS searches all the
compilable objects in the current workspace.
text-expression is a multiline TEXT expression that is the words for which it
should search. Each line in the text value is considered a separate word to be
searched for. When, for text-expression, you specify a list of words that is the
result of the OBJLIST function, you can produce a cross-reference for compilable
objects in the current workspace.
Tip: The search is not case-sensitive; REFERS treats TEXTVAR and Textvar as
the same word. REFERS ignores all text that is included in a comment or
enclosed in single quotes.
Table 8–2 (Cont.) Keywords for the choice argument of the OBJ Function
Keyword for choice Data Type Description of Returned Value
RELATION relation-query TEXT The default relation (as specified the RELATION command) for the specified
(multiline) object. The values that are returned vary depending on what you specify for
relation-query. The syntax for relation-query is:
DEFINELIST | DIMLIST | ACTUAL rel-dimname | SPECIFIED rel-dimname
where:
■ DEFINELIST specifies that the function return all of the names of the
dimensions and their associated default relations. As shown in the
following example, the names are returned and it associated default
relation are returned one per line, alternating between dimension name
and its associated default relation.
dimname1
relname1
dimname2
relname2
■ DIMLIST specifies that the function return all of the names of the
dimensions for which default relations have been specified. As shown in
the following example, Oracle OLAP returns the values one dimension
name per line.
dimname1
dimname2
■ ACTUAL dimname specifies that the function return the relation that Oracle
OLAP uses as the default relation between object-name and its related
dimension specified by rel-dimname.
■ SPECIFIED dimname specifies that the function return the name of the
relation specified in the RELATION command as the default relation
between object-name and its related dimension specified by rel-dimname.
This is the value as actually entered in the RELATION command, even if
an error occurred entering the data and there is no such relation in the
analytic workspace.
RSSIZE INTEGER The number of random subset pages used by main object.
SCALE INTEGER The scale of a NUMBER dimension or variable. A positive scale indicates the
number of digits to the right of the decimal point. A negative scale indicates the
number of rounded digits to the left of the decimal point. When the variable
was defined without a scale specification, then OBJ returns NA.
SEGWIDTH {dim-name|ALL} TEXT The default or user-specified segment size of a variable that has more than one
(multiline) dimension and that is associated with either a particular dimension or all
dimensions. Each line begins with a segment-size (up to 11 digits) followed by
the name of the associated dimension or composite. The dimension name is not
included in the line when you specify a dimension and its dimensioned object.
In that case only the segment value is returned. When the segment size is
reported as zero, it means the default segment size is in effect, and therefore you
may need to use CHGDFN to set an appropriate size for the variable's
segments.
■ dim-name is a text expression that is the name of a dimension.
■ ALL specifies all dimensions.
SESSION BOOLEAN Whether the specified object is a session object.
SHAREMAP BOOLEAN When the specified object is dimensioned by a compound dimension, whether
the compound dimension is shared with other objects.
SPARSE TEXT The composites used in the definition of the specified object.
(multiline)
SURROGATELIST TEXT The surrogates defined for the specified surrogate or dimension.
(multiline)
Table 8–2 (Cont.) Keywords for the choice argument of the OBJ Function
Keyword for choice Data Type Description of Returned Value
TRIGGER [triggering-event} TEXT TRIGGER without a triggering-event keyword returns all the triggering-event
(multiline) keywords and trigger programs names associated with the specified object; or
NA when the object does not have any trigger programs associated with it.
TRIGGER with a triggering-event keyword returns the names of the trigger
programs associated with the specified object event.
Specify the triggering-event using one of the following keywords:
MAINTAIN
DELETE
PROPERTY
ASSIGN
BEFORE_UPDATE
AFTER_UPDATE
TYPE TEXT The object type of the specified object.
UNIQUE BOOLEAN Whether the specified concat dimension is unique. Returns FALSE for other
dimensions, and NA for other object types (including Partition Templates).
UPDATED BOOLEAN When the analytic workspace is attached in multiwriter mode, whether the
specified object been updated. For other attachment modes, returns NA.
VALCOUNT INTEGER The number of logical uncompressed values in the specified compressed
composite. For all other dimensions the result is identical to DIMMAX.
VALSIZE INTEGER The number of pages used to store the specified object's values. For text
dimensions and variables defined without the WIDTH keyword, OBJ(VALSIZE)
counts only those pages that contain the four-byte pointers to the text, not the
storage for the text itself. For a temporary variable, OBJ(VALSIZE) returns a
value of 0 (zero) because the values of a temporary variable are stored in
temporary storage and not in the analytic workspace.
VERSION INTEGER The current state of the attached version of the specified object. (Note that
changes that are updated and committed will increase this number.)
VNF TEXT When the specified object is a dimension of type DAY, WEEK, MONTH,
QUARTER, or YEAR for which you have defined a VNF (value name format),
the VNF of the dimension. For other types of objects, it returns NA.
WIDTH INTEGER The width, in bytes, of the storage area of each value of the specified object:
■ For dimensioned INTEGER and BOOLEAN variables that you defined
with a width, it returns 1.
■ For dimensioned text variables and text dimensions that you defined with
a width, it returns a value between 1 and 4000, which identifies the
defined width.
■ For all other objects, it returns NA.
object-name
A text expression that contains the name of the object in which you are interested. The
object can be in any attached workspace. When you specify object-name as a text literal,
you must enclose it in single quotes. (Oracle OLAP automatically converts the name to
uppercase.) When you specify the name of a program as the object-name and you omit
the quotes, Oracle OLAP runs the program and uses its return value as the name of the
object to be supplied as object-name.
You can omit object-name when you are using the OBJ function as part of a statement,
such as the LIMIT command, that loops through the NAME dimension. In this case,
the return value is dimensioned by the NAME dimension in the current workspace.
Examples
See also: For examples of using the OBJ function to retrieve default
relation information, see Example 10–96, "Specifying a Default
Relation Using the Relation Command" on page 10-160
You can use ISBY to find out if a dimension is a base dimension of a concat or conjoint
dimension or a composite. For example, assume that you had a conjoint dimension
named proddist whose base dimensions were product and district. In this case,
the following statement returns YES.
SHOW OBJ(ISBY 'district' 'proddist')
You can use ISBY to find out if a dimension is a dimension of a relation or a model
used in an aggmap. For example, assume that you had an aggmap called myaggmap
and you wanted to find out if a dimension named mydimension was used in any
relations or models within myaggmap. In this case, you could issue the following
statement.
SHOW OBJ(ISBY 'mydimension' 'myaggmap')
However, when you use ISBY with the RECURSIVE keyword, each of the following
statements would return YES.
SHOW OBJ(ISBY RECURSIVE 'district' 'proddist.mon')
SHOW OBJ(ISBY RECURSIVE 'district' 'proddist.sales')
■ The statement
SHOW OBJ(TYPE 'sales')
■ The statement
SHOW OBJ(DATA 'sales')
■ The statement
SHOW OBJ(DIMS 'sales')
■ The statement
SHOW OBJ(ISBY 'product' 'sales')
■ The statement
SHOW OBJ(LD 'sales')
Example 8–51 Returning the Name of the Object or the Type of the Object
Suppose textvar is a variable whose value is geog, which is the name of a
dimension. Whether you enclose the word textvar in quotation marks determines
whether the following OBJ function calls return the word VARIABLE (the type of
object textvar is) or DIMENSION (the type of object geog is).
SHOW OBJ(TYPE 'textvar')
VARIABLE
In the following example, OBJ(REFERS) tells you whether var1, var2, or var3
appears in the myprog program. The return value of OBJ(REFERS) is a multiline text
value that contains the references it finds. When only var1 and var3 appear in the
program, then the return value contains those two names, each on a separate line. The
statement
Marketing 37,369.5000
Selling 89,007.3800
R.D 24,307.5000
Opr.Income 21,867.8400
Taxes 15,970.3900
Net.Income 5,897.4500
The following statement shows how to obtain the segment size value for a specific
dimension.
SHOW OBJ(SEGWIDTH 'product' 'sales')
The following statement shows how to obtain a list of segment sizes for every
multidimensional variable or relation associated with the dimension.
When object-name is not specified, you need to use REPORT rather than SHOW to
obtain a value for each object in the NAME dimension.
REPORT OBJ(SEGWIDTH 'product')
The following statement shows how to produce a list of segment sizes for all
dimensions in the current workspace.
REPORT OBJ(SEGWIDTH ALL)
OBJLIST
The OBJLIST function provides a list of the objects that are contained in one or more
workspaces that you specify. The list of workspace objects returned by OBJLIST has
duplicates removed and it is sorted in ascending order. The specified workspaces must
be currently attached when you use the function.
The result, a multiline TEXT value, can be used as an argument to the OBJ function
with the REFERS keyword. This usage helps in producing a cross-reference list for
compilable objects, such as programs and models, in the current workspace.
Note: OBJLIST always returns the names of all the objects in a given
workspace, even when you have limited its NAME dimension.
Return Value
TEXT
Syntax
OBJLIST[(text-expression)]
Arguments
text-expression
A text expression that contains a single name or several names of currently attached
workspaces. Each workspace name must be on a separate line of a multiline TEXT
value. When you do not supply this argument, OBJLIST uses the current workspace
name. When text-expression includes the name of an analytic workspace that is not
attached, OBJLIST does not return a value. Instead, it signals an error.
Examples
OBSCURE
The OBSCURE function provides two mechanisms for encoding a single-line text
expression. Depending on the mechanism you use, OBSCURE can also restore the
encoded value to its original form.
Return Value
TEXT
Note: The return value of the OBSCURE function always has a text
data type. However, unless you specify the TEXT keyword, the actual
value returned by OBSCURE(HASH) and OBSCURE(HIDE) is binary.
When you want to be able to manage these encoded values as text (for
example, when you want to be able to store them in a text file), you
must specify the TEXT keyword. See Example 8–59, "Generating Text
Data" on page 8-91.
Syntax
OBSCURE({HASH|HIDE|UNHIDE} [TEXT] seed-exp input-exp)
Arguments
HASH
Specifies that Oracle OLAP encodes the input text expression according to the seed
expression that you specify. With the HASH keyword:
■ Encoded values cannot be restored to their original form.
■ The same seed expression and input text always produce the same result.
HIDE
Specifies that Oracle OLAP encodes the input text expression according to the seed
expression that you specify. With the HIDE keyword:
■ Encoded values can be unencoded to their original form with UNHIDE.
■ The same seed expression and input text always produce different results.
The HIDE keyword provides a mechanism for storing values in encoded form while
actually comparing their unencoded values.
UNHIDE
When specified with the original seed expression, unencodes values encoded with the
HIDE keyword to their original form. See "Unencoding Text" on page 8-91.
TEXT
The TEXT keyword causes OBSCURE to convert binary data to text, such that the
return value consists only of text data. When you do not specify the TEXT keyword,
the output of OBSCURE is binary data. See "Unencoding Text" on page 8-91, and
"Generating Text Data" on page 8-91.
seed-exp
A single-line case-sensitive text expression that is used as a seed value when encoding
of the input text expression.
input-exp
A single-line case-sensitive text expression to be encoded or unencoded by OBSCURE.
Notes
Unencoding Text
When you have used OBSCURE(HIDE) with the TEXT keyword to encode a text
expression, you must also specify the TEXT keyword with OBSCURE(UNHIDE) to
unencoded expression to its original value.
Examples
unencoded_text = 'max'
encoded_text = OBSCURE(HIDE TEXT 'XXXX' unencoded_text)
SHOW encoded_text
The same statements without the TEXT keyword would produce binary output from
the SHOW statement.
PARTITION
The PARTITION function returns the name of the partition in which a value is stored.
Return Value
Text
Syntax
PARTITION (partition_template_name)
Examples
Assume that these object have the values shown in the following report.
REPORT DOWN PARTITION(partition_sales_by_year) time product sales
PARTITION(PART
ITION_SALES_BY
_YEAR) TIME PRODUCT SALES
-------------- ---------- ---------- ----------
TIME_2003 2003 00001 NA
TIME_2003 Dec2003 00001 NA
TIME_2003 Jan2003 00001 NA
TIME_2003 31Dec2003 00001 14.78
TIME_2003 01Dec2003 00001 15.52
TIME_2003 31Jan2003 00001 13.61
TIME_2003 01Jan2003 00001 10.39
TIME_2003 2003 00002 NA
TIME_2003 Dec2003 00002 NA
TIME_2003 Jan2003 00002 NA
TIME_2003 31Dec2003 00002 16.05
TIME_2003 01Dec2003 00002 12.27
TIME_2003 31Jan2003 00002 10.83
TIME_2003 01Jan2003 00002 11.07
TIME_2002 2002 00001 NA
TIME_2002 Dec2002 00001 NA
TIME_2002 Jan2002 00001 NA
TIME_2002 31Dec2002 00001 18.80
TIME_2002 01Dec2002 00001 13.64
TIME_2002 31Jan2002 00001 12.41
TIME_2002 01Jan2002 00001 16.97
TIME_2002 2002 00002 NA
As shown in the following code, you can use the PARTITION function to retrieve the
names of the partition in which a a value is stored.
SHOW partition_sales_by_year
<2003, 00001>
PARTITION(PARTITION_S
----ALES_BY_YEAR)----
-------PRODUCT-------
TIME 00001 00002
-------------- ---------- ----------
2003 TIME_2003 TIME_2003
2002 TIME_2002 TIME_2002
Dec2003 TIME_2003 TIME_2003
Jan2003 TIME_2003 TIME_2003
Dec2002 TIME_2002 TIME_2002
Jan2002 TIME_2002 TIME_2002
31Dec2003 TIME_2003 TIME_2003
01Dec2003 TIME_2003 TIME_2003
31Jan2003 TIME_2003 TIME_2003
01Jan2003 TIME_2003 TIME_2003
31Dec2002 TIME_2002 TIME_2002
01Dec2002 TIME_2002 TIME_2002
31Jan2002 TIME_2002 TIME_2002
01Jan2002 TIME_2002 TIME_2002
PARTITIONCHECK
Return Value
BOOLEAN.
YES when Oracle OLAP would not issue an error when aggregating a variable
partitioned using the specified partition template using the specified aggmap; or NO
when an error would occur.
Syntax
PARITITONCHECK (aggmap parttition-template)
Arguments
aggmap
A text expression that is the name of an aggmap object.
partition-template
A text expression that is the name of the partition template object that you want to
check for compatibility with aggregation.
PERCENTAGE
The PERCENTAGE function computes the percent of total for each value in a numeric
expression.
Return Value
DECIMAL
Syntax
PERCENTAGE(expression [CACHE] [BASEDON dimension-list])
Arguments
expression
The numeric expression for which percent figures are to be computed.
CACHE
Specifies slightly different internal behavior. Specify this keyword only when the
original performance is extrememly slow.
BASEDON dimension-list
An optional list of one or more of the dimensions of expression on which to base the
percentage for each value. When you do not specify the dimensions, then
PERCENTAGE bases the percentage on the total of all of the values of all of the
dimensions of expression.
Notes
Examples
This statement reports the percentage that each month value represents of the total
month values for each of the product values that are in status. The total of the values
that PERCENTAGE returns for each product value is 1.
REPORT SUBTOTALS W 8 DOWN month PERCENTAGE(units BASEDON month)
DISTRICT: DENVER
-----------PERCENTAGE(UNITS BASEDON MONTH)------------
-----------------------PRODUCT------------------------
MONTH Tents Canoes Racquets Sportswear Footwear
-------- ---------- ---------- ---------- ---------- ----------
Jul96 0.39 0.38 0.35 0.36 0.33
Aug96 0.33 0.29 0.33 0.31 0.32
Sep96 0.28 0.33 0.33 0.33 0.35
-------- ---------- ---------- ---------- ---------- ----------
TOTAL 1.00 1.00 1.00 1.00 1.00
DENVER
This statement reports the percentage that each product value represents of the total
product values for each of the month values that are in status.
REPORT SUBTOTALS W 8 PERCENTAGE(units BASEDON product)
DISTRICT: DENVER
-PERCENTAGE(UNITS BASEDON-
---------PRODUCT)---------
----------MONTH-----------
PRODUCT Jul96 Aug96 Sep96
-------------- -------- -------- --------
Tents 0.08 0.07 0.06
Canoes 0.06 0.05 0.05
Racquets 0.37 0.39 0.38
Sportswear 0.30 0.28 0.29
Footwear 0.20 0.21 0.22
-------------- -------- -------- --------
TOTAL DENVER 1.00 1.00 1.00
This statement reports the percentage based on all of the dimensions of the units
variable. The total of all of the values that PERCENTAGE returns is 1.
REPORT SUBTOTALS W 8 PERCENTAGE(units)
DISTRICT: DENVER
----PERCENTAGE(UNITS)-----
----------MONTH-----------
PRODUCT Jul96 Aug96 Sep96
-------------- -------- -------- --------
Tents 0.03 0.02 0.02
Canoes 0.02 0.02 0.02
Racquets 0.13 0.12 0.12
Sportswear 0.10 0.09 0.09
Footwear 0.07 0.07 0.07
-------------- -------- -------- --------
TOTAL DENVER 0.35 0.32 0.33
The total for all of the values for both the product and month dimensions is 1.00.
QUAL
The QUAL function lets you explicitly specify a qualified data reference (QDR). You
should use QUAL in cases where the syntax of a QDR is ambiguous and could either
be misinterpreted by Oracle OLAP or cause a syntax error.
QDRs provide a mechanism for limiting one or more dimensions of an expression to a
single value. QDRs are useful when you want to temporarily reference a value that is
not in the current status.
Return Value
The value that is returned has the same data type as the expression being qualified.
Syntax
QUAL(expression, dimname1 dimexp1 [, dimnameN dimexpN])
Arguments
expression
The expression being qualified. You should use QUAL to qualify complex expressions
that contain computation, function calls, or ampersand substitution. You can also use
QUAL when the expression is a simple variable name. However, QUAL is not
required for simple expressions, and you can use the following standard QDR syntax.
expression(dimname1 dimexp1 [, dimname2 dimexp2 ...])
dimname
The dimension to be limited. You can specify one or more of the dimensions of the
expression. Each dimension must be paired with a dimexp. You can specify a
dimension surrogate instead of the dimension.
dimexp
An expression that represents the value to which the dimension should be limited. The
expression can be a value of the dimension, a text expression whose result is a value of
the dimension, a numeric expression whose result is the logical position of a value of
the dimension, or a relation of the dimension.
When the dimension being limited is a conjoint dimension, then dimexp must be
enclosed in angle brackets and must include a value for each of its base dimensions.
When the dimension being limited is a concat dimension, then dimname and dimexp
can be one of the combinations listed in Table 8–3, " Valid dimname and dimexp
Combinations for Concat Dimensions".
Table 8–3 Valid dimname and dimexp Combinations for Concat Dimensions
dimname dimexp
The name of the concat dimension A value of the concat dimension
The name of the concat dimension The name of a base dimension
The name of a base dimension of the concat dimension A value of the base dimension
The name of a base dimension of the concat dimension The name of the concat dimension
Examples
Now consider how you might view the same figures for MAX(actual,budget)
without changing the status of line or division.
ALLSTAT
LIMIT month TO 'Jan96' TO 'Jun96'
REPORT HEADING 'For Cogs in Sporting Division' DOWN month -
W 11 HEADING 'MAX(actual,budget)'-
QUAL(MAX(actual,budget), line 'Cogs', division 'Sporting')
For Cogs in
Sporting MAX(actual,
Division budget)
-------------- -----------
Jan96 287,557.87
Feb96 323,981.56
Mar96 326,184.87
Apr96 394,544.27
May96 449,862.25
Jun96 457,347.55
When you attempt to produce the same report with standard QDR syntax, Oracle
OLAP signals an error.
REPORT HEADING 'For Cogs in Sporting Division' DOWN month -
W 11 HEADING 'MAX(actual,budget)'-
MAX(actual,budget) (line cogs, division sporting)
QUAL(RDSALES * 2, MONTH
'Mar96', REG.DIST.CCDIM
PRODUCT '<district: Boston>')
-------------- ------------------------------
TENTS 91,484.42
CANOES 195,244.56
RANDOM
Return Value
DECIMAL
Syntax
RANDOM([lowbound] [highbound])
Arguments
lowbound
A numeric expression that specifies the lower boundary for the random number series.
The default is 0. When lowbound is NA, the RANDOM function produces NA.
highbound
A numeric expression that specifies the upper boundary for the random number
series. The default is 1. When highbound is NA, the RANDOM function produces NA
Examples
RANK
Return Value
DECIMAL
Syntax
RANK(expression method [attributes] [BASEDON dimension-list])
where attributes is one or more of the following:
RESET
NAFIRST
NALAST
LIMITSAVE (limit-expression...)
TIEBREAKERS (target-expression...)
Arguments
expression
The numeric expression for which rankings are to be computed.
method
The method to use in computing the rank of the values in expression. The method
argument can be one of the following keywords. See also "Results of Method Values"
on page 8-103.
RESET
Changes how Oracle OLAP computes RANK within a looping statement (for example,
an assignment statement):
■ When you do not specify RESET, Oracle OLAP ranks the members of each group
only once and, then caches those ranked values. As the looping statement
continues to execute and RANK executes against same set of values, Oracle OLAP
uses those cached values to return values for RANK.
■ When you include RESET, Oracle OLAP recomputes RANK each and every time it
executes within the looping statement. This behavior significantly increases the
time it takes for Oracle OLAP to execute the looping statement that contains
RANK.
Within a looping statement, the only time you use RANK with RESET is when you
know that within any group the rankings of members within that group will change
during the execution of the looping statement.
NAFIRST
Specifies that Oracle OLAP converts all NA values to the largest positive decimal
number or (10**308) before ranking the values.
NALAST
Specifies that Oracle OLAP converts all NA values to the largest negative decimal
number or -(10**308) before ranking the values.
LIMITSAVE
Specifies the status of the dimensions that Oracle OLAP uses when calculating RANK.
By specifying LIMITSAVE within the RANK function, rather than specify CHGDIMS
with LIMITSAVE, you insure that Oracle OLAP evaluates the status only once when
RANK needs to calculate a new result.
limit-expression
The dimension values that Oracle OLAP uses to determine dimension status while
executing RANK. For the limit-expression argument, you can specify any expression
including a valueset, a LIMIT function, or a SORT function.
TIEBREAKERS
Specifies how Oracle OLAP sequences values of equal rank.
tiebreaker-expression
Any expression including a valueset, a LIMIT function, or a SORT function. Oracle
OLAP executes the tiebreaker-expressions in the order in which they are specified. The
status of the dimensions of each tiebreaker-expression is the current status of the
dimensions or the status specified in the LIMITSAVE clause, if any.
BASEDON dimension-list
An optional list of one or more of the dimensions of expression to include in the
ranking. When you do not specify the dimensions, then RANK bases the ranking on
all of the dimensions of expression.
Notes
Table 8–5, " Results of Different Methods of Ranking" on page 8-103 shows the results
of the different methods of ranking that are produced by a statement of the form
REPORT DOWN geography RANK(sales2 MIN BASEDON items)
Note that the value that is returned by the UNIQUE method for Item2 and Item3 can
be either 2 or 3, since the RANK function randomly assigns a unique rank for identical
values in the expression.
Examples
This statement reports the results of using the MIN method to rank the sales2 values
based on the items dimension.
report rank(sales2 min basedon items)
This statement reports the results of using the MIN method to rank the sales2 values
based on the geography dimension.
REPORT RANK(sales2 MIN BASEDON geography)
This statement reports the results of using the MIN method to rank the sales2 values
based on all of its dimensions.
REPORT RANK(sales2, MIN)
RECNO
The RECNO function reports the current record number of a file opened for reading. It
returns NA when Oracle OLAP has reached the end of the file.
Return Value
INTEGER
Syntax
RECNO(fileunit)
Arguments
fileunit
A file unit number assigned to a file opened for reading in a previous call to the
FILEOPEN function.
Notes
Opening Files
Before you can use the RECNO function, you must open the file for reading. When the
file unit number is not associated with an open file or the file has been opened for
writing, RECNO returns an error.
LINENUM Option
See also the LINENUM option, which holds the current line number of output.
Examples
REM
The REM function returns the remainder after one numeric expression is divided by
another.
Return Value
DECIMAL
Syntax
REM(expression1 expression2)
Arguments
expression
REM returns the remainder of expression1 divided by expression2.
Examples
REMAINDER
The REMAINDER function returns the remainder when one number is divided by
another.
Return Values
Numeric. Oracle OLAP determines the argument with the highest numeric
precedence, implicitly converts the remaining arguments to that data type, and returns
that data type.
Syntax
REMAINDER (diviidend, divisor)
Arguments
dividend
A numeric expression (or an expression that Oracle OLAP can implicitly convert to a
numeric expression) that is the number you want to divide.
divisor
A numeric expression (or an expression that Oracle OLAP can implicitly convert to a
numeric expression) that is the divisor.
Examples
REMBYTES
The REMBYTES function removes one or more bytes from a text expression and
returns the value that remains.
Return Value
TEXT
Syntax
REMBYTES(text-expression start [length])
Arguments
text-expression
The TEXT expression from which REMBYTES removes bytes. When the characters to
be removed from text-expression contain embedded line breaks, these breaks are also
removed. Other line breaks are preserved. Removed line breaks are not counted
toward the total number of characters removed.
Tip: When you must use this function on NTEXT values, use the
CONVERT or TO_CHAR function to convert the NTEXT value to
TEXT.
start
An INTEGER that represents the character position at which to begin removing
characters. The position of the first character in text-expression is 1. When the value of
start is greater than the length of text-expression, REMBYTES simply returns
text-expression.
length
An INTEGER that represents the number of characters to be removed. When length is
not specified, only the character at start is removed.
Examples
REMCHARS
The REMCHARS function removes one or more characters from a text expression and
returns the value that remains.
Tip: When you are using a multibyte character set, you can use the
REMBYTES function instead of the REMCHARS function.
Return Value
TEXT or NTEXT
Syntax
REMCHARS(text-expression start [length])
Arguments
text-expression
The expression from which REMCHARS removes characters. When the characters to
remove from text-expression contain embedded line breaks, these breaks are also
removed. Other line breaks are preserved. Removed line breaks are not counted
toward the total number of characters removed.
When you specify a TEXT expression, the return value is TEXT. When you specify an
NTEXT expression, the return value is NTEXT.
start
An INTEGER that represents the character position at which to begin removing
characters. The position of the first character in text-expression is 1. When the value of
start is greater than the length of text-expression, REMCHARS simply returns
text-expression.
length
An INTEGER that represents the number of characters to be removed. When length is
not specified, only the character at start is removed.
Examples
hellojoe
helloherejoe
REMCOLS
The REMCOLS function removes specified columns from every line of a multiline
TEXT value. The function returns a multiline text value that includes only the
remaining columns.
Columns refer to the character positions in each line of a multiline TEXT value. The
first character in each line is in column one, the second is in column two, and so on.
Return Value
TEXT or NTEXT
REMCOLS always returns a TEXT value that has the same number of lines as
text-expression, though some of the lines may be empty.
Syntax
REMCOLS(text-expression start [length])
Arguments
text-expression
The text expression from which the specified columns should be removed. When
text-expression is a multiline TEXT value, the characters in the specified columns are
removed from each one of its lines.
When you specify a TEXT expression, the return value is TEXT. When you specify an
NTEXT expression, the return value is NTEXT.
start
An INTEGER, between 1 and 4,000, representing the column position at which to begin
removing columns. The column position of the first character in each line of
text-expression is 1. When you specify a starting column that is to the right of the last
character in a given line in text expression, the corresponding line in the return value
will be identical to the given line.
length
An INTEGER representing the number of columns to be removed. When you do not
specify length, REMCOLS removes only the starting column. When you specify a
length that exceeds the number of characters that follow the starting position in a
given line in text expression, the corresponding line in the return value will include
only the characters that precede the starting column.
Examples
The statement
SHOW citylist
The statement
SHOW REMCOLS(citylist 2 4)
REMLINES
The REMLINES function removes one or more lines from a multiline TEXT expression
and returns the value that remains.
Return Value
TEXT or NTEXT
Syntax
REMLINES(text-expression start [length])
Arguments
text-expression
A multiline text expression from whose values REMLINES removes one or more lines.
When you specify a TEXT expression, the return value is TEXT. When you specify an
NTEXT expression, the return value is NTEXT.
start
An INTEGER that represents the line number at which to begin removing lines. The
position of the first line in text-expression is 1.
length
An INTEGER that represents the number of lines to be extracted. When you do not
specify length, only the line at start is removed.
Examples
The statement
SHOW REMLINES(mktglist, 2)
REPLBYTES
Tip: When you are using a single-byte character set, you can use the
REPLCHARS function instead of the REPLBYTES function. Also, to
change one or more occurrences of a specified string in a text value to
another string, use the CHANGECHARS function
Return Value
TEXT
Syntax
REPLBYTES(text-expression replacement [start])
Arguments
text-expression
A TEXT expression in which REPLBYTES replaces bytes. When the bytes to replace
from text-expression contain embedded line breaks, these breaks are removed. Other
line breaks are preserved. Removed line breaks are not counted toward the total
number of bytes replaced. Line breaks in the replacement expression are retained in
the output of REPLBYTES, but are likewise not counted.
Tip: When you must use this function on NTEXT values, use the
CONVERT or TO_CHAR function to convert the NTEXT value to
TEXT.
replacement
A text expression that contains one or more bytes that will replace existing bytes in
text-expression.
start
An INTEGER that represents the byte position at which to begin replacing bytes. The
position of the first byte in text-expression is 1. When you omit this argument,
REPLBYTES starts with the first byte. REPLBYTES replaces as many bytes of
text-expression as are required for the bytes specified by replacement. When the value of
start is greater than the length of text-expression, REPLBYTES simply returns
text-expression.
Examples
The statement
SHOW REPLBYTES(var1 var2)
REPLBYTES has replaced the first 6 bytes of var1 (Hellot of HellothereJoe) with
the 6 bytes of var2 (HiJane). It has preserved the line breaks following Hi (from
var2) and there (from var1).
To replace all 13 bytes in var1, you must specify 13 replacement bytes; for example,
you can add 7 spaces after Jane.
var2 = JOINLINES('Hi' 'Jane ')
The statement
SHOW REPLBYTES(var1 var2)
REPLCHARS
Tip: When you are using a multibyte character set, you can use the
REPLBYTES function instead of the REPLCHARS function. Also, you
can use the CHANGECHARS function to change one or more
occurrences of a specified string in a text value to another string.
Return Value
TEXT or NTEXT
This function accepts TEXT values and NTEXT values as arguments. The data type of
the return value depends on the data type of the values specified for the arguments:
■ When all arguments are TEXT values, the return value is TEXT.
■ When all arguments are NTEXT values, the return value is NTEXT.
■ When the arguments include both TEXT and NTEXT values, the function converts
all TEXT values to NTEXT before performing the function operation, and the
return value is NTEXT.
Syntax
REPLCHARS(text-expression characters [start])
Arguments
text-expression
The expression in which characters are to be replaced. When the characters to be
replaced from text-expression contain embedded line breaks, these breaks are removed.
Other line breaks are preserved. Removed line breaks are not counted toward the total
number of characters replaced. Line breaks in the replacement expression are retained
in the output of REPLCHARS, but are likewise not counted.
characters
A text expression that contains one or more characters that will replace existing
characters in text-expression.
start
An INTEGER that represents the character position at which to begin replacing
characters. The position of the first character in text-expression is 1. When you omit this
argument, REPLCHARS starts with the first character. REPLCHARS replaces as many
characters of text-expression as are required for the specified new characters. When the
value of start is greater than the length of text-expression, REPLCHARS simply returns
text-expression.
Examples
The statement
show REPLCHARS(var1 var2)
The statement
SHOW REPLCHARS(var1 var2)
REPLCOLS
The REPLCOLS function replaces some or all of the character columns in one multiline
TEXT value with the columns of another. The function returns a multiline TEXT value
composed of the resulting lines.
Columns refer to the character positions in each line of a multiline TEXT value. The
first character in each line is in column one, the second is in column two, and so on.
Return Value
TEXT or NTEXT
This function accepts TEXT values and NTEXT values as arguments. The data type of
the return value depends on the data type of the values specified for the arguments:
■ When all arguments are TEXT values, the return value is TEXT.
■ When all arguments are NTEXT values, the return value is NTEXT.
■ When the arguments include both TEXT and NTEXT values, the function converts
all TEXT values to NTEXT before performing the function operation, and the
return value is NTEXT.
The number of lines in the return value is always the same as the number of lines in
text-expression. When the columns text expression has fewer lines, REPLCOLS repeats
its last line in each subsequent line of the return value.
Syntax
REPLCOLS(text-expression columns [start])
Arguments
text-expression
The text expression in which you want to replace one or more columns.
columns
A text expression containing one or more lines. This expression provides the columns
to replace some or all of the columns in text-expression.
start
An INTEGER, between 1 and 4,000, representing the column position at which to begin
replacing. The column position of the first character in each line of text-expression is 1.
When you do not specify start, replacement begins with Column 1. When you specify
a starting column that is to the right of the last character in a given line in
text-expression, the corresponding line in the return value will have spaces filling in the
intervening columns. See Example 8–78, "Joining and Aligning Columns" on
page 8-118.
Examples
The statement
SHOW citylist
The statement
SHOW cityreps
The statement
SHOW REPLCOLS(citylist cityreps 11)
REPLLINES
The REPLLINES function replaces one or more lines in a multiline TEXT expression.
Return Value
TEXT or NTEXT
This function accepts TEXT values and NTEXT values as arguments. The data type of
the return value depends on the data type of the values specified for the arguments.
When all arguments are TEXT values, the return value is TEXT. When all arguments
are NTEXT values, the return value is NTEXT. When the arguments include both
TEXT and NTEXT values, the function converts all TEXT values to NTEXT before
performing the function operation, and the return value is NTEXT.
Syntax
REPLLINES(text-expression lines [start])
Arguments
text-expression
A multiline text expression in which you want to replace one or more lines.
lines
A text expression that contains one or more lines that will replace existing lines in
text-expression.
start
An INTEGER that represents the line number at which to begin replacing. The position
of the first line in text-expression is 1. When you omit this argument, REPLLINES starts
with line 1. REPLLINES replaces as many lines of text-expression as are required for the
specified new lines.
Examples
Salespeople
Advertising
Services
RESERVED
The RESERVED function can provide a list of all the words that are reserved because
they are known to the OLAP DML parser, or it can indicate whether or not a word that
you specify is known to the OLAP DML parser. Some other words are also reserved as
discussed in "Other Reserved Words" on page 8-121.
Return Value
Either a multiline text expression or BOOLEAN, depending on whether or not you
specify an argument to the function.
Syntax
RESERVED [(word-expression)]
Arguments
word-expression
A text expression that represents a word that may or may not be reserved in the OLAP
DML. When you specify word-expression, the RESERVED function returns a BOOLEAN
value indicating whether or not the word is reserved in OLAP DML. When you do not
specify an argument, RESERVED returns a TEXT value consisting of all the reserved
words in OLAP DML, with each word on a separate line.
Notes
NA is Reserved
When you specify NA for the argument, the RESERVED function returns NO. When
you specify NA, the RESERVED function returns YES.
Case-Sensitivity
The list of reserved words returned by the RESERVED function contains some words
in all uppercase and some in mixed case. Words all in uppercase are reserved in their
entirety. Words in mixed case can be abbreviated to the uppercase portion. For such
words, any subset of the word containing the uppercase portion is reserved. For
example, one of the words in the list returned by RESERVED is CODEVERsion. The
following are all reserved: codever, codeversi, codeversio, and codeversion.
However, codeve is not reserved.
Examples
ROUND
Depending on the syntax you specify, the ROUND function performs a numeric
operation or a date and time operation. Because the syntax for the ROUND function
differs for each type of operation, there are two topics for the ROUND function:
■ ROUND (datetime)
■ ROUND (number)
ROUND (datetime)
The ROUND (datetime) function returns date rounded to the unit specified by the
format model fmt. The value returned is always of data type DATETIME, even if you
specify a different datetime data type for date..
Return Value
DATETIME
Syntax
ROUND(datetime_exp, [format ])
Arguments
datetime-exp
A datetime expression that identifies a date and time number.
format
A text expression that specifies one of the format models shown in the following table.
A format model indicates how the date and time number should be rounded.
If you omit this argument, then datetime-exp is rounded to the nearest day.
Table 8–6 lists the format models you can use with the ROUND and TRUNC date
functions and the units to which they round and truncate dates. The default model,
'DD', returns the date rounded or truncated to the day with a time of midnight.
Table 8–6 Datetime Format Templates for the ROUND and TRUNC Date Functions
Format Model Rounding or Truncating Unit
CC One greater than the first two digits of a four-digit year
SCC
SYYYY Year (rounds up on July 1)
YYYY
YEAR
SYEAR
YYY
YY
Y
IYYY ISO Year
IY
IY
I
Q Quarter (rounds up on the sixteenth day of the second month of the
quarter)
MONTH Month (rounds up on the sixteenth day)
MON
MM
RM
WW Same day of the week as the first day of the year
Table 8–6 (Cont.) Datetime Format Templates for the ROUND and TRUNC Date
Format Model Rounding or Truncating Unit
IW Same day of the week as the first day of the ISO year
W Same day of the week as the first day of the month
DDD Day
DD
J
DAY Starting day of the week
DY
D
HH Hour
HH12
HH24
MI Minute
The starting day of the week used by the format models DAY, DY, and D is specified
implicitly by the initialization parameter NLS_TERRITORY.
Examples
As the following SHOW statements illustrate, depending on what date format value
you specify, the ROUND function returns different values for the mydatetime
variable.
SHOW ROUND(mydatetime, 'RRRR')
01-JAN-07
SHOW ROUND(mydatetime)
= 'AUG-2006-08-00'
ROUND (number)
When a number is specified as an argument, the ROUND function returns the number
rounded to the nearest multiple of a second number you specify or to the number of
decimal places indicated by the second number.
Return Value
DECIMAL (when the round type is MULTIPLE)
NUMBER (when the round type is DECIMAL)
Syntax
ROUND(number_exp roundvalue) [MULTIPLE|DECIMAL]
Arguments
number_exp
An expression that identifies the number to round.
roundvalue
A value that specifies the basis for rounding.
When the round type is MULTIPLE:
■ number_exp is rounded to the nearest multiple of roundvalue.
■ roundvalue can be an INTEGER or decimal number.
MULTIPLE
(Default) Specifies that rounding is performed by rounding to the nearest multiple of
roundvalue.
DECIMAL
Specifies that rounding is performed by rounding to the number of decimal places
indicated by roundvalue.
Notes
do not generally see the difference in reports because reports usually show only two or
three decimal places.
For example, when you compare two numbers with the EQ or NE operators, you
probably want to ignore any difference caused by the least significant digits. When
expense was stored as 100.00000001, the least significant digit would not be
ignored by the simple form of the comparison.
The statement
SHOW expense EQ 100.00
However, you can use ROUND to force EQ or NE to ignore the least significant digits.
SHOW ROUND(expense, .01) EQ 100.00
Examples
The statement
SHOW ROUND(2/3, .1)
The statement
SHOW ROUND(2/3, .5)
The statement
ROUND(15.193, -1)
ROW function
The ROW function returns a line of data in cells, one after another in a single row. It is
identical to the ROW command, except that it returns a text value, instead of sending
the text to the current outfile.
The ROW function, just like the ROW command, consists of a series of column
descriptions that specify the data to be returned and, optionally, the way in which it is
to be formatted. The ROW function lets you assign the returned value to a text
variable, send it to your current outfile with the SHOW or REPORT command, or
process it further as an argument to one of the character manipulation functions.
Return Value
TEXT
Syntax
ROW([attribs] [ACROSS dimension [limit-clause]:] {exp1|SKIP} -
[[attribs] [ACROSS dimension [limit-clause]:] {expn|SKIP}])
See the ROW command for a complete description of the arguments.
The ROW function without any arguments returns a blank line.
Notes
The notes for the ROW command also apply to the ROW function.
Examples
ROWIDTOCHAR
The ROWIDTONCHAR function converts a value of the ROWID data type to a value of
the TEXT data type.
Return Value
TEXT
The result of this conversion is always in the national character set and is 18 characters
long.
Syntax
ROWIDTONCHAR (rowid)
Arguments
rowid
The value of type ROWID that you want to convert.
Examples
Now you populate myrowid which has a datatype of ROWID using a MAINTAIN
statement. Then you use the ROWIDTOCHAR function to populate mytext which
has a data type of TEXT and ROWIDTONCHAR function to populate myntext which
has a data type of NTEXT. Reports show that all of the variables are populated.
MAINTAIN myrowid ADD CHARTOROWID('AAAFd1AAFAAAABSAA/')
mytext = ROWIDTOCHAR (myrowid)
myntext = ROWIDTONCHAR (myrowid)
MYROWID
------------------------------
AAAFd1AAFAAAABSAA/
MYTEXT
------------------------------
AAAFd1AAFAAAABSAA/
MYNTEXT
------------------------------
AAAFd1AAFAAAABSAA/
ROWIDTONCHAR
The ROWIDTONCHAR function converts a value of the ROWID data type to a value of
the NCHAR data type. The result of this conversion is always in the national character
set and is 18 characters long.
Return Value
NCHAR
The result of this conversion is always in the national character set and is 18 characters
long.
Syntax
ROWIDTONCHAR (rowid)
Arguments
rowid
The value of type ROWID that you want to convert.
Examples
See Example 8–89, "Converting ROWID Data to TEXT or NTEXT Data" on page 8-132.
RPAD
The RPAD function returns an expression, right-padded to a specified length with the
specified characters; or, when the expression to be padded is longer than the length
specified after padding, only that portion of the expression that fits into the specified
length.
Return Value
TEXT or NTEXT based on the data type of the expression you want to pad (text-exp).
Syntax
RPAD (text-exp , length [, pad-exp])
Arguments
text-exp
A text expression that you want to pad.
length
The total length of the return value as it is displayed on your terminal screen. In most
character sets, this is also the number of characters in the return value. However, in
some multibyte character sets, the display length of a character string can differ from
the number of characters in the string.
When you specify a value for length that is shorter than the length of text-exp, then this
function truncates the expression to the specified length.
pad-exp
A text expression that specifies the padding characters. The default value of pad-exp is
a single blank.
Examples
RTRIM
The RTRIM function removes characters from the right of a text expression, with all
the rightmost characters that appear in another text expression removed. The function
begins scanning the base text expression from its last character and removes all
characters that appear in the trim expression until reaching a character that is not in
the trim expression and then returns the result.
Return Value
TEXT or NTEXT based on the data type of the first argument.
Syntax
RTRIM (text-exp [, trim-exp])
Arguments
text-exp
A text expression that you want trimmed.
trim-exp
A text expression that is the characters to trim. The default value of trim-exp is a single
blank.
Examples
RUNTOTAL
The RUNTOTAL function returns the running total of an expression. You can use the
RUNTOTAL function in a ROW command, ROW function, or REPORT command to
generate a running total of the value of an expression.
Return Value
DECIMAL
Syntax
RUNTOTAL(n)
Arguments
n
One of the 32 subtotals (1 to 32) that Oracle OLAP accumulates for the current column
of a report. RUNTOTAL returns the value of this subtotal for the specified column, but
does not reset the value of the subtotal to zero.
The numbers by which the 32 subtotals are referenced (1 to 32) have no intrinsic
significance; all the subtotals are the same until you reference them.
Notes
Resetting Subtotals
When you use a ROW statement to produce a report, you can use a ZEROTOTAL
statement to reset any subtotal of any column to zero. Normally, you should do this at
the beginning of a report program to make sure all totals begin at zero. A REPORT
statement automatically resets all subtotals to zero before producing output.
Examples
SESSIONTIMEZONE
The SESSIONTIMEZONE function returns the time zone of the current session.
Return Values
A time zone offset (a character type in the format '[+|]TZH:TZM') or a time zone
region name, depending on how the user specified the session time zone value in the
most recent ALTER SESSION statement
Syntax
SESSIONTIMEZONE
Examples
SIGN
The SIGN function returns a value that indicates when a specified number is less than,
equal to, or greater than 0 (zero).
Return Value
INTEGER. SIGN returns -1 when n<0, 0 (zero) when n=0, or 1 when n>0.
Syntax
SIGN (n)
Arguments
n
A numeric expression.
Examples
SIN
The SIN function calculates the sine of an angle expression. The result returned by SIN
is a decimal value with the same dimensions as the specified expression.
Return Value
DECIMAL
Syntax
SIN(angle-expression)
Arguments
angle-expression
A numeric expression that contains an angle value, which is specified in radians.
Examples
SINH
Return Value
DECIMAL
Syntax
SINH(expression)
Arguments
expression
A numeric expression that contains an angle value, which is specified in radians.
Examples
SMALLEST
The SMALLEST function returns the smallest value of an expression. You can use this
function to compare numeric values or date values.
Return Value
The data type of the expression. It can be INTEGER, LONGINT, DECIMAL, or DATE.
Syntax
SMALLEST(expression [CACHE] [dimension...])
Arguments
expression
The expression whose smallest value is to be returned.
CACHE
Specifies slightly different internal behavior. Specify this keyword only when the
original performance is extrememly slow.
dimension
The name of a dimension of the result; or, the name of a relation between one of the
dimensions of expression and another dimension that you want as a dimension of the
result.
By default, SMALLEST returns a single value. When you indicate one or more
dimensions for the result, SMALLEST tests for values along the dimensions that are
specified and returns an array of values. Each dimension must be either a dimension
of expression or related to one of its dimensions.
Notes
Examples
Example 8–99 Finding the Month with the Least Amount of Sportswear Sales
This example uses the SMALLEST function to find the smallest monthly sportswear
sales for three districts during the first half of 1996. To see the smallest sales figure for
each district, specify district as the dimension of the results.
LIMIT product TO 'Sportswear'
LIMIT district TO FIRST 3
LIMIT month TO 'Jan96' TO 'Jun96'
REPORT HEADING 'Smallest Sales' SMALLEST(sales district)
SMOOTH
Return Value
DECIMAL
Syntax
SMOOTH(expression {SINGLE alpha|DOUBLE alpha beta m} [BASEDON dimension-list])
Arguments
expression
The numeric expression whose values are to be smoothed.
SINGLE
DOUBLE
The method to use in the exponential smoothing of the values in expression. The
SINGLE method specifies single exponential smoothing and requires an alpha
argument. The DOUBLE method specifies double exponential smoothing (also known
as Holt's linear exponential smoothing) and requires an alpha argument, a beta
argument, and an m argument.
alpha
A number in the range from 0 to 1 that smooths the difference between the observed
data forecast and the last forecast. The higher the value, the more weight the most
recent forecast has, so smoothing decreases as the smoothing factor increases. A
smoothing factor of 0 completely smooths the forecasts and always returns the first
forecast, which is the first data observation. A smoothing factor of 1 produces no
smoothing at all and returns the previous data observation. (See "Results of alpha
Values" on page 8-145.)
beta
A number in the range from 0 to 1 that smooths the difference between the previous
forecast and the current forecast. As with the alpha argument, smoothing decreases as
the smoothing factor increases.
m
A positive INTEGER between 1 and the total number of periods of data in the data
series. The m argument specifies the number of periods on which to base the forecasts.
BASEDON dimension-list
An optional list of one or more of the dimensions of expression to include in the
exponential smoothing. When you do not specify the dimensions, then SMOOTH
bases the smoothing on all of the dimensions of expression.
Notes
The following table shows the data values of the sales variable and also shows the
results of the SMOOTH function in the preceding statement when the alpha argument
variable has the different values shown in the table.
Sales of
tents in
MONTH Boston alpha = 0 alpha = .1 alpha = .5 alpha = .9
Jan96 50,808.96 NA NA NA NA
Feb96 34,641.59 50,808.96 50,808.96 50,808.96 50,808.96
Mar96 45,742.21 50,808.96 49,192.22 42,725.28 36,258.33
Apr96 61,436.19 50,808.96 48,847.22 44,233.74 44,793.82
May96 86,699.67 50,808.96 50,106.12 52,834.97 59,771.95
Jun96 95,120.83 50,808.96 53,765.47 69,767.32 84,006.90
Jul96 93,972.49 50,808.96 57,901.01 82,444.07 94,009.44
Aug96 94,738.05 50,808.96 61,508.16 88,208.28 93,976.18
Sep96 75,407.66 50,808.96 64,831.15 91,473.17 94,661.86
Oct96 70,622.91 50,808.96 65,888.80 83,440.41 77,333.08
Nov96 46,124.99 50,808.96 66,362.21 77,031.66 71,293.93
Dec96 36,938.27 50,808.96 64,338.49 61,578.33 48,641.88
Examples
This statement reports the results of using the SMOOTH function on the sales
variable with the SINGLE method, a data smoothing factor of .5, and based on the
month dimension.
REPORT W 6 DOWN month SMOOTH(sales, SINGLE, .5, BASEDON month)
SORT function
The SORT function returns the dimension or dimension surrogate values that result
from a specified SORT command.
Return value
The return value varies depending on the use of the function:
■ When the SORT function is an argument to an OLAP DML statement (including a
user-defined command or function) that expects a valueset, it returns a valueset.
When the SORT function returns an empty valueset, it returns it as a valueset with
null status.
■ When you include the INTEGER keyword, the SORT function returns the position
numbers of the values as INTEGERS.
■ In all other cases, the SORT function returns either a TEXT value. When it returns
a TEXT value that represents empty status, it returns the value as NA.
Syntax
SORT([INTEGER]dimension [byhierarchy] [bycriterion...])
where:
■ byhierarchy is an optional phrase that uses a parent relation to arrange the order of
values in the current status list of a hierarchical dimension or its dimension
surrogate, or to assign values to a valueset, based on family relationships within
the hierarchy. You can include only one byhierarchy phrase in a SORT statement. It
must be the first phrase in a SORT statement.
HIERARCHY parent-relation [INVERT] [DEPTH n] [SORTORPHANS]
■ bycriterion uses an explicit criterion to arrange the order of values in the current
status list of a dimension or its dimension surrogate, or to assign values to a
valueset. You can include as many bycriterion phrases as you want in a SORT
statement.
{A|D} [NAFIRST] criterion
Arguments
See the SORT command for a complete description of all arguments except INTEGER.
INTEGER
When you use the INTEGER keyword, the function returns the position numbers of
the values in the default dimension status rather than the names. When you use
INTEGER with a valueset, the function returns the position numbers of the values in
the default dimension status, not in the valueset.
SORTLINES
Return Value
TEXT or NTEXT
Syntax
SORTLINES(text-expression [A|D])
Arguments
text-expression
A multiline text expression whose lines SORTLINES sorts. When you specify a TEXT
expression, the return value is TEXT. When you specify an NTEXT expression, the
return value is NTEXT.
A
D
Specifies whether the sorting order should be ascending, or alphabetical (A), or
descending, or reverse alphabetical (D). The default is A (ascending). The sort order is
controlled by the NLS_SORT option.
Examples
The statement
SHOW SORTLINES(mktregions)
SQLFETCH
The SQLFETCH function retrieves one or more rows of a column in a relational text.
Return value
TEXT
Syntax
SQLFETCH (cursorname [COLUMN column-number} {STOPAFTER number-of-rows])
Arguments
cursorname
A TEXT expression that is the name of the SQL cursor. The cursor must be opened and
closed by the caller.
column-number
An INTEGER value that is the number of the column. (Default is 1.)
number-of-rows
The number of rows to read. (Default is all remaining rows).
SQRT
Return Value
DECIMAL
Syntax
SQRT(expression)
Arguments
expression
The numeric expression whose square root is to be computed.
Notes
Negative Expressions
When expression is negative and ROOTOFNEGATIVE is set to NO, an error occurs.
When expression is negative and ROOTOFNEGATIVE is set to YES, SQRT returns the
value NA.
Examples
STARTOF
The STARTOF function returns the starting date of a time period in a dimension of
type DAY, WEEK, MONTH, QUARTER, or YEAR.
Important: You can only use this function with dimensions of type
DAY, WEEK, MONTH, QUARTER, or YEAR.You cannot use this
function for time dimensions that are implemented as hierarchical
dimensions of type TEXT.
Return Value
DATE or text
Syntax
STARTOF(dwmqy-dimension)
Arguments
dwmqy-dimension
A dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR. When you have
explicitly defined your own relation between dimensions of this type, you can use the
name of this time relation here.
Notes
Examples
STATALL
The STATALL function indicates whether default status is currently in effect for a
given dimension. That is, STATALL returns YES when STATLIST would return ALL.
Otherwise, STATALL returns NO.
Return Value
BOOLEAN
Syntax
STATALL(dimension)
Arguments
dimension
A text expression whose value is the name of a dimension or dimension surrogate.
Notes
Examples
STATDEPTH
The STATDEPTH function returns the number of status lists that Oracle OLAP has
saved for a specified dimension. The current status list of a dimension is at the top of
the stack which means that it has a depth of 1 (one.
Return Value
INTEGER
Syntax
STATDEPTH (dimension)
Arguments
dimension
The name of the dimension for which you want to retrieve information.
Notes
STATEQUAL
Return Value
BOOLEAN
Syntax
STATEQUAL (statlist1, statlist2 [INORDER])
Arguments
statlist1
The status list of a dimension as specified using the name of the dimension, a valueset
dimensioned by the dimension; or a LIMIT or SORT function for the dimension.
statlist2
The status list of the same dimension as that specfied by statlist1. You can specify
statlist2 using the name of the dimension, a valueset dimensioned by the dimension;
or a LIMIT or SORT function for the dimension.
INORDER
Specifies that the values must be in the same order.
STATFIRST
The STATFIRST function returns the first value in the current status list of a
dimension or a dimension surrogate, or in a valueset.
Return Value
The data type returned by STATFIRST is either the data type of the dimension or
dimension surrogate value or an INTEGER that indicates its position in the default
status list of the dimension.The dimension value returned by STATFIRST is converted
to a number or a text value, as appropriate to the context. See Example 8–105,
"Assigning value of STATFIRST to Variables of Different Types" on page 8-156.
Syntax
STATFIRST(dimension)
Arguments
dimension
A text expression whose value is the name of a dimension, a dimension surrogate, or a
valueset.
Examples
STATFIRST is used here, rather than a particular month value, so that the limit can
work on any status list.
STATLAST
The STATLAST function returns the last value in the current status list of a dimension
or a dimension surrogate, or in a valueset.
Return Value
The data type returned by STATLAST is either the data type of the dimension or
dimension surrogate value or an INTEGER that indicates its position in the default
status list of the dimension. See "Automatic Data Conversion of Returned Dimension
Values" on page 8-157.
Syntax
STATLAST(dimension)
Arguments
dimension
A text expression whose value is the name of a dimension, a dimension surrogate, or a
valueset.
Notes
Examples
STATLAST is used here, rather than a particular month value, so that the limit can
work on any status list.
STATLEN
The STATLEN function returns the number of values in the current status list of a
dimension or a dimension surrogate, or in a valueset.
Return Value
INTEGER
Syntax
STATLEN(dimension)
Arguments
dimension
A text expression whose value is the name of a dimension, a dimension surrogate, or a
valueset.
Examples
STATLIST
The STATLIST function returns a list of all values in the current status list of a
dimension or dimension surrogate, or in a valueset. You can format the list to a
specified width. The STATLIST function is employed by the STATUS command,
which summarizes the status of a dimension. Use STATLIST rather than STATUS
when you want to control the width or placement of the display.
Return Value
STATLIST returns a list of TEXT values that contains either the dimension or
dimension surrogate values themselves (for example, Jan95) or numbers (for
example, 6) that represent the positions of the values in the default status list.
The returned values are in the form value TO value, for example, Jan96 TO Jun96.
When default status is in effect, it displays ALL. When the current status list or the
valueset is empty, it displays NULL.
Syntax
STATLIST(dimension [keyword] [width])
Arguments
dimension
A text expression whose value is the name of a dimension, a dimension surrogate, or a
valueset.
keyword
A keyword from Table 8–7, " Keywords for STATLIST". The keywords allow you to
specify the form in which you want the values in the current status list to appear.
width
An optional INTEGER expression that specifies the width of the list in characters.
When no width is specified, STATLIST uses the current value of the LSIZE option.
LSIZE has a default value of 80.
Examples
W 40 STATLIST(month, 40)
STATMAX
The STATMAX function returns the latest value in the current status list of a
dimension or a dimension surrogate, or in a valueset.
Return Value
The data type returned by STATMAX is either the data type of the dimension or
dimension surrogate value or an INTEGER that indicates its position in the default
status list of the dimension or surrogate. See "Automatic Conversion of Values
Returned by STATMAX" on page 8-161.
Syntax
STATMAX(dimension)
Arguments
dimension
A text expression whose value is the name of a dimension, dimension surrogate, or
valueset.
Notes
Examples
When you used STATLAST instead of STATMAX, you could have produced a
different value, because the LIMIT command arranged the month values by increasing
sales rather than chronologically.
STATMIN
The STATMIN function returns the earliest value in the current status list of a
dimension or a dimension surrogate, or in a valueset.
Return Value
Either a dimension or surrogate value or an INTEGER that indicates the position of the
value in the default status list of the dimension or surrogate. The return value varies
depending on the dimension argument and the object receiving the return value. See
"Automatic Data Type Conversion of Values Returned by STATMIN" on page 8-163.
Syntax
STATMIN(dimension)
Arguments
dimension
A text expression whose value is the name of a dimension, dimension surrogate, or
valueset.
Notes
Examples
Notice that the month values in this report are arranged by decreasing sales rather
than chronologically, and this is now the order in which they occur in the status list:
■ STATMIN gives the chronologically first value in the status (though it is
positionally last) as illustrated in the following statement and output.
SHOW STATMIN(month)
May95
■ STATFIRST gives the value that is positionally first in the status (though it is
chronologically eighth) as illustrated in the following statement and output.
SHOW STATFIRST(month)
Jul96
STATRANK
Return Value
INTEGER
Syntax
STATRANK(dimension [value])
Arguments
dimension
A text expression whose value is the name of a dimension, dimension surrogate, or
valueset.
value
The value you want to check, which is an appropriate data type for dimension. For
example, value can be a text expression for an ID or TEXT dimension, an INTEGER for
an INTEGER dimension, a date for a time dimension, or a combination of values
enclosed by angle brackets for conjoint or concat dimensions. The value of a text
expression must have the same capitalization as the actual dimension value. When
you use a text expression, it must be a single-line value.
When you specify the value of a conjoint dimension, be sure to enclose the value in
angle brackets, and separate the base dimension values with a comma and space.
When you specify the value of a concat dimension, be sure to enclose the value in
angle brackets, and separate the base dimension name from the value with a colon and
space.
When you do not specify value, STATRANK returns the position of the current value.
When you specify the name of a valid dimension value that is not in the current status
list or in the valueset, STATRANK returns NA.
Examples
2. Jun96
3. Jul95
4. Aug96
5. Jun95
After executing the sales.rpt program, you can use a SHOW statement with the
STATRANK function to learn the position of a particular month within the top five
months by total sales.
The following statement
SHOW STATRANK(month Jun96)
To specify base positions, use a statement such as the following. Because the position
of East in the region dimension is 1 and the position of Tents in the product
dimension is 1, the following statement returns the position of the corresponding
reg.prod value.
SHOW STATRANK(reg.prod '<1, 1>')
<Product: Racquets>
To specify a base dimension position, use a statement such as the following. Because
the position of racquets in the product dimension is 3, the statement returns the
position in reg.prod.ccdim of the <product: Racquets> value.
SHOW STATRANK(reg.prod.ccdim '<product: 3>')
To specify base dimension text values, use a statement such as the following.
SHOW STATRANK(reg.prod.ccdim '<product: Tents>')
STATVAL
The STATVAL function returns the dimension value that corresponds to a specified
position in the current status list of a dimension or a dimension surrogate, or in a
valueset.
Return Value
The data type returned by STATVAL is either the data type of the dimension or
dimension surrogate value or an INTEGER that indicates its position in the default
status list of the dimension. The dimension value that STATVAL returns is converted
to a number or a text value, as appropriate to the context. To ensure that STATVAL
returns an INTEGER value, specify the INTEGER keyword. See Example 8–118,
"Ensuring that STATVAL Returns an INTEGER" on page 8-169.
Syntax
STATVAL(dimension position [INTEGER])
Arguments
dimension
A text expression whose value is the name of a dimension, a dimension surrogate, or a
valueset.
position
An INTEGER expression that specifies the position in the current status list of a
dimension or a valueset. When you specify a position that has no values, STATVAL
returns NA.
INTEGER
Specifies that STATVAL must return an INTEGER that represents the position of the
dimension value in the default status list.
Notes
Examples
--------------
Jul96
Jun96
Jul95
Aug96
Jun95
Sep96
May96
Aug95
Sep95
MAY95
Notice that the qualified data reference in the following statement means "sales for the
fifth month in the default status of month."
sales(month 5)
While the qualified data reference in the following statement means "sales for the fifth
month in the current status of month."
sales(month STATVAL(month 5))
The following statements show the different values that are returned for a qualified
data reference of month and for STATVAL with month as an argument.
SHOW month(month 5)
SHOW STATVAL(month 5)
Aug95
STDDEV
The STDDEV function calculates the standard deviation of the values of an expression.
When STDDEV is affected by the NASKIP option. When NASKIP is set to YES (the
default), STDDEV ignores NA values and returns the standard deviation of the values
that are not NA. When NASKIP is set to NO, STDDEV returns NA when any value in the
calculation is NA. When all data values for a calculation are NA, STDDEV returns NA for
either setting of NASKIP.
Return Value
DECIMAL
Syntax
STDDEV(expression [dimensions])
Arguments
expression
The numeric expression whose standard deviation is to be calculated.
dimensions
The dimensions of the result. By default, STDDEV returns a single value. When you
indicate one or more dimensions for the results, STDDEV calculates a standard
deviation along the specified dimension(s) and returns an array of values. Each
dimension must be either a dimension of expression or related to one of its dimensions.
When it is a related dimension, you can specify the name of the relation instead of the
dimension name. This enables you to choose the relation to use when there is more
than one.
Notes
Examples
SUBSTR functions
Return Value
The return value is the same data type as string.
Syntax
{SUBSTR | SUBSTRB | SUBSTRC | SUBSTR2 | SUBSTR4}(char, position [, substring_length ])
Arguments
string
A text expression that is the base string from which the substring is created.
position
The position at which the first character of the returned string begins.
■ When position is 0 (zero), then it is treated as 1.
■ When position is positive, then the function counts from the beginning of string to
find the first character.
■ When position is negative, then the function counts backward from the end of
string.
substring_length
The length of the returned string. SUBSTR calculates lengths using characters as
defined by the input character set. SUBSTRB uses bytes instead of characters.
SUBSTRC uses Unicode complete characters. SUBSTR2 uses UCS2 code points.
SUBSTR4 uses UCS4 code points.
When you do not specify a value for this argument, then the function returns all
characters to the end of string. When you specify a value that is less than 1, the
function returns NA.
Examples
SHOW SUBSTR('abcdefg',3,4)
cdef
SHOW SUBSTR('abcdefg',-5,4)
cdef
SUBTOTAL
The SUBTOTAL function returns the value of one of the subtotals accumulated in a
report. You normally use the SUBTOTAL function in a ROW command to include a
subtotal or grand total in the report. Since Oracle OLAP maintains 32 running totals
for each column, you can include up to 32 levels of subtotals
Return Value
DECIMAL
Syntax
SUBTOTAL(n)
Arguments
n
An INTEGER value that indicates the level of a running total for each numeric column
in a report. For example, a "Total" may be a level 1 subtotal and a "Grand Total" may
be a level 2 subtotal. Because it is possible to have up to 32 levels of running totals in a
column, n must be an INTEGER between 1 and 32. SUBTOTAL returns the value of
this subtotal for the current column and then resets the value of subtotal n to zero.
The numbers by which the 32 subtotals are referenced (1 to 32) have no intrinsic
significance; all the subtotals are the same until you reference them.
Notes
Examples
SUBTOTAL(2) to produce the grand total. Since you have not yet used it in your
report, it holds a total of the sales figures for all regions.
LIMIT month TO FIRST 3
LIMIT region TO ALL
ZEROTOTAL ALL
FOR region
DO
ROW region
LIMIT DISTRICT TO region
FOR district
DO
ROW INDENT 5 district ACROSS month: sales
DOEND
ROW INDENT 5 'Total' ACROSS month: OVER '-' SUBTOTAL(1)
BLANK
DOEND
ROW 'Grand Total' ACROSS month: OVER '=' SUBTOTAL(2)
SYS_CONTEXT
The SYS_CONTEXT function returns the value of parameter associated with the
context namespace.
Return Values
VARCHAR2.
Syntax
SYS_CONTEXT(namespace, parameter [, length ])
Arguments
namespace
A text expression that specifies a namespace which is a valid SQL identifier. The
context namespace must already have been created, and the associated parameter and
its value must also have been set using the DBMS_SESSION.set_context
procedure.
parameter
A text expression that specifies an attribute associated with a namespace. This
parameter and its value must have previously been set using the DBMS_
SESSION.set_context procedure. The parameter is not case sensitive, but it cannot
exceed 30 bytes in length.
length
A numeric expression that specifies the maximum size of the return value. The value
that you specfy must be a NUMBER (or a value that can be implicitly converted to
NUMBER) and in the range of 1 to 4000 bytes,. If you specify an invalid value, then
Oracle OLAP ignores it and uses the default value of 256 bytes..
Notes
Examples
SYSDATE
The SYSDATE function returns the current date and time as a DATETIME value.. The
format of the date is controlled by the NLS_DATE_FORMAT option. The default
DATETIME format (DD-MM-RR) does not display the time.
Return Value
DATETIME
Syntax
SYSDATE
Examples
SYSINFO
The SYSINFO function provides information about the Oracle user ID for the current
session.
Return Value
TEXT
Syntax
SYSINFO (keyword)
where keyword is one of the following:
USER
ROLES
PROFILES
HOSTNAME
OSUSER
INSTNAME
PID
PROGNAME
CHOSTNAME
COSUSER
TERMNAME
Arguments
USER
Returns a TEXT value that indicates the user ID under which the Oracle Database
session is running. This is the same value that is returned by USERID.
ROLES
Returns a multiline TEXT value that lists the roles that apply to the user ID of the
session.
PROFILES
Returns a multiline TEXT value that lists the profiles that apply to the user ID of the
session.
OSUSER
Returns TEXT value that indicates the operating system user name under which the
Oracle Database server is running.
INSTNAME
Returns a TEXT value that is the instance name of the Oracle Database server.
PID
Returns a TEXT value that is the operating system id number of your Oracle Database
session.
HOSTNAME
Returns a TEXT value that is the host name of the Oracle Database server.
PROGNAME
Returns a TEXT value that is identifies the client which is connecting to the Oracle
Database.
CHOSTNAME
Returns a TEXT value that is the host name of the client.
COSUSER
Returns a TEXT value that is the operating system user name of the client.
TERMNAME
Returns a TEXT value that is the terminal name of the client.
Examples
SYSTEM
The SYSTEM function identifies the platform on which Oracle OLAP is running.
Data Type
TEXT
Syntax
SYSTEM
Notes
Examples
NTX86
SYSTIMESTAMP
The SYSTIMESTAMP function returns the current date and time as a TIMESTAMP_TZ
value.
Data Type
TIMESTAMP_TZ
Syntax
SYSTIMESTAMP
Examples
Example 8–127 Retrieving the current date and time as a TIMESTAMP value.
SHOW systimestamp
26-APR-07 02.18.47.030587 PM -04:00
TALLY
The TALLY function counts the number of values of a dimension that correspond to
each value of one or more related dimensions.
Return Value
INTEGER
Syntax
TALLY(dimension [related-dimensions])
Arguments
dimension
A dimension whose values are to be counted. When you specify related-dimensions,
TALLY counts the number of values of dimension that correspond to each value of a
single related dimension, or to each combination of values of two or more related
dimensions. When you do not specify related-dimensions, TALLY counts the number of
values in the dimension. Only values in the current status of dimension are counted.
related-dimensions
One or more related dimensions for the results. These must be related to dimension.
Alternatively, you can specify the name of the relation instead of the dimension name.
This enables you to choose which relation is used when there is more than one. When
no related-dimensions are specified, TALLY returns the total number of values in the
current status of dimension.
Notes
TALLY with NA
TALLY returns NA for any related-dimension position that has no dimension values
corresponding to it.
Examples
The following statement includes TALLY to present the number of products produced
by each division.
REPORT HEADING 'Products' TALLY(product, division)
TAN
Return Value
DECIMAL
Syntax
TAN(expression)
Arguments
expression
A numeric expression that contains an angle value, which is specified in radians.
Examples
TANH
Return Value
DECIMAL
Syntax
TANH(expression)
Arguments
expression
A numeric expression that contains an angle value, which is specified in radians.
Examples
TCONVERT
The TCONVERT function converts time-series data from one dimension of type DAY,
WEEK, MONTH, QUARTER, or YEAR to another dimension of type DAY, WEEK,
MONTH, QUARTER, or YEAR. You can specify an aggregation method or an
allocation method to use in the conversion.
Important: You can only use this function with dimensions of type
DAY, WEEK, MONTH, QUARTER, or YEAR.You cannot use this
function for time dimensions that are implemented as hierarchical
dimensions of type TEXT.
Return Value
The value returned by the TCONVERT function depends on the type of conversion
you specify and the type of the dimension being converted.
Syntax
TCONVERT(expression time-dimension method [method])
where the syntax for method varies by method type:
SUM|AVERAGE|LAST [BY PERIOD|BY DAY] [STATUS|NOSTATUS]
Arguments
expression
An expression whose values you want to convert. Expression must be dimensioned by
a dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR. This dimension is
referred to as the source dimension. Usually expression is numeric, but with some
conversion methods you can also convert text data. See "Converting Text Data" on
page 8-191.
time-dimension
The DAY, WEEK, MONTH, QUARTER, or YEAR dimension to which you want to
convert the expression. This dimension is referred to as the target dimension.
method
The method to use for converting data from the source dimension to the target
dimension. You can specify an aggregation method or an allocation method:
■ Aggregation methods are SUM, AVERAGE, and LAST. They are typically used to
convert data from smaller time periods to larger time periods (for example,
months to years).
■ Allocation methods are SPLIT, REPEAT, and INTERPOLATE. They are typically
used to convert data from larger to smaller time periods (for example, years to
quarters). The allocation methods all use the full default status of the source
dimension to determine the periods that contribute to the allocation.
Except for a case in which the source dimension and target dimension have
overlapping periods of equal length (as with a calendar year and a fiscal year), you can
specify both an aggregation method and an allocation method. See "Compatible
Aggregation and Allocation Methods" on page 8-190 and "Using Both Aggregation
and Allocation" on page 8-190.
For all methods, results are calculated for the values in the current status of the target
dimension.
The results you obtain depend on the method you specify and on whether you convert
data between dimensions with periods of equal length or unequal length. See "Using
Both Aggregation and Allocation" on page 8-190, "Overlapping Periods of Equal
Length" on page 8-191, and "Substituting a Compatible Method" on page 8-191.
SUM BY DAY
Weights each source value according to the portion of target days it represents. For
each target period, SUM BY DAY multiplies each contributing source period value by
a weighting factor that has this form where source-days-in-target is the Number of
source-period days that actually fall in target period and total-days-in-period is the total
number of days in source period:
source-days-in-target / total-days-in-period
SUM BY DAY then returns the total of these weighted source values. When you use
SUM BY DAY, the value of an individual source period may be apportioned across
adjacent target periods.
For example, suppose you convert weekly data to monthly data. When three days of a
week fall in January and four fall in February, then SUM BY DAY adds 3/7 of the data
for that week to the January total and 4/7 to the February total. In contrast, SUM BY
PERIOD adds the entire data value for the week to the February total (since the week
ends in February).
As another example, suppose you want to convert calendar year data to a fiscal year
ending in June. Calendar year 1996 (Cal96) is the only calendar year that ends in
fiscal year 1997 (Fy97). The SUM BY PERIOD method assigns the value for Cal96 to
Fy97. In contrast, SUM BY DAY apportions the Cal96 value to the fiscal years Fy96
and Fy97, according to the number of calendar days that fall in each fiscal year. Of the
366 days of Cal96, 182 days (January 1 - June 30) fall in Fy96 and 184 days (July 1 -
December 31) fall in Fy97. Therefore, for the CAL96 data, SUM BY DAY uses a
weighting factor of 182/366 for Fy96 and a factor of 184/366 for Fy97.
AVERAGE BY DAY
Weights the value of each contributing source period by the portion of target days it
represents. For each target period, AVERAGE BY DAY multiplies the value of each
source period by the number of days of that source period that actually fall within the
target period. The average is then calculated by adding these weighted source values
and dividing by the total number of days in the target period. When you use
AVERAGE BY DAY, the value of a single source period may be apportioned across
adjacent target periods.
LAST BY DAY
Has the same effect as LAST BY PERIOD, provided you are converting data from
smaller periods to larger periods. See "Substituting a Compatible Method" on
page 8-191.
STATUS
Indicates that the current status of the source dimension is used. It is the default for
the SUM and AVERAGE methods.
NOSTATUS
Indicates that the full default status of the source dimension is used. It is the default
for the LAST method.
SPLIT BY DAY
Weights each source value according to the portion of target days it represents. For
each target period, SPLIT BY DAY multiplies each contributing source period value by
a weighting factor that has this form where target-days-in-source is the Number of
target-period days that actually fall in source period and total-period-days is the total
number of days in source period:
target-days-in-source / total-period-days
SPLIT BY DAY then returns the total of these weighted source values. When you use
SPLIT BY DAY, the value of an individual source period may be apportioned across
adjacent target periods.
REPEAT
For each target period, REPEAT returns the value of a source period. The target
periods are the periods that end within the source period. REPEAT uses the implicit
relation between the source and target dimensions. REPEAT BY DAY has the same
effect as REPEAT BY PERIOD, provided you are converting data from larger time
periods to smaller time periods. See "Substituting a Compatible Method" on
page 8-191.
INTERPOLATE BY DAY
For each target period, adds the value of the previous source period to a value that is
calculated as follows where end-days is the number of days from end of previous
source period to end of current target period and period-days is the total number of
days in current source period:
(end-days / period-days) * (current-source-value - previous-source-value)
When a target period has days that fall in more than one source period, a similar
calculation is made for each source period.
Notes
When you specify both an aggregation method and an allocation method, you can
specify BY PERIOD or BY DAY with either method. When you specify BY PERIOD
(explicitly or by default) for one method and BY DAY for the other method, BY DAY
takes precedence.
Table 8–9 Examples of Conversion Methods for Different Types of Financial Data
Type of Financial Data Conversion Conversion Method
Revenue or expenses Month to year SUM
Stock quotations Day to quarter AVERAGE
Balance sheet items Month to quarter LAST
Quarterly tax payment Year to quarter SPLIT BY PERIOD
Money supply Year to quarter INTERPOLATE
Examples
Next, define a variable named weekvar, dimensioned by week, and assign a value of
7 to each week.
DEFINE weekvar DECIMAL <week>
weekvar = 7
The following statements show that December 31, 1995 is the beginning date of the
first week for which weekvar contains non-NA data and that July 6, 1996 is the ending
date of the final week for which weekvar contains non-NA data.
SHOW BEGINDATE(weekvar)
SHOW ENDDATE(weekvar)
With these beginning and ending dates, when the data is converted to monthly data, it
will be aggregated over the months Dec95 through Jul96. The following statements
show the effects of using the SUM method and the SUM BY DAY method to convert
the weekly weekvar data to monthly data.
LIMIT month TO 'Jan96' TO 'Jul96'
REPORT HEADING 'Sum' TCONVERT(weekvar month SUM) -
HEADING 'Sum by Day' -
TCONVERT(weekvar month SUM BY day)
TEXTFILL
The TEXTFILL function reformats a text value to fit compactly into lines of a specified
width, regardless of its current format. TEXTFILL is commonly used to reformat text
with an unnecessarily ragged right margin or with a bad line width.
Return Value
TEXT or NTEXT
Syntax
TEXTFILL(text-expression, width)
Arguments
text-expression
A text expression to be reformatted to the specified width, regardless of the current
format of the data. When you specify a TEXT expression, the return value is TEXT.
When you specify an NTEXT expression, the return value is NTEXT.
width
The desired width of the reformatted data, entered as an INTEGER value from
1 to 132.
In a structured report, TEXTFILL reformats text-expression to the width you specify, as
long as that width is less than the width of the report column. When width is greater
than the column width, it is ignored by TEXTFILL, and the expression is reformatted
to the width of the column.
TEXTFILL fits as many words of text-expression as it can onto one line, placing just one
space between words and removing extra spaces between words. When a word is
longer than width, TEXTFILL breaks it across two or more lines. In this case there may
be extra spaces at the end of lines.
Examples
TO_CHAR
Return Value
TEXT
Syntax
TO_CHAR(datetime-exp, [datetime-fmt,] [option setting])
or
TO_CHAR(num-exp, [num-fmt,] [nlsparams])
or
TO_CHAR(ntext-exp)
Arguments
datetime-exp
A DATETIME expression to be converted to TEXT.
datetime-fmt
A text expression that identifies a datetime format template. This template specifies
how the conversion from a DATETIME data type to TEXT should be performed. For
information about datetime format templates, see Table 9–4, " Datetime Format
Elements" on page 9-157. The default value of datetime-fmt is controlled by the NLS_
DATE_FORMAT option.
option setting
An OLAP option (such as NLS_DATE_LANGUAGE) and its new setting, which
temporarily overrides the setting currently in effect for the session. Typically, this
option identifies the language that you want datetime-exp to be translated into. See
Example 8–136, "Displaying the Current Date and Time in Spanish" on page 8-198.
Do not specify an option that set other options. For example, do not set NLS_DATE_
LANGUAGE or NLS_TERRITORY; set NLS_DATE_LANGUAGE instead. While TO_
CHAR will save and restore the current setting of the specified option so that it has a
new value only for the duration of the statement, TO_CHAR cannot save and restore
any side effects of changing that option. For example, NLS_TERRITORY controls the
value of NLS_DATE_FORMAT, NLS_NUMERIC_CHARACTERS, NLS_CURRENCY,
NLS_CALENDAR, and other options. When you change the value of NLS_
TERRITORY in a call to TO_CHAR, all of these options will be reset to their
territory-appropriate default values twice: once when NLS_TERRITORY is set to its
new value for the duration of the TO_CHAR statement, and again when the saved
value of NLS_TERRITORY is restored.
num-exp
A numeric expression to be converted to TEXT.
num-fmt
A text expression that identifies a number format model. This model specifies how the
conversion from a numerical data type (NUMBER, INTEGER, SHORTINTEGER,
LONGINTEGER, DECIMAL, SHORTDECIMAL) to TEXT should be performed. For
information about number format models, see Oracle Database SQL Language Reference.
The default number format model uses the decimal and thousands group markers
identified by NLS_NUMERIC_CHARACTERS.
nlsparams
A text expression that specifies the thousands group marker, decimal marker, and
currency symbols used in num-exp. This expression contains one or more of the
following parameters, separated by commas:
NLS_CURRENCY symbol
NLS_ISO_CURRENCY territory
NLS_NUMERIC_CHARACTERS dg
symbol
A text expression that specifies the local currency symbol. It can be no more than 10
characters.
territory
A text expression that identifies the territory whose ISO currency symbol is used.
dg
A text expression composed of two different, single-byte characters for the decimal
marker (d) and thousands group marker (g).
These parameters override the default values specified by the NLS_CURRENCY,
NLS_ISO_CURRENCY, and NLS_NUMERIC_CHARACTERS options.
ntext-exp
An NTEXT expression to be converted to TEXT. A conversion from NTEXT to TEXT
can result in data loss when the NTEXT value cannot be represented in the database
character set.
Notes
Examples
The specified date format allows the time to be displayed along with the date.
November 30, 2000 10:01:29
The following statement displays the current date and time in Spanish.
SHOW TO_CHAR(SYSDATE)
Viernes : Diciembre 01, 2000 08:21:17 AM
The NLS_DATE_LANGUAGE option changes the language for the duration of the
statement. The following statement displays the date and time in German.
SHOW TO_CHAR(SYSDATE, NA, NLS_DATE_LANGUAGE 'german')
Freitag : Dezember 01, 2000 08:26:00 AM
TO_DATE
Return Value
DATETIME
Syntax
TO_DATE(text-exp, [fmt,] [option setting])
Arguments
text-exp
The text expression that contains a date to be converted. The expression can have the
TEXT or NTEXT data type. A conversion from NTEXT can result in an incorrect result
when the NTEXT value cannot be interpreted as a date.
fmt
A text expression that identifies a datetime format template. This template specifies
how the conversion from text to DATETIME should be performed. For information
about datetime format templates, see Table 9–4, " Datetime Format Elements" on
page 9-157.
option setting
An OLAP option (such as NLS_DATE_LANGUAGE) and its new setting, which
temporarily overrides the setting currently in effect for the session. Typically, this
option identifies the language of text-exp when it is different from the session
language. See Example 8–138, "Specifying a Default Language and a Date Format" on
page 8-200.
Do not specify an option that sets other options. For example, do not set NLS_
LANGUAGE or NLS_TERRITORY; set NLS_DATE_LANGUAGE instead. While TO_
DATE will save and restore the current setting of the specified option so that it has a
new value only for the duration of the statement, TO_DATE cannot save and restore
any side effects of changing that option. For example, NLS_TERRITORY controls the
value of NLS_DATE_FORMAT, NLS_NUMERIC_CHARACTERS, NLS_CURRENCY,
NLS_CALENDAR, and other options. When you change the value of NLS_
TERRITORY in a call to TO_DATE, all of these options will be reset to their
territory-appropriate default values twice: once when NLS_TERRITORY is set to its
new value for the duration of the TO_DATE statement, and again when the saved
value of NLS_TERRITORY is restored.
Notes
Capitalization
Capital letters in words, abbreviation, or Roman numerals in a format element
produce corresponding capitalization in the return value. For example, the format
element DAY produces MONDAY, Day produces Monday, and day produces monday.
Unrecognized Dates
When TO_DATE cannot construct a value with a valid DATE value using fmt, it
returns an error. For example, when an alphanumeric character appears in text-exp
where fmt indicates a punctuation character, then an error results.
Examples
The date is translated from American to Spanish and displayed in the new date
format.
Jueves : Noviembre 15, 2001 12:00:00 AM
TO_DSINTERVAL
Return Value
DSINTERVAL
Syntax
TO_DSINTERVAL(char)
Arguments
char
Specifies the character string to be converted.
TO_NCHAR
Return Value
NTEXT
Syntax
TO_NCHAR(text-exp)
or
TO_NCHAR(datetime-exp, [datetime-fmt,] [option setting]
or
TO_NCHAR(num-exp, [num-fmt,] [nlsparams]
Arguments
text-exp
A TEXT expression to be converted to NTEXT.
datetime-exp
A DATETIME expression to be converted to NTEXT.
datetime-fmt
A text expression that identifies a datetime format template. This template specifies
how the conversion from a DATETIME data type to NTEXT should be performed. For
information about datetime format templates, see Table 9–4, " Datetime Format
Elements" on page 9-157. The default value of datetime-fmt is controlled by the NLS_
DATE_FORMAT option.
option setting
An OLAP option (such as NLS_DATE_LANGUAGE) and its new setting, which
temporarily overrides the setting currently in effect for the session. Typically, this
option identifies the language that you want datetime-exp to be translated into. See
Example 8–141, "Specifying the Default Language and a Date Format" on page 8-203.
Do not specify an option that sets other options. For example, do not set NLS_
LANGUAGE or NLS_TERRITORY; set NLS_DATE_LANGUAGE instead.While TO_
NCHAR will save and restore the current setting of the specified option so that it has a
new value only for the duration of the statement, TO_NCHAR cannot save and restore
any side effects of changing that option. For example, NLS_TERRITORY controls the
value of NLS_DATE_FORMATE, NLS_NUMERIC_CHARACTERS, NLS_
CURRENCY, NLS_CALENDAR, and other options. When you change the value of
NLS_TERRITORY in a call to TO_NCHAR, all of these options will be reset to their
territory-appropriate default values twice: once when NLS_TERRITORY is set to its
new value for the duration of the TO_NCHAR statement, and again when the saved
value of NLS_TERRITORY is restored.
num-exp
A numeric expression to be converted to NTEXT.
num-fmt
A text expression that identifies a number format model. This model specifies how the
conversion from a numerical data type (NUMBER, INTEGER, SHORTINTEGER,
LONGINTEGER, DECIMAL, SHORTDECIMAL) to TEXT should be performed. For
information about number format models, see Oracle Database SQL Language Reference.
The default number format model uses the decimal and thousands group markers
identified by NLS_NUMERIC_CHARACTERS option.
nlsparams
A text expression that specifies the thousands group marker, decimal marker, and
currency symbols used in num-exp. This expression contains one or more of the
following parameters, separated by commas:
NLS_CURRENCY symbol
NLS_ISO_CURRENCY territory
NLS_NUMERIC_CHARACTERS dg
symbol
A text expression that specifies the local currency symbol. It can be no more than 10
characters.
territory
A text expression that identifies the territory whose ISO currency symbol is used.
dg
A text expression composed of two different, single-byte characters for the decimal
marker (d) and thousands group marker (g).
These parameters override the default values specified by the NLS_CURRENCY,
NLS_ISO_CURRENCY, and NLS_NUMERIC_CHARACTERS options.
Examples
The specified date format allows the time to be displayed along with the date.
November 30, 2000 10:01:29
NLS_DATE_LANGUAGE = 'spanish'
NLS_DATE_FORMAT = 'Day: Month dd, yyyy HH:MI:SS am'
The NLS_DATE_LANGUAGE option changes the language for the duration of the
statement. The following statement
SHOW TO_NCHAR(SYSDATE, NA, NLS_DATE_LANGUAGE 'german')
TO_NUMBER
Return Value
NUMBER. Negative return values contain a leading negative sign, and positive values
contain a leading space, unless the format model contains the MI, S, or PR format
elements.
Syntax
TO_NUMBER(text-exp, [fmt,] [nlsparams])
Arguments
text-exp
A text expression that contains a number to be converted. The expression can have the
TEXT or NTEXT data type. A conversion from NTEXT can result in an incorrect result
when the NTEXT value cannot be interpreted as a number.
fmt
A text expression that identifies a number format model. This model specifies how the
conversion to NUMBER should be performed. For information about number format
models, see Oracle Database SQL Language Reference.
The default number format identifies a period (.) as the decimal marker and does not
recognize any other symbol.
nlsparams
A text expression that specifies the thousands group marker, decimal marker, and
currency symbols used in text-exp. This expression contains one or more of the
following parameters, separated by commas:
NLS_CURRENCY symbol
NLS_ISO_CURRENCY territory
NLS_NUMERIC_CHARACTERS dg
symbol
A text expression that specifies the local currency symbol. It can be no more than 10
characters.
territory
A text expression that identifies the territory whose ISO currency symbol is used.
dg
A text expression composed of two different, single-byte characters for the decimal
marker (d) and thousands group marker (g).
These parameters override the default values specified by the NLS_CURRENCY,
NLS_ISO_CURRENCY, and NLS_NUMERIC_CHARACTERS options. Refer to NLS
Options for additional information.
Notes
Examples
TO_TIMESTAMP
The TO_TIMESTAMP function converts text data to a value of TIMESTAMP data type.
Return Values
TIMESTAMP
Syntax
TO_TIMESTAMP(char-exp [, fmt [ 'nlsparam' ] ])
Arguments
char-exp
A text expression that you wan to convert.
fmt
Specifies the datetime format template to be used to convert the text expression. See
Table 9–4, " Datetime Format Elements" on page 9-157 for more information about the
datetime format template.
When you omit this argument, the function uses the default format of TIMESTAMP for
the object.
nlsparam
Specifies the language in which month and day names and abbreviations are returned.
This argument can have this form:
'NLS_DATE_LANGUAGE = language'
If you omit this argument, then this function uses the default date language for your
session.
Examples
MYTIMESTAMPTZ
------------------------------
TO_TIMESTAMP_TZ
The TO_TIMESTAMP_TZ function converts text data to a value with the TIMESTAMP_
TZ data type.
Return Value
TIMESTAMP_TZ
Syntax
TO_TIMESTAMP_TZ (char-exp [, fmt [ 'nlsparam' ] ])
Arguments
char-exp
A text expression that you wan to convert.
fmt
Specifies the datetime format template to be used to convert the text expression. See
Table 9–4, " Datetime Format Elements" on page 9-157 for more information about the
datetime format template.
When you omit this argument, the function uses the default format of TIMESTAMP_TZ
for the object.
nlsparam
Specifies the language in which month and day names and abbreviations are returned.
This argument can have this form:
'NLS_DATE_LANGUAGE = language'
If you omit this argument, then this function uses the default date language for your
session.
Examples
TO_YMINTERVAL
Return Value
YMINTERVAL
Syntax
TO_YMINTERVAL(char)
Arguments
char
Specifies the character string to be converted.
TOD
The TOD function returns the current time of day in the form hh:mm:ss using a 24-hour
format.
Return Value
ID
Syntax
TOD
Examples
TODAY
The TODAY function returns the current date as a DATE or TEXT value.
Return Value
DATE or TEXT depending on the data type that is expected:
■ DATE
When you display a returned DATE value, the value has the format specified by
the date template in the DATEFORMAT option. When the day of the week or the
name of the month is used in the date template, TODAY uses the day names
specified in the DAYNAMES option and the month names specified in the
MONTHNAMES option.
■ TEXT
Where a text value is expected. TODAY automatically converts the date to a TEXT
value, using the current template in the DATEFORMAT option to format the text
value. When you want to override the current DATEFORMAT template, you can
convert the date result to text by using the CONVERT function with a date-format
argument.
Syntax
TODAY
Examples
When the current date is January 15, 1996, then these statements produce the
following output.
Monday January 15, 1996
When the current date is January 15, 1996, then this statement produces the following
output.
Friday March 15, 1996
TOTAL
Return Value
The data type of the expression. It can be INTEGER, LONGINT, or DECIMAL.
Syntax
TOTAL(expression [CACHE] [dimension...])
Arguments
expression
The expression to be totalled.
CACHE
Specifies slightly different internal behavior. Specify this keyword only when the
original performance is extrememly slow.
dimension
The name of a dimension of the result; or, the name of a relation between one of the
dimensions of expression and another dimension that you want as a dimension of the
result.
By default, TOTAL returns a single value. When you indicate one or more dimensions
for the result, TOTAL calculates values along the dimensions that are specified and
returns an array of values. Each dimension must be either a dimension of expression or
related to one of its dimensions.
Notes
QUARTER, or YEAR dimension to another (for example, from weeks to months), you
can define an explicit relation between the two dimensions and specify the name of the
relation as the dimension argument to the TOTAL function.
For each time period in the related dimension, Oracle OLAP totals the data for all the
source time periods that end in the target time period. This method is used regardless
of which dimension has the more aggregate time periods. To control the way in which
data is aggregated or allocated between the periods of two time dimensions, you can
use the TCONVERT function.
When an analytic workspace had the two relations described earlier and you specified
the following TOTAL function, Oracle OLAP would use the relation
region.district by default, because it holds values of the specified dimension.
REPORT TOTAL(sales region)
Examples
TRANSLATE
The TRANSLATE function replaces all occurrences of each character of one string with
the corresponding character in another string.
Return value
Text.
Syntax
TRANSLATE ( exp from_string to_string)
Arguments
exp
A text expression in which you want to replace characters.
from_string
A text expression that is the characters you want to replace.
to_string
A text expression that is the characters that you want to use for replacement in the
order of from_string. When you include fewer characters in this argument than are in
from_string, the function removes the extra characters in from_string from the return
value. Note, however, that to remove all characters in from_string, you cannot specify
an empty string for to_string as an empty string is interrpreted as a null argument.
Examples
TRIGGER function
The TRIGGER function retrieves the event, subevent, or name of the object or analytic
workspace that caused the execution of a trigger program (that is, a TRIGGER_
DEFINE, TRIGGER_AFTER_UPDATE, or TRIGGER_BEFORE_UPDATE program, or
any program identified as a trigger program using the TRIGGER command).
When the current program is a trigger program, the TRIGGER function returns the
trigger information for that program. When it is not, the TRIGGER function returns
trigger information for the most recently executed trigger program.
Return Values
TEXT
Syntax
TRIGGER (NAME | EVENT | SUBEVENT)
Arguments
NAME
For a program identified as a trigger program using the TRIGGER command, returns
the object for which the trigger program is association. For a TRIGGER_AW,
TRIGGER_DEFINE, TRIGGER_AFTER_UPDATE, or TRIGGER_BEFORE_UPDATE
program, returns the name of the analytic workspace that caused the program to
execute.
EVENT
Returns the name of the event (DML statement) that triggered the execution of the
program.
AW
MAINTAIN
DELETE
DEFINE
PROPERTY
ASSIGN
BEFORE_UPDATE
AFTER_UPDATE
SUBEVENT
When the value returned by EVENT is MAINTAIN, AFTER_UPDATE or BEFORE_
UPDATE, returns more information on the OLAP DML statement that triggered the
execution of the program. Valid subevents for AW are outlined in Table 8–11,
" Subevents for the AW Event" on page 8-217. Valid subevents for MAINTAIN are
outlined in Table 8–12, " Subevents for the MAINTAIN Event" on page 8-217. Valid
subevents for UPDATE are outlined in Table 8–13, " Subevents for UPDATE Events" on
page 8-217.
Examples
For examples of using the TRIGGER function, see Example 4–2, "TRIGGER_BEFORE_
UPDATE Program" on page 4-29 and Example 10–165, "Assigning an Alternative
Value using an Assign Trigger" on page 10-274.
TRIM
The TRIM function enables you to trim leading or trailing characters (or both) from a
character string.
You can also trim leading characters using LTRIM and trailing characters using
RTRIM.
Return Value
The data type of the string you are trimming (that is, trim-source).
Syntax
TRIM ([{{LEADING|TRAILING|BOTH} [trim_characters])|trim_character} FROM] trim_source)
Arguments
trim-characters
An expression that specifies the character values to be trimmed. This text expression
can be any of the text data types.
When you specify multiple characters in trim-characters, the function searches for each
character in trim_source, in turn, removing characters from trim_source until it
encounters a character in trim_source that is not in trim-characters.
When you do not specify a value, then the default value is a blank space and the
function removes leading and trailing blank spaces.
LEADING
Specifies that the function removes any leading characters from trim_source that are
equal to trim_characters.
TRAILING
Specifies that the function removes any trailing characters from trim_source that are
equal to trim_characters.
BOTH
Specifies that the function removes leading and trailing characters from trim_source
that are equal to trim_characters.
trim-source
An expression that is the string value to be trimmed. This text expression can be any
of the text data types.
TRUNCATE
TRUNCATE (datetime)
The TRUNCATE (datetime) function returns date with the time portion of the day
truncated to the unit specified by the format model.
Return Value
DATETIME
Syntax
TRUNC (datetime_exp, [fmt])
Arguments
datetime-exp
A datetime expression that identifies a date and time number.
fmt
A text expression that specifies one of the format models shown in Table 8–6,
" Datetime Format Templates for the ROUND and TRUNC Date Functions" on
page 8-124. A format model indicates how the date and time number should be
truncated. If you omit fmt, then date is truncated to the nearest day.
Examples
As the following SHOW statements illustrate, the value you specify for the format
argument of TRUNCATE function determines the value returned by that function.
SHOW TRUNCATE(mydatetime, 'MON')
01-AUG-06
SHOW TRUNCATE(mydatetime, 'DD')
07-AUG-06
SHOW TRUNCATE(mydatetime)
= 'AUG-2006-07-00'
TRUNCATE (number)
Return Value
DECIMAL
Syntax
TRUNC (number, truncvalue)
Arguments
number
The number to truncate. The value specified for number must be followed by a comma.
truncvalue
An INTEGER value that specifies the number of places to the right or left of the
decimal point to which number should be truncated. When truncvalue is positive, digits
to the right of the decimal point are truncated. When it is negative, digits to the left of
the decimal point are truncated (that is, made zero). When truncvalue is omitted,
number is truncated to 0 decimal places.
Examples
TZ_OFFSET
The TZ_OFFSET function returns the time zone offset corresponding to the argument
based on the date the statement is executed.
Return Values
A text value in the format shown below which represents the offset
'{ + | - } hh : mi'
Syntax
TZ_OFFSET( 'time_zone_name' | '{ + | - } hh : mi' | SESSIONTIMEZONE | DBTMEZONE)
Arguments
time_zone_name
A text value that specifies a valid time zone name. For a listing of valid values for
time_zone_name, query the TZNAME column of the V$TIMEZONE_NAMES
dynamic performance view.
{ + | - } hh : mi'
Specifies a time zone offset from UTC (which simply returns itself)
SESSIONTIMEZONE
Specifies the time zone of the current session.
DBTIMEZONE
Specifies the value of the Database time zone.
UNIQUELINES
The UNIQUELINES function removes duplicate lines in a multiline text value and
sorts the lines in ascending order. The function returns a multiline text value
composed of the resulting lines.
Return Value
TEXT or NTEXT
Syntax
UNIQUELINES(text-expression)
Arguments
text-expression
A multiline text expression from which UNIQUELINES removes duplicate lines and
in which it sorts the remaining lines. UNIQUELINES is case-sensitive when it checks
for duplicates, and it compares all characters, including spaces.
When you specify a TEXT expression, the return value is TEXT. When you specify an
NTEXT expression, the return value is NTEXT.
Examples
The statement
show uniquelines(officelist)
UNRAVEL
Return Value
The data type returned by UNRAVEL is the data type of the values specified by the
expression.
Syntax
UNRAVEL(expression [dimension1...])
Arguments
expression
The expression whose values are to be copied.
dimension
Specifies one or more dimensions over which to loop; the dimension specified first will
vary fastest as the data is unraveled.
Specifying dimensions in UNRAVEL overrides the default looping order, as well as
the extent of the unraveling of the expression. By default, unraveling extends through
all the dimensions of the expression. However, when you specify some but not all the
dimensions of the expression, any dimensions you have not specified do not unravel.
Instead, the unraveled values will include only the first value of each of the omitted
dimensions.
Notes
Setting Status
Since the order in which unraveled values are assigned depends on the current status
of the dimensions of both the variable and the expression, be sure that the appropriate
LIMIT commands have been given so that the cells match up correctly.
Examples
As you can see, row 1 contains month labels, while column 1 contains product labels.
The variable newprice is dimensioned by month and product, as shown in its
definition.
DEFINE newprice VARIABLE DECIMAL <month product>
LD Wholesale Unit Selling Price
Even though the worksheet has different dimensions (wkscol and wksrow) than
newprice, the data contained in it is well organized for transferring to the variable.
However, you do not want to take data from all the rows and columns in the
worksheet, so limit wkscol and wksrow to the rows and columns that contain the
price data itself.
LIMIT wkscol TO 2 3
LIMIT wksrow TO 2 TO 6
Also, you only want to set values into the variable newprice for January 1995 and
January 1996. So first limit month to these values, then type an assignment statement
using UNRAVEL to move the values from the worksheet to the variable.
You do not have to specify dimensions in the UNRAVEL function because wkscol is
the fastest varying dimension. This means that both months will unravel for the first
product, then both months for the second product. Since the fastest-varying dimension
of the variable is month, SET assigns values to the variable in the same order.
A report of newprice looks like this.
------NEWPRICE-------
--------MONTH--------
PRODUCT Jan95 Jan96
-------------- ---------- ----------
Tents 191.39 194.00
Canoes 279.92 300.00
Racquets 83.34 85.00
Sportswear 107.90 110.00
Footwear 183.18 195.00
UPCASE
The UPCASE function converts all alphabetic characters in a text expression into
uppercase. When you specify a TEXT expression, the return value is TEXT. When you
specify an NTEXT expression, the return value is NTEXT.
Return Value
TEXT or NTEXT
Syntax
UPCASE(text-expression)
Arguments
text-expression
The text expression whose characters are to be converted.
Examples
VALSPERPAGE
The VALSPERPAGE program calculates the maximum number of values for a variable
of a given width that will fit on one page. Pages are units of storage in the workspace.
Return Value
INTEGER
Syntax
VALSPERPAGE(n)
Arguments
n
An INTEGER expression specifying the width of a variable in bytes. This value should
be between 1 and 4000. When you specify a value greater than 4000 or less than 1,
the result is NA.
Notes
Large Variables
Oracle OLAP lets you create very large, multidimensional variables. Theoretically, a
variable can contain up to 2**63 cells, although this maximum is subject to memory
constraints and other factors specific to your system.
Examples
VALUES
The VALUES function returns the default status list or the current status list of a
dimension or dimension surrogate, or it returns the values in a valueset. VALUES
returns a multiline text value that contains one dimension value on a line.
Note: Because composites do not have status, you cannot use the
VALUES function with a composite. When you attempt to do so,
Oracle OLAP displays an error message.
Return Value
TEXT
Syntax
VALUES(dimension [keyword] [INTEGER])
Arguments
dimension
A text expression whose value is the name of a dimension, dimension surrogate, or
valueset.
keyword
One of the following keywords that specify whether you want the current status list or
the default status list for a dimension or a surrogate:
■ NOSTATUS which indicates that VALUES should return the default status list of a
dimension or dimension surrogate rather than its current status list.
■ STATUS which indicates that VALUES should return the current status list of a
dimension or dimension surrogate (Default).
These keywords do not affect valuesets. For a valueset, VALUES returns all the values
in that valueset whether you specify NOSTATUS, STATUS, or nothing.
INTEGER
When you use the INTEGER keyword, the function returns the position numbers of
the dimension or dimension surrogate values rather than the values. When you use
INTEGER with a valueset, the function returns the position numbers of the values in
the existing dimension, not in the valueset.
Notes
Examples
Therefore, the value Jan95 is shown as the 61st value in the month dimension, May95
as the 65th value, and Dec95 as the 72nd value, although they are the first, second,
and third values in monthset.
Seattle
To list the values of district using the CHARLIST function rather than VALUES,
you must use an ampersand.
SHOW CHARLIST(&textvar)
Because ampersands in a program can degrade performance, you should use VALUES
rather than CHARLIST in such cases.
Next, you use the following statements to define two conjoint dimensions.
DEFINE conj1 DIMENSION <prod geog>
DEFINE conj2 DIMENSION <prod geog>
The following statements add dimension values to the prod and geog dimensions.
MAINTAIN prod ADD 'prod1' 'prod&val2'
MAINTAIN geog ADD 'geog1' 'geog&val2'
The following statements add tuples (combinations of dimension values) to the CONJ1
conjoint dimension.
MAINTAIN conj1 ADD <'prod1' 'geog1'>
MAINTAIN conj1 ADD <'prod&val2' 'geog1'>
Now, suppose you want to use the VALUE function with a MAINTAIN statement to
add those same tuples to the conj2 conjoint dimension. When you attempt to use the
following statement, it will generate an error message.
MAINTAIN conj2 ADD VALUES(conj1)
ERROR: (MXMSERR) val2 does not exist in any attached workspace.
This error occurs because the ampersand in the dimension value name prod&val2 is
interpreted as an attempt at ampersand substitution.
Instead of using the preceding MAINTAIN statement, you can use the following
statement to add the tuples to the CONJ2 conjoint dimension.
MAINTAIN conj2 MERGE < KEY(conj1 prod) KEY(conj1 geog) >
VINTSCHED
The VINTSCHED function calculates the interest portion of the payments on a series
of variable-rate installment loans that are paid off over a specified number of time
periods. VINTSCHED calculates the result for a given time period as the sum of the
interest due on each loan that is incurred or outstanding in that period. For each time
period, you specify the initial amount of the loans incurred in that time period and the
interest rate that will be charged in that time period for each new or outstanding loan.
Return Value
DECIMAL
The result returned by the VINTSCHED function is dimensioned by the union of all
the dimensions of loans and rates and the dimension that is used as the time-dimension
argument.
Syntax
VINTSCHED(loans, rates, n, [time-dimension] [STATUS])
Arguments
loans
A numeric expression that contains the initial amounts of the loans. When loans does
not have a time dimension, or when loans is dimensioned by more than one time
dimension, the time-dimension argument is required.
rates
A numeric expression that contains the interest rates charged for loans. When rates is a
dimensioned variable, it can be dimensioned by any dimension, including a different
time dimension. When rates is dimensioned by a time dimension, you specify the
interest rate in each time period that will apply to the loans incurred or outstanding in
that period. The interest rates are expressed as decimal values; for example, a 5 percent
rate is expressed as .05.
n
A numeric expression that specifies the number of payments required to pay off the
loans in the series. The n expression can be dimensioned, but it cannot be dimensioned
by the time dimension argument. One payment is made in each time period of the
time dimension by which loans is dimensioned or in each time period of the dimension
specified in the time-dimension argument. For example, one payment a month is made
when loans is dimensioned by month.
time-dimension
The name of the dimension along which the interest payments are calculated. When
loans has a dimension of type of DAY, WEEK, MONTH, QUARTER, or YEAR, the
time-dimension argument is optional, unless loans has more than one dimension of
these types.
STATUS
Specifies that VINTSCHED should use the current status list (that is, only the
dimension values currently in status in their current status order) when computing the
interest portion of the payments. By default VINTSCHED uses the default status list.
Notes
Table 8–14 How NASKIP Affects the Results When a Loan or Rate Value is NA for a
Given Time Period
Loan Value Rate Value Result when NASKIP = YES Result when NASKIP = NO
Non-NA NA Error Error
NA Non-NA Interest values (NA loan value is NA for affected time periods
treated as zero)
NA NA NA for affected time periods NA for affected time periods
Examples
Suppose you assign the following values to the variables loans and rates.
YEAR LOANS RATES
-------------- ---------- ----------
Yr95 100.00 0.05
Yr96 200.00 0.06
For each year, loans contains the initial value of the variable-rate loan incurred
during that year. For each year, the value of rates is the interest rate that will be
charged for that year on any loans incurred or outstanding in that year.
The following statement specifies that each loan is to be paid off in three payments,
calculates the interest portion of the payments on the loans,
REPORT W 20 HEADING 'Payment' VINTSCHED(loans, rates, 3, year)
The interest payment for 1995 is interest on the loan of $100 incurred in 1995, at
5 percent. The interest payment for 1996 is the sum of the interest on the remaining
principal of the 1995 loan, plus interest on the loan of $200 incurred in 1996; the
interest rate for both loans is 6 percent. The 1997 interest payment is the sum of the
interest on the remaining principal of the 1995 loan, interest on the remaining
principal of the 1996 loan, and interest on the loan of $300 incurred in 1997; the interest
rate for all three loans is 7 percent. Since the 1995 loan is paid off in 1997, the payment
for 1998 represents 7 percent interest on the remaining principal of the 1996 and 1997
loans. In 1999, the interest payment is on the remaining principal of the 1997 loan.
VPMTSCHED
The VPMTSCHED function calculates a payment schedule (principal plus interest) for
paying off a series of variable-rate installment loans over a specified number of time
periods. VPMTSCHED calculates the payment for a given time period as the sum of
the principal and interest due on each loan that is incurred or outstanding in that
period. For each time period, you specify the initial amount of the loans incurred in
that time period and the interest rate that will be charged in that time period for each
new or outstanding loan.
Return Value
DECIMAL
The result returned by the VPMTSCHED function is dimensioned by the union of all
the dimensions of loans and rates and the dimension used as the time-dimension
argument.
Syntax
VPMTSCHED(loans, rates, n, [time-dimension] [STATUS])
Arguments
loans
A numeric expression that contains the initial amounts of the loans. When loans does
not have a time dimension, or when loans is dimensioned by more than one time
dimension, the time-dimension argument is required.
rates
A numeric expression that contains the interest rates charged for loans. When rates is a
dimensioned variable, it can be dimensioned by any dimension, including a different
time dimension. When rates is dimensioned by a time dimension, you specify the
interest rate in each time period that will apply to the loans incurred or outstanding in
that period. The interest rates are expressed as decimal values; for example, a 5 percent
rate is expressed as .05.
n
A numeric expression that specifies the number of payments required to pay off the
loans in the series. The n expression can be dimensioned, but it cannot be dimensioned
by the time dimension argument. One payment is made in each time period of the
time dimension by which loans is dimensioned or in each time period of the dimension
specified in the time-dimension argument. For example, one payment a month is made
when loans is dimensioned by month.
time-dimension
The name of the dimension along which the interest payments are calculated. When
loans has a dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR, the
time-dimension argument is optional, unless loans has more than dimension of this type.
STATUS
Specifies that VPMTSCHED should use the current status list (that is, only the
dimension values currently in status in their current status order) when computing the
payment schedule. By default VPMTSCHED uses the default status list.
Notes
Examples
Suppose you assign the following values to the variables loans and rates.
YEAR LOANS RATES
-------------- ---------- ----------
Yr95 100.00 0.05
Yr96 200.00 0.06
Yr97 300.00 0.07
Yr98 0.00 0.07
Yr99 0.00 0.07
For each year, loans contains the initial value of the variable-rate loan incurred
during that year. For each year, the value of rates is the interest rate that will be
charged for that year on any loans incurred or outstanding in that year.
The following statement specifies that each loan is to be paid off in three payments,
calculates the schedule for paying off the principal and interest on the loans,
REPORT W 20 HEADING 'Payment' VPMTSCHED(loans, rates, 3, year)
The payment for 1995 is the principal due on the loan of $100 incurred in 1995, plus
interest on the loan at 5 percent. The payment due in 1996 is the sum of the second
payment of principal on the loan incurred in 1995, plus the first payment of principal
on the loan of $200 incurred in 1996, plus interest on the remaining principals of both
loans at 6 percent. The 1997 payment is the sum of the third and final principal
payment on the loan incurred in 1995, the second of the three principal payments on
the 1996 loan, the first payment of principal on the loan of $300 incurred in 1997, plus
interest on the remaining principals of all three loans at 7 percent. Since the 1995 loan
is paid off in 1997, the payment for 1998 covers the principal and interest for the 1996
and 1997 loans. The payment for 1999 is the final payment of principal and interest for
the 1997 loan.
WEEKOF
The WEEKOF function returns an INTEGER in the range of 1 to 53, which gives the
week of the year in which a specified date falls. The result has the same dimensions as
the specified DATE expression.
Return Value
INTEGER
Syntax
WEEKOF(date-expression)
Arguments
date-expression
An expression that has the DATE data type, or a text expression that specifies a date.
The values of the text expression are converted automatically to DATE values, using
the current setting of the DATEORDER option to resolve any ambiguity.
Notes
Determining Week 1
The value of WEEKDSYSNEWYEAR specifies how many days of the new year there
must be in the week for WEEKOF to consider it to be week 1 of the new year. For
example, when January 1 is on a Wednesday, then the week of December 29 to
January 4 has four days in the new year. WEEKDSYSNEWYEAR must therefore have
a value of 4 or less for that week to be counted as week 1. This determination of week
1 affects the numbering of all weeks in the year.
Examples
When today's date is August 5, 1996, which is a Monday, this statement produces the
following output.
32
WIDTH_BUCKET
For a given expression, the WIDTH_BUCKET function returns the bucket number into
which the value of this expression would fall after being evaluated.
Return Value
An INTEGER.
Syntax
WIDTH_BUCKET (expr , min_value , max_value , num_buckets)
Arguments
expr
The expression for which the histogram is being created. This expression must
evaluate to a number or a datetime value. When expr evaluates to NA, then the
expression returns NA.
min_value
An expression that resolves to the minimum end point of the acceptable range for expr.
This expression must evaluate to number or datetime values, and cannot evaluate to
NA.
max_value
An expression that resolves to the maximum end point of the acceptable range for
expr. This expression must evaluate to number or datetime values, and cannot evaluate
to NA.
num_buckets
An expression that resolves to a constant indicating the number of buckets. This
expression must evaluate to a positive INTEGER.
Notes
Examples
WKSDATA
The WKSDATA function returns the data type of each individual cell in a worksheet
or the data type of a program argument with the WORKSHEET data type. You can use
WKSDATA to help in the process of transferring labels and data between text files and
Oracle OLAP.
Return Value
The data type of individual worksheet cells.
Syntax
WKSDATA(worksheetname)
Arguments
worksheetname
Specifies the name of an Oracle OLAP worksheet object, such as workunits.
Notes
Text Data
All textual data (as opposed to numeric, Boolean, date, and so on) in a worksheet has
the TEXT data type. The ID and NTEXT data types are not supported in worksheets.
Examples
REPORT workunits
-----------------WORKUNITS-----------------
------------------WKSCOL-------------------
WKSROW 1 2 3 4
-------------- ---------- ---------- ---------- ----------
1 NA Jan96 Feb96 Mar96
2 Tents 307 209 277
3 Canoes 352 411 488
4 Racquets 1,024 1,098 1,144
5 Sportswear 1,141 1,262 1,340
6 Footwear 2,525 2,660 2,728
This statement uses the WKSDATA function to produce the report following the
statement, which shows the data type of each cell in the worksheet.
REPORT WKSDATA(workunits)
------------WKSDATA(WORKUNITS)-------------
------------------WKSCOL-------------------
WKSROW 1 2 3 4
-------------- ---------- ---------- ---------- ----------
1 NA TEXT TEXT TEXT
2 TEXT INTEGER INTEGER INTEGER
3 TEXT INTEGER INTEGER INTEGER
4 TEXT INTEGER INTEGER INTEGER
5 TEXT INTEGER INTEGER INTEGER
6 TEXT INTEGER INTEGER INTEGER
WRITABLE
The WRITABLE function returns TRUE when the user has WRITE permission for the
object and FALSE when the user does not or when the object is not a variable,
worksheet object, relation, or valueset.
Return value
BOOLEAN
The result has the same dimensions as expression.
Syntax
WRITABLE (expression)
Arguments
expression
An expression that is the name or QDR of an object that has values (that is, a variable,
relation, valueset, or worksheet object).
YYOF
The YYOF function returns an INTEGER in the range of 1000 to 9999, giving the year in
which a specified date falls. The result returned by YYOF has the same dimensions as
the specified date expression.
Return Value
INTEGER
Syntax
YYOF(date-expression)
Arguments
date-expression
An expression that has the DATE data type, or a text expression that specifies a date.
The values of the text expression are converted automatically to DATE values, using
the current setting of the DATEORDER option to resolve any ambiguity.
Notes
Examples
When today's date is January 15, 1996, these statements produce the following output.
1996
Additionally, you can augment the functionality of the OLAP DML by writing an
OLAP DML program for use as a command.
A
ACQUIRE
ACROSS
AGGMAP
AGGMAP ADD or REMOVE model
AGGMAP SET
AGGREGATE command
ALLCOMPILE
ALLOCATE
ALLOCMAP
ALLSTAT
ARGUMENT
AW command
AWDESCRIBE
B
BLANK
BREAK
C
CALL
CDA
CHGDFN
CLEAR
COMMIT
COMPILE
CONSIDER
CONTEXT command
CONTINUE
COPYDFN
D
DATE_FORMAT
DBGOUTFILE
DEFINE
DELETE
DESCRIBE
DO ... DOEND
E
EDIT
EQ
EXPORT
F
FCCLOSE
FCEXEC
FCSET
FETCH
FILECLOSE
FILECOPY
FILEDELETE
FILEMOVE
FILEPAGE
FILEPUT
FILEREAD
FILESET
FILEVIEW
FOR
FORECAST
FORECAST.REPORT
FULLDSC
G
GOTO
GROUPINGID command
HEADING
H
HIDE
HIERDEPTH
HIERHEIGHT command
I
IF...THEN...ELSE command
I
IMPORT
INFILE
L
LD
LIMIT command
LIMIT BASEDIMS
LISTBY
LISTFILES
LISTNAMES
LOAD
LOG command
M
MAINTAIN
MODEL
MODEL.COMPRPT
MODEL.DEPRT
MODEL.XEQRPT
MONITOR
MOVE
O
OUTFILE
P
PAGE
PARSE
PERMIT
PERMITRESET
POP
POPLEVEL
PROGRAM
PROPERTY
PUSH
PUSHLEVEL
R
RECAP
REDO
REEDIT
REGRESS
REGRESS.REPORT
RELATION command
RELEASE
RENAME
REPORT
RESYNC
RETURN
REVERT
ROW command
S
SET
SET1
SHOW
SIGNAL
SLEEP
SORT command
SQL
STATUS
STDHDR
SWITCH command
T
TEMPSTAT
TRACKPRG
TRAP
TRIGGER command
TRIGGERASSIGN
U
UNHIDE
UPDATE
V
VARIABLE
VNF
W
WHILE
Z
ZEROTOTAL
Commands by Category
Aggregating Data
AGGMAP
AGGMAP ADD or REMOVE model
AGGMAP SET
AGGREGATE command
DEFINE AGGMAP
HIERDEPTH
HIERHEIGHT command
Allocating Data
ALLOCATE
ALLOCMAP
DEFINE AGGMAP
Debugging
DBGOUTFILE
LOG command
MONITOR
SIGNAL
TRACKPRG
TRAP
LOAD
PROPERTY
RELATION command
RENAME
TRIGGER command
UNHIDE
Dimension Status
ACROSS
ALLSTAT
LIMIT command
LIMIT BASEDIMS
STATUS
TEMPSTAT
Formatting Dates
DATE_FORMAT
VNF
Formulas
DEFINE FORMULA
EQ
Managing Files
CDA
FILECLOSE
FILECOPY
FILEDELETE
FILEMOVE
FILEPAGE
FILEPUT
FILEREAD
FILESET
FILEVIEW
IMPORT (text)
INFILE
LISTFILES
OUTFILE
Modeling Data
AGGMAP ADD or REMOVE model
DEFINE MODEL
DIMENSION (in models)
INCLUDE
MODEL
MODEL.COMPRPT
MODEL.DEPRT
MODEL.XEQRPT
SET
Programming
ALLCOMPILE
ARGUMENT
BREAK
BREAK
CALL
CONTINUE
CONTINUE
DEFINE PROGRAM
DO ... DOEND
FOR
GOTO
HIDE
IF...THEN...ELSE command
PARSE
PROGRAM
RETURN
SLEEP
SWITCH command
TRIGGER command
TRIGGERASSIGN
UNHIDE
VARIABLE
WHILE
Reporting
BLANK
HEADING
PAGE
REPORT
ROW command
SHOW
STDHDR
ZEROTOTAL
Sorting Values
MOVE
SORT command
ACQUIRE
Syntax
ACQUIRE {acquired_noresync_objects] | RESYNC [CASCADE] resync_objects [WAIT] } -
[CONSISTENT WITH [CASCADE] consistency_objects [WAIT]]
where resync_objects has the following syntax:
resynch_objname [FOR DELETE | [WITH [CASCADE]|WITHOUT] RELATIONS]] , ...
Arguments
acquired_noresync_objects
A list of one or more variables, relations, valuesets, or dimension names, separated by
commas, that you want to access in read/write mode without resynchronizing.
Acquiring objects in this manner preserves all read-only changes made to the objects.
You can update variables and dimensions acquired in this manner using an UPDATE
statement.
RESYNC
Specifies acquisition in read/write mode of the latest generation of the specified
objects with all private changes discarded.
CASCADE
resync_objname
The name of a a variable, relations, valueset, or dimension name that you want to
access in read/write mode and resynchronize.
WAIT
When you do not specify WAIT, the ACQUIRE statement fails when another user has
acquired any of the objects in resync_objects in read/write mode. When you specify
WAIT, Oracle OLAP waits until all objects in resync_objects it can be acquired in
read/write mode or the wait times out.
CONSISTENT WITH
Specifies that additional objects are to be accessible in read-only mode.the behavior of
the ACQUIRE statement when a specified object is already acquired by another user
and resynchronizes the specified objects when the ACQUIRE statement succeeds.
consistency_objects [WAIT]
A list of one or more a list of one or more variables, relations, valuesets, or dimension
names, separated by commas, that you want to acquire in read-only mode.
When you do not specify WAIT, the ACQUIRE statement fails when any of the objects
in the consistency_objects are acquired in read/write mode by another user. When you
specify the WAIT keyword, Oracle OLAP waits to execute the ACQUIRE statement
Notes
Understanding Consistency
To some extent you can think of an ACQUIRE statement with a CONSISTENT WITH
phrase as a combination of ACQUIRE and RELEASE statements.
ACQUIRE [avar...] RESYNC [rvar ...] cvar ... [WAIT]
RELEASE cvar ...
Examples
RELEASE actuals
AW DETACH myworkspace
However, when the first acquire does not succeed, however, the users try again to
acquire budget in resynchronized mode (possibly requesting a wait). When the
resynchronized acquisition succeeds, they re-create the changes (since some relevant
numbers might have changed) and then proceed to update and commit their analytic
workspace. The following OLAP DML statements show this scenario.
AW ATTACH myworkspace MULTI
... perform what-if computations
ACQUIRE budget
...maybe make some additional final changes
UPDATE MULTI budget
COMMIT
RELEASE budget
AW DETACH myworkspace
AW ATTACH myworkspace MULTI
...perform what-if computations
ACQUIRE budget --> failed
ACQUIRE RESYNC budget WAIT
...determine that the changes are still needed
...make changes to make permanent
UPDATE MULTI budget
COMMIT
RELEASE budget
AW DETACH myworkspace
ACROSS
The ACROSS command specifies a text expression that contains one or more
statements to be executed in a loop. ACROSS temporarily sets status to the values that
are in current status for the specified dimensions. After the ACROSS statement
executes, dimension status is restored to what it was before the loop, and execution of
the program resumes with the next statement. The repetition of the statements in the
DO clause statements is controlled by the status of the dimensions and composites
specified in the ACROSS statement.
Syntax
ACROSS dimension... DO dml-statements
Arguments
dimension
One or more dimensions or composites whose current status controls the repetition of
one or more statements, which are contained in dml-statements. The statements are
repeated for each combination of the values of the specified dimensions in the current
status. When two or more dimensions are specified, the first one varies the slowest.
DO dml-statements
A multiline text expression that is one or more OLAP DML statements to be executed
for each iteration of the loop. You can specify any OALAP DML statement except one
that is typically used as part of a multiple-line construct in a program. For example,
the IF...THEN...ELSE, WHILE, FOR, or SWITCH commands cannot be executed by an
ACROSS statement.
Notes
Examples
Jan95 533363
Feb95 572796
Mar95 707198
AGGMAP
(Note that there are two other OLAP DML statements that are also sometimes referred
to as "AGGMAP statements": AGGMAP ADD or REMOVE model statement that you
can use to add or remove a model from an aggmap object of type AGGMAP, and
AGGMAP SET that you can use to specify the default aggmap for a variable.)
Syntax
AGGMAP [specification]
Arguments
specification
A multiline text expression that is the aggregation specification for the current aggmap
object. Each statement is a line of the multiline text expression. When coding an
AGGMAP command at the command line level, separate statements with newline
delimiters (\n), or use JOINLINES.
An aggregation specification begins with AGGMAP and ends with an END. Between
these statements, you code one or more the following statements depending on the
calculation that you want to specify. Minimally, you must code one RELATION (for
aggregation) statement.
AGGINDEX
BREAKOUT DIMENSION
CACHE
DIMENSION (for aggregation)
DROP DIMENSION
MEASUREDIM (for aggregation)
MODEL (in an aggregation)
PRECOMPUTE
RELATION (for aggregation)
Notes
Examples
You now need to create and add a specification to the aggmap, which will specify the
data that should be aggregated. This example shows you how to use an input file,
which contains OLAP DML statements that define the aggmap and add a specification
to it:
1. Identify the name of each dimension's hierarchy. When you have defined the
hierarchies as self-relations, you use the names of the self-relations.
2. Decide which data to aggregate.
Suppose you want to calculate data for all levels of the time and product
dimensions, but not for geography. The geography dimension's lowest level of
data is at the city level. The second level of the hierarchy has three dimension
values that represent regions: East, Central, and West. The third level of the
hierarchy has one dimension value: Total.
Suppose that you want to pre-calculate the data for East and store it in the
analytic workspace. You want the data for Central, West, and Total to be
calculated only when users request that data — that data will not be stored in the
analytic workspace. Therefore, you need to specify this information in the
specification that you add to your aggmap object.
3. Create an ASCII text file named units.txt. Add the following OLAP DML
statements to your text file.
DEFINE units.agg AGGMAP <time, SPARSE <product, geography>>
AGGMAP
RELATION myti.parent
RELATION mypr.parent
RELATION myge.parent PRECOMPUTE ('East')
END
The preceding statements define an aggmap named units.agg, then add the
three RELATION statements to the aggregation specification when you read the
units.txt file into your analytic workspace.
4. To read the units.txt file into your analytic workspace, execute the following
statement.
INFILE 'inf/units.txt'
5. The units.agg aggmap should now exist in your analytic workspace. You can
aggregate the units variable with the following statement.
AGGREGATE units USING units.agg
Now the data for East for all times and products has been calculated and stored
in the analytic workspace.
6. Set up the analytic workspace so that when a user requests data for Central,
West, or Total, that data will be calculated and displayed. It is generally a good
idea to compile the aggmap object before using it with the AGGREGATE function,
as shown by the following statement.
COMPILE units.agg
This is not an issue when you are just using the AGGREGATE command, because
this statement compiles the aggmap object before it uses it. However, when you
do not use the FUNCDATA keyword with the AGGREGATE command, the
metadata that is needed to perform calculation on the fly has not been compiled
yet. As long as you have performed all other necessary calculations (such as
calculating models), it is a good practice to compile the aggmap when you load
data. When you fail to do so, that means that every time a user opens the analytic
workspace, that user will have to wait for the aggregation to be compiled
automatically. In other words, when any data will be calculated on the fly, you can
improve query performance for all of your users by compiling the aggmap before
making the analytic workspace available to your users.
7. Add a property to the units variable.
CONSIDER units
PROPERTY '$NATRIGGER' 'AGGREGATE(units USING units.agg)'
This property indicates that when a data cell contains an NA value, Oracle OLAP
will call the AGGREGATE function to aggregate the data for that cell. Therefore,
any units data that is requested by a user will be displayed. However, only the
data for the East dimension value of the geography dimension has actually been
aggregated and stored in the analytic workspace. All other data (for Central,
West, and Total) is calculated only when users request it.
Suppose you want to use one AGGREGATE command to aggregate all four variables.
The debt variable requires additive aggregation. The sales variable requires a
weighted sum aggregation, and interest_rate requires a hierarchical weighted
average. Therefore, sales and interest_rate will each require a weight object,
which you need to define and populate with weight values. inventory requires a
result that represents the total inventory, which is the last value in the hierarchy.
You will specify the aggregation operation for debt and inventory with the
OPERATOR keyword. However, because sales and interest_rate have
aggregation operations that require weight objects, you must use the ARGS keyword
to specify their operations. You define an operator variable to use the OPERATOR
keyword. Typically, the operator variable is dimensioned by a measure dimension or a
line item dimension.
Here are the steps to define the aggregation you want to occur:
2. Define an operator variable named opvar and populate it.The statements specify
that the aggregation for debt should use the SUM operator, and the aggregation
for inventory should use the HLAST operator.
DEFINE opvar TEXT <measure>
opvar (measure 'sales') = 'WSUM'
opvar (measure 'debt') = 'SUM'
opvar (measure 'interest_rate') = 'HWAVERAGE'
opvar (measure 'inventory') = 'HLAST'
3. Because sales and interest_rate require weight objects, define and populate
those weight objects. The following statement defines a weight object named
currency (to be used by sales).
DEFINE currency DECIMAL <time geography>
Notice that the currency variable is dimensioned only by time and geography.
The purpose of this variable is to provide weights that act as currency conversion
information for foreign countries; therefore, it is unnecessary to include the
product dimension.
4. Populate currency with the weight values that you want to use.
5. The interest_rate variable's nonaddictive aggregation (hierarchical weighted
average) requires the sum of the variable debt. In other words, interest_rate
cannot be aggregated without the results of the aggregation of debt.
You can now define an argument variable, which you will need to specify the
aggregation results of debt as a weight object for interest_rate. You will use
the same argument variable to specify currency as the weight object for the
sales variable. The following statement defines an argument variable named
argvar.
DEFINE argvar TEXT <measure>
7. For the aggregation of product and geography, the data for the sales, debt,
and interest_rate variables can simply be added. But the inventory variable
requires a hierarchical weighted average. This means that it is necessary to define
a second operator variable and a second argument variable, both of which will be
used in the RELATION statement for product and geography.
The following statements define the second operator variable and populate it.
DEFINE opvar2 TEXT <measure>
opvar (measure 'sales') = 'Sum'
opvar (measure 'debt') = 'Sum'
opvar (measure 'interest_rate') = 'Sum'
opvar (measure 'inventory') = 'HWAverage'
The following statements define the second argument variable and populate it.
DEFINE argvar2 TEXT <measure>
argvar (measure 'sales') = NA
argvar (measure 'debt') = NA
argvar (measure 'interest_rate') = NA
argvar (measure 'inventory') = 'weightby debt'
To include the sales.agg aggmap in your analytic workspace, execute the following
statement, where inf is the alias for the directory where the file is stored.
INFILE 'inf/salesagg.txt'
The sales.agg aggmap has now been defined and contains the three RELATION
statements and the CACHE statement. In this example, you are specifying that all of
the data for the hierarchy for the time dimension, time.r, should be aggregated,
except for any data that has a time dimension value of Year99. All of the data for the
hierarchy for the product dimension, product.r, should be aggregated, except for
any data that has a product dimension value of All. All geography dimension
values are aggregated. The CACHE STORE statement specifies that any data that are
rolled up on the fly should be calculated just once and stored in the cache for other
access requests during the same session.
You can now use the sales.agg aggmap with an AGGREGATE command, such as.
AGGREGATE sales USING sales.agg
In this example, any data value that dimensioned by a Year99 value of the time
dimension or an All value of the product dimension is calculated on the fly. All
other data is aggregated and stored in the analytic workspace.
2. Define the second aggmap, named forecast.agg2, which aggregates the data
generated using the first aggmap and the forecast. It contains the following
statement.
RELATION division.parentrel PRECOMPUTE ('L3')
When your forecast is in a program named fore.prg, then you would use the
following statements to aggregate the data.
AGGREGATE budget USING forecast.agg1 "Aggregate over LINE
CALL fore.prg "Forecast over TIME
AGGREGATE budget USING forecast.agg2 "Aggregate over DIVISION
"Compile the limit map for LINE and DIVISION
COMPILE forecast.agg3
"Use the combined aggmap for the AGGREGATE function
CONSIDER budget
You do not want to precompute and commit all of the sales data to the database,
because disk space is limited and you need to improve performance. Therefore, you
need to create an aggmap, in which you specify which data should be pre-computed
and which data should be calculated on the fly.
You define the aggmap, named sales.agg, with the following statement.
DEFINE sales.agg AGGMAP <time, SPARSE<product, channel, customer>>
Next, you use an AGGMAP statement to enter the following specification for
sales.agg.
RELATION time.r PRECOMPUTE (time NE 'Year99')
RELATION product.r PRECOMPUTE (product NE 'All')
RELATION channel.r
RELATION customer.r
AGGINDEX NO
This aggregation specification tells Oracle OLAP that all sales data should be rolled
up committed to the Database with the exception of any data that has a time
dimension value of Year99 or a product dimension value of All—the data for those
cells is calculated the first time a user accesses them. The AGGINDEX value of NO tells
Oracle OLAP not to create the indexes for data that should be calculated on the fly.
Now you execute the following statement.
sales2 = AGGREGATE(sales1 USING sales.agg) ACROSS SPARSE -
<product, channel, customer>
sales2 now contains all of the data in sales1, plus any data that is aggregated for
Year99—this is because time is not included in a composite.
On the other hand, the data that is aggregated for the product value of All is not
computed and stored in sales2. This is because the product dimension is included
in a composite—the indexes that are required for dimensions that are included in
composites were not created because the aggregation specification contains an
AGGINDEX NO statement. Since the indexes did not exist, Oracle OLAP never called the
AGGREGATE function to compute the data to be calculated on the fly.
Rick M 33 22,000.00
You want to aggregate the detail sales data over sex and age to calculate the amount of
sales you have made to males and females, and the amount of sales for different age
ranges. To hold this data you will need an INTEGER variable that is dimensioned by
hierarchical dimensions for sex and age. You will also need an aggmap object that
specifies the calculations that Oracle OLAP will perform to populate this variable from
the data in the sales variable.
To create and populate the necessary objects, you take the following steps:
1. Create and populate dimensions and self-relations for hierarchical dimensions
named sex and age.
DEFINE sex DIMENSION TEXT
DEFINE sex.parentrel RELATION sex <sex>
DEFINE age DIMENSION TEXT
DEFINE age.parentrel RELATION age <age>
AGE AGE.PARENTREL
-------------- --------------------
0-20 All
21-30 All
31-50 All
51-100 All
No Response All
All NA
SEX SEX.PARENTREL
-------------- --------------------
M All
F All
No Reponse All
All NA
2. Create and populate relations that map the age and sex dimensions to the
customer dimension.
DEFINE customer.age.rel RELATION age <customer>
DEFINE customer.sex.rel RELATION sex <customer>
Notice that the specification for the ssa_aggmap includes the following
statements:
■ A BREAKOUT DIMENSION statement that specifies how to map the
customer dimension of the sales variable to the lowest-level values of the
sales_by_sex_age variable. This statement specifies the name of the
dimension of the variable that contains the detail values (that is, customer)
and the names of the relations (customer.sex.rel and
customer.age.rel) that define the relations between customer dimension
and the sex and age dimensions.
■ Two RELATION statements that specify how to aggregate up the sex and
age dimensions of the sales_by_sex_age variable. Each of these
statements includes the name of the child-parent relation (sex.parentrel or
age.parentrel) that define the self-relation for the hierarchal dimension
(sex or age).
5. Populate the sales_by_sex_age variable by issuing an AGGREGATE
command that specifies that the detail data for the aggregation comes from the
sales variable.
AGGREGATE sales_by_sex_age USING ssa_aggmap FROM sales
You do not want to pre-compute and commit all of the sales data, because space is
limited and you need to improve performance. Therefore, you need to create an
aggmap, in which you will specify which data should be pre-computed and which
data should be calculated on the fly.
You define the aggmap, named sales.agg, with the following statement.
DEFINE sales.agg AGGMAP <time, SPARSE<product, channel, - customer>>
Next, you use the AGGMAP statement to enter the following aggregation specification
forsales.agg.
AGGMAP
RELATION time.r PRECOMPUTE (time NE 'YEAR99')
RELATION product.r PRECOMPUTE (product NE 'ALL')
RELATION channel.r
RELATION customer.r
CACHE SESSION
END
This aggregation specification tells Oracle OLAP that all sales data should be rolled
up and committed, with the exception of any cells that have a time dimension value of
Year99 or a product dimension value of ALL; the data for those cells will be
calculated the first time a user accesses them. Because the CACHE statement uses the
SESSION keyword, that means that when those cells are calculated on the fly, the data
is stored in the cache for the remainder of the Oracle OLAP session. That way, the next
time a user accesses the same cell, the data will not have to be calculated again.
Instead, the data will be retrieved from the session cache.
Example 9–13 Populating All Levels of a Hierarchy Except the Detail Level
Assume that your analytic workspace contains the relations and dimensions with the
following definitions.
DEFINE geog.d TEXT DIMENSION
DEFINE geog.r RELATION geog.d <geog.d>
DEFINE sales_by_units INTEGER VARIABLE <geog.d>
DEFINE sales_by_revenue DECIMAL VARIABLE <geog.d>
DEFINE price_per_unit DECIMAL VARIABLE <geog.d>
Assume that you create two aggmap objects. One aggmap object, named units_
aggmap, is the specification to aggregate data in the sales_by_units variable. The
other aggmap object, revenue_aggmap, is the specification to calculate all of the data
except the detail data in the sales_by_revenue variable.
DEFINE units_aggmap AGGMAP
AGGMAP
RELATION geog.r OPERATOR SUM
END
2. After the data for the sales_by_unit variable is aggregated, the sales_by_
unit and sales_by_revenue variables have the following values.
AGGREGATE sales_by_unit USING units_aggmap
3. After the data for the sales_by_revue variable is aggregated, the sales_by_
unit and sales_by_revenue variables have the following values.
AGGREGATE sales_by_revenue USING revenue_aggmap FROM units_aggmap
-----------------------SALES-----------------------
---------------------DISTRICT----------------------
TIME North South West East
------------ ------------ ------------ ------------ ------------
1976Q1 168,776.81 362,367.87 219,667.47 149,815.65
1976Q2 330,062.49 293,392.29 237,128.26 167,808.03
1976Q3 304,953.04 354,240.51 170,892.80 298,737.70
1976Q4 252,757.33 206,189.01 139,954.56 175,063.51
1976 NA NA NA NA
Assume also that you want to calculate the total sales for each quarter and year for all
districts except the North district. To perform this calculation using an aggmap object,
you take the following steps:
1. Create a valueset named not_north that represents the values of district for
which you want to aggregate data.
DEFINE not_north VALUESET district
LIMIT not_north TO ALL
LIMIT not_north REMOVE 'North'
3. Define an aggmap object that specifies the calculation that you want performed.
DEFINE agg_sales_exclud_north AGGMAP
AGGMAP
RELATION time.parentrel OPERATOR SUM
DROP DIMENSION district OPERATOR SUM VALUES not_north
END
Notice that the aggregation specification consists of two statements that specify
how to perform the aggregation:
■ A RELATION statement that specifies how to aggregate up the hierarchical
time dimension
■ A DROP DIMENSION statement that specifies how to aggregate across the
non-hierarchical district dimension. In this case, the DROP DIMENSION
also uses the not_north valueset to specify that values for the North district
are excluded when performing the aggregation
4. Aggregate the data.
AGGREGATE total_sales_exclud_north USING agg_sales_exclud_north FROM sales
The time dimension has two hierarchies (Standard and YTD) and a parent relation
named time.parentrel as follows.
-----TIME.PARENTREL------
----TIME.HIERARCHIES-----
TIME Standard YTD
-------------- ------------ ------------
Last.YTD NA NA
Current.YTD NA NA
Jan01 Q1.01 Last.YTD
...
Dec01 Q4.01 Last.YTD
Jan02 Q1.02 Current.YTD
Feb02 Q1.02 Current.YTD
Mar02 Q1.02 Current.YTD
Apr02 Q2.02 Current.YTD
May02 Q2.02 Current.YTD
Q1.01 2001 NA
...
Q4.01 2001 NA
Q1.02 2002 NA
Q2.02 2002 NA
2001 NA NA
2002 NA NA
The relationships among line items are defined in the following model.
DEFINE income.budget MODEL
MODEL
DIMENSION line time
opr.income = gross.margin - marketing
gross.margin = revenue - cogs
revenue = LAG(revenue, 12, time) * 1.02
cogs = LAG(cogs, 1, time) * 1.01
marketing = LAG(opr.income, 1, time) * 0.20
END
The following aggregation specification pre-aggregates all of the data. Notice that all
of the data must be pre-aggregated because the model includes both LAG functions
and a simultaneous equation.
DEFINE budget.aggmap1 AGGMAP
AGGMAP
MODEL income.budget
RELATION time.parentrel
END
The aggregation specification for sales might include RELATION statements like the
following.
AGGMAP
RELATION time.r PRECOMPUTE ('Yr98', 'Yr99')
RELATION product.r
RELATION geography.r PRECOMPUTE (geography NE 'Atlanta')
END
The AGGREGATE command will aggregate values for Yr98 and Yr99, over all of
products, and over all geographic areas except for Atlanta. All other aggregates are
calculated on the fly.
You can then use the valueset in the following RELATION statement. Because the
Fiscal hierarchy is the last hierarchy in the valueset, the data that is aggregated will be
accurate for the Fiscal hierarchy.
RELATION time.r(time.vs) PRECOMPUTE ('Yr99', 'Yr00')
Example 9–19 Aggregating with a RELATION Statement That Uses an ARGS Keyword
You can list the arguments in a RELATION statement directly in the statement or as
the value of a text variable. For example, the following statement specifies WEIGHTBY
wobj as an argument.
RELATION time.r OPERATOR wsum ARGS WEIGHTBY wobj
Alternatively, you can define an variable for the argument whose value is the text of
the WEIGHTBY clause.
DEFINE argvar TEXT
argvar = 'WEIGHTBY wobj'
Then the RELATION statement can specify the text variable that contains the
WEIGHTBY clause.
RELATION time.r OPERATOR WSUM ARGS argvar
You can then use a MAINTAIN statement to add dimension values to the measure
dimension.
MAINTAIN measure ADD 'sales', 'units', 'quota', 'inventory'
Use the measure dimension to dimension a text variable named meas.opvar that
you will use as the operator variable.
DEFINE meas.opvar TEXT WIDTH 2 <measure>
The aggregation specification might look like the following. Note that when you
specify an operator variable in a RELATION statement, you must include a
MEASUREDIM statement that specifies the name of the measure dimension (measure
in the following example) in the aggregation specification.
DEFINE opvar.aggmap AGGMAP
AGGMAP
RELATION geography.parentrel PRECOMPUTE (geography.lvldim 2 4)
RELATION product.parentrel OPERATOR opvar
RELATION channel.parentrel OPERATOR opvar
RELATION time.parentrel OPERATOR opvar
MEASUREDIM measure
END
You want to use different methods to calculate different line items. You create a text
variable that you will use as the operator variable.
DEFINE line.opvar TEXT WIDTH 2 <line>
You then populate line.opvar with the appropriate operator for each line item, for
example.
line.opvar (line 'Net.Income') = 'SU'
line.opvar (line 'Tax.Rate') = 'AV'
First, consider the hierarchy for each dimension. How many levels does each hierarchy
have? What levels of data do users typically query? When you are designing a new
workspace, what levels of data do your users plan to query?
Suppose you learn the information described in the following table about how users
tend to query sales data for the time hierarchy.
While the next table shows how your users tend to query sales data for the
geography hierarchy.
Finally, the next table shows how your users tend to query sales data for the
product dimension hierarchy.
Using this information about how users query data, you should use the following
strategy for aggregation:
■ Fully aggregate time and product because all levels are queried frequently.
■ For the geography dimension, aggregate data for L1 (World) and L3 (Country)
because they are queried frequently. However, L2 is queried less often and so can
be calculated on the fly.
The lowest level of data was loaded into the analytic workspace. The aggregate data is
calculated from this source data.
Therefore, the aggregation specification might look like the following.
RELATION time.parentrel
RELATION geography.parentrel PRECOMPUTE (geog.leveldim 'L3' 'L1')
RELATION product.parentrel
AGGINDEX
Syntax
AGGINDEX {YES|NO}
Arguments
YES
(Default) Tells the AGGMAP compiler to make sure that all possible indexes are
created whenever an aggmap is recompiled. In other words, indexes are created both
for the data that is being pre-calculated and the data that is calculated on the fly. This
happens when you use a COMPILE statement to compile the aggmap, as well as when
the AGGREGATE command automatically compiles an aggmap whose specification
has changed since the last time it was compiled. The creation of all possible indexes
results in a longer compilation time but faster execution of the AGGREGATE function.
For a discussion of when AGGINDEX should be set to YES, see "When You Should
Use an AGGINDEX Value of YES" on page 9-32.
NO
Does not create the indexes for data that is calculated on the fly. Omitting the creation
of these index values accelerates the compilation time, but causes Oracle OLAP to treat
the uncomputed data as NA data whenever the MODEL statement in an AGGMAP or
an ACROSS phrase is executed. For a discussion of when AGGINDEX should be set to
NO, see "When You Should Use an AGGINDEX Value of NO" on page 9-33.
Notes
When you have created an $NATRIGGER property for a variable that calls the
AGGREGATE function, the variable appears to have been fully precomputed. That
means that when any NA value is encountered, the NA trigger is called during the
execution of an ACROSS phrase or the MODEL statement in an AGGMAP. When the
NA trigger is called, the AGGREGATE function is executed, and the data is calculated
on the fly.
When AGGINDEX has a value of NO, then the NA trigger is called only to aggregate
data for dimensions that are not included in a composite. Data for dimensions that are
included in composites is interpreted as NA values.
For example, suppose you have two variables called sales1 and sales2, which are
defined with the following definitions.
DEFINE sales1 DECIMAL <time, SPARSE <product, geography>>
DEFINE sales2 DECIMAL <time, SPARSE <product, geography>>
Now suppose you have an aggmap object named sales.agg, which has the
following definition.
DEFINE sales.agg AGGMAP <time, SPARSE <product, geography>>
When you add a specification to the sales.agg aggmap, you enter RELATION
statements for time, product and geography with PRECOMPUTE clauses that
specify NA. This specifies that no data is aggregated—instead, all of the data for any
variable that uses this aggmap is calculated on the fly.
RELATION time.r PRECOMPUTE (NA)
RELATION product.r PRECOMPUTE (NA)
RELATION geography.r PRECOMPUTE (NA)
Consider the effect of AGGINDEX in the following statement. Because you did not
enter an AGGINDEX statement in the sales.agg aggregation specification, the
default of AGGINDEX YES is assumed.
sales2 = sales1 ACROSS SPARSE <product, geography>
This statement loops over the data in sales1 and copies the values into sales2. This
statement causes the NA trigger to call the AGGREGATE function for all of the data
that you have specified to be calculated on the fly in sales1. This means that after the
aggregation that sales2 contains a copy of sales1 plus all the aggregate data cells
(the cells that would have been calculated if the sales1 data had been completely
precomputed, meaning, fully rolled up).
However, when you put an AGGINDEX NO statement in the sales.agg aggregation
specification, then sales2 contains a copy of the data in sales1 and the aggregate
data cells for the time dimension.
Note that in both cases, $NATRIGGER is called to aggregate time data, because the
time dimension is not included in the composite, so the value of AGGINDEX has no
effect on it.
Examples
For an example of using an AGGINDEX statement, see Example 9–10, "Using an
AGGINDEX Statement in an Aggregation Specification" on page 9-21.
BREAKOUT DIMENSION
Syntax
BREAKOUT DIMENSION dimname BY relationname [, relationname...] -
OPERATOR operation [ARGS argument]
where argument specifies the settings of various options and is one or more of the
following phrases:
DIVIDEBYZERO {YES|NO}
DECIMALOVERFLOW {YES|NO}
NASKIP {YES|NO}
WEIGHTBY [WNAFILL {number | NA}] wobj
Arguments
dimname
The name of a dimension in the variable that contains the detail data (that is, the
source variable).
relationname
The name of a relation whose values relate a dimension of the target variable to
dimname.
OPERATOR
Identifies the calculation method used to aggregate the data.
operation
A keyword that describes the type of aggregation to perform. The keywords are listed
in Table 9–1, " Aggregation Methods" on page 9-48.
ARGS
Indicates optional handling of the aggregation.
DIVIDEBYZERO
Specifies whether to allow division by zero.
YES allows division by zero; a statement involving division by zero executes without
error but produces NA results.
NO disallows division by zero; a statement involving division by zero stops executing
and produces an error message.
The default value is the current value of the DIVIDEBYZERO option.
DECIMALOVERFLOW
Specifies whether to allow decimal overflow, which occurs when the result of a
calculation is very large and can no longer be represented by the exponent portion of
the numerical representation. Specify YES to allow overflow, which means that a
calculation that generates overflow executes without error and produces NA results.
NASKIP
Specifies whether NA values are input. Specify YES when you want Oracle OLAP to
ignore NA values when aggregating which means that only actual values are used in
calculations. Specify NO when you want Oracle OLAP to consider NA values are
considered which means that when any of the values being considered are NA, the
calculation returns NA.The default value is the current value of the NASKIP option.
The value that you specify for the NASKIP phrase does not effect calculation
performed when you specify HAVERAGE, HFIRST, HLAST, HWAVERAGE,
HWFIRST, HWLAST for operation.
WEIGHTBY
Indicates that weighted aggregation is to be performed. You must include a
WEIGHTBY clause when you specify HWAVERAGE, HWFIRST, HWLAST, SSUM,
WAVERAGE, WFIRST, WLAST, or WSUM for operation. The WEIGHTBY phrase
always includes a wobj argument and can optionally include the WNAFILL keyword.
For more information about the use of the WEIGHTBY phrase, see RELATION (for
aggregation) statement of the AGGMAP command.
WNAFILL
Indicates handling for NA values. The default values for WNAFILL vary depending on
the value of operation.
number
Substitutes a number for every NA value. That number will replace every NA value in
the weight object, weight formula, or weight relation. The default for HWAVERAGE
and SSUM is The default for HWFIRST, HWLAST, WAVERAGE, WFIRST, WLAST,
and WSUM is 1.0 .
NA
Specifies that NA values are to be specified as NA. NA is the default for OR.
For more information about using the WNAFILL phrase, see RELATION (for
aggregation) statement of the AGGMAP command.
wobj
A variable, formula, or relation that provides the weighted values. It can be numeric or
BOOLEAN. When wobj is BOOLEAN, then TRUE has a weight of 1.0 and FALSE has a
weight of 0.0. A formula is queried only when needed, depending on the
dimensionality of the formula and the of the variable being aggregated. When wobj is a
relation, it should be a one-dimensional self-relation. For more information about
specifying values for wobj, see RELATION (for aggregation) statement of the
AGGMAP command.
Examples
For an example of using the BREAKOUT DIMENSION statement, see Example 9–11,
"Aggregating By Dimension Attributes" on page 9-21.
CACHE
Syntax
CACHE {NOSTORE|NONE|STORE|SESSION|DEFAULT} [LEAF|NOLEAF] [NA|NONA]
Arguments
NONE
NOSTORE
For data that is calculated using the AGGREGATE function, specifies that Oracle
OLAP calculates the data each time the AGGREGATE function executes. When you
specify either of these keywords, Oracle OLAP does not store or cache the data
calculated by the AGGREGATE function.
STORE
For data that is calculated using the AGGREGATE function, specifies that Oracle
OLAP stores data calculated by the AGGREGATE function in the variable in the
Database. When you specify this option, the results of the aggregation are
permanently stored in the variable when the analytic workspace is updated and
committed.
SESSION
For data that is calculated using the AGGREGATE function, specifies that Oracle
OLAP caches data calculated by the AGGREGATE function in the session cache (see
"What is an Oracle OLAP Session Cache?" on page 6-148). When you specify this
option, the results of the aggregation are ignored during updates and commits and are
discarded at the end of the session.
Note: When SESSCACHE is set to NO, Oracle OLAP does not cache
the data even when you specify SESSION. In this case, specifying
SESSION is the same as specifying NONE.
DEFAULT
(Default) For data that is calculated using the AGGREGATE function, specifies that
Oracle OLAP uses the value of the VARCACHE option to determine what to do with
data that is calculated by the AGGREGATE function. See "How Oracle OLAP
Determines Whether to Store or Cache Aggregated Data" on page 5-29.
LEAF
When the variable data is aggregated using detail data from another variable, specifies
that Oracle OLAP calculates the leaf data for the variable.
NOLEAF
(Default) When the variable data is aggregated using detail data from another
variable, specifies that Oracle OLAP does not calculate the leaf data for the variable.
NA
For data that is calculated using the AGGREGATE function, specifies that Oracle
OLAP places any NA values that are the results of the execution of the AGGREGATE
function in the Oracle OLAP session cache. In this case, when there is a variable has an
$NATRIGGER property with an AGGREGATE function as its expression, Oracle
OLAP does not recalculate the values for the variable. (For more information on the
caching NA values, see "How Oracle OLAP Determines Whether to Store or Cache
Results of $NATRIGGER" on page 5-29.)
NONA
For data that is calculated using the AGGREGATE function, specifies that Oracle
OLAP does not cache any NA values that are the results of the execution of the
AGGREGATE function. In this case, when a variable has an $NATRIGGER property
with an AGGREGATE function as its expression, Oracle OLAP recalculates the values
for the variable.
Notes
Frequently you do not want the data that is calculated using the AGGREGATE
function to be stored permanently in the Database since that would defeat the purpose
of calculating data on the fly.
■ To ensure that the aggregated values cannot be permanently committed to the
Database, use SESSION.
■ Use STORE when you know either of the following is true which also ensures that
the data that is calculated on the fly using the AGGREGATE function will not be
committed to the Database:
■ The users of the analytic workspace can only open it as read-only
■ You know that the users of the analytic workspace will not or cannot issue
UPDATE and COMMIT statements.
Note: You should use STORE with caution when it is likely that your
users modify pre-computed data, and they access data that you have
specified to be calculated on the fly using the AGGREGATE function.
The problem is that any data that is calculated using the
AGGREGATE function before the user's modification will not reflect
the user's change unless the user made the change using an
AGGREGATE function with the FORCECALC keyword or unless
there is an $AGGREGATE_FORCECALC property on the variable
being aggregated
Examples
For examples of using a CACHE statement in an aggregation specification, see
Example 9–12, "Using a CACHE Statement in an Aggregation Specification" on
page 9-23 and Example 9–13, "Populating All Levels of a Hierarchy Except the Detail
Level" on page 9-24.
Syntax
DIMENSION dimension 'dimval '
Arguments
dimension
the name of the dimension that you want to limit.
dimval
A TEXT expression that is the single value of the dimension to which you want the
status of the dimension set for the duration of an aggregation.
DROP DIMENSION
Syntax
DROP DIMENSION dimname [VALUES {valsetname|ALL} OPERATOR operation [ARGS argument]
where argument is one or more of the following phrases:
DIVIDEBYZERO {YES|NO}
DECIMALOVERFLOW {YES|NO}
NASKIP {YES|NO}
WEIGHTBY [WNAFILL {number|NA}] wobj
Arguments
dimname
The name of a dimension in the source variable that contains the detail data.
VALUES
Sets the status of dimname during the aggregation.
valsetname
The name of a valueset object that determines the status of the dimension specified by
dimname.
ALL
Specifies that all of the values of dimname are in status.
OPERATOR
Identifies the calculation method used to aggregate the data.
operation
A keyword that describes the type of aggregation to perform. The keywords are listed
in Table 9–1, " Aggregation Methods" on page 9-48.
ARGS
Indicates optional handling of the aggregation.
DIVIDEBYZERO
Specifies whether to allow division by zero. Specify YES to allow division by zero
which means that a statement involving division by zero executes without error but
produces NA results. Specify NO to disallow division by zero which means that a
statement involving division by zero stops executing and produces an error message.
The default value is the current value of the DIVIDEBYZERO option.
DECIMALOVERFLOW
Specifies whether to allow decimal overflow, which occurs when the result of a
calculation is very large and can no longer be represented by the exponent portion of
the numerical representation. Specify YES to allow overflow, which means that a
calculation that generates overflow executes without error and produces NA results.
Specify NO to disallow overflow which means that a calculation involving overflow
stops executing and generates an error message. The default value is the current value
of the DECIMALOVERFLOW option.
NASKIP
Specifies whether NA values are input. Specify YES when you want Oracle OLAP to
ignore NA values when aggregating which means that only actual values are used in
calculations. Specify NO when you want Oracle OLAP to consider NA values when
aggregating which means that when any of the values being considered are NA, the
calculation returns NA. The default value is the current value of the NASKIP option.
The value that you specify for the NASKIP phrase does not effect calculation
performed when you specify HAVERAGE, HFIRST, HLAST, HWAVERAGE,
HWFIRST, HWLAST for operation.
WEIGHTBY
Indicates that weighted aggregation is to be performed. You must include a
WEIGHTBY clause when you specify HWAVERAGE, HWFIRST, HWLAST, SSUM,
WAVERAGE, WFIRST, WLAST, or WSUM for operation. The WEIGHTBY phrase
always includes a wobj argument and can optionally include the WNAFILL keyword.
For more information about the use of the WEIGHTBY phrase, see the RELATION (for
aggregation) statement of the AGGMAP command.
WNAFILL
Indicates handling for NA values. The default values for WNAFILL vary depending on
the value of operation. For more information about using the WNAFILL phrase, see
the RELATION (for aggregation) statement of the AGGMAP command.
number
Substitutes a number for every NA value. That number will replace every NA value in
the weight object, weight formula, or weight relation.
■ 0.0 is the default for HWAVERAGE and SSUM.
■ 1.0 is the default for HWFIRST, HWLAST, WAVERAGE, WFIRST, WLAST, and
WSUM.
NA
Specifies that NA values are to be specified as NA. NA is the default for OR.
wobj
A variable, formula, or relation that provides the weighted values. It can be numeric or
BOOLEAN. When wobj is BOOLEAN, then TRUE has a weight of 1.0 and FALSE has a
weight of 0.0. A formula is queried only when needed, depending on the
dimensionality of the formula and the of the variable being aggregated. When wobj is a
relation, it should be a one-dimensional self-relation. For more information about
specifying values for wobj, see the RELATION (for aggregation) statement of the
AGGMAP command.
Examples
For an example of using a DROP DIMENSION statement in an aggregation
specification, see Example 9–14, "Aggregating into a Different Variable" on page 9-25.
Syntax
MEASUREDIM name
Arguments
name
The name of the measure dimension. A measure dimension is a dimension that you
define. The dimension values are names of existing variables.
Notes
Examples
For an example of an aggregation specification that includes a MEASUREDIM
statement, see Example 9–15, "Using a MEASUREDIM Statement in an Aggregation
Specification" on page 9-26.
Syntax
MODEL modelname [PRECOMPUTE ALL | PRECOMPUTE NA]
Arguments
modelname
A text expression that contains the name of a predefined MODEL object.
PRECOMPUTE ALL
PRECOMPUTE NA
Specifies whether the model is a static (precomputed) model or a dynamic model.
■ PRECOMPUTE ALL is the default and specifies a static model. The following
conditions must be met:
■ Any RELATION or MODEL statements that precede it in the aggregation
specification must also be specified as PRECOMPUTE ALL.
■ Any RELATION or MODEL statements that follow it in the aggregation
specification can either be specified as PRECOMPUTE ALL or PRECOMPUTE
NA.
■ PRECOMPUTE NA specifies a dynamic model. The following conditions must be met
for runtime execution of the model:
■ All RELATION statements in the aggregation specification must appear before
the MODEL statements specified as PRECOMPUTE NA.
■ Any additional MODEL statements that follow it in the aggregation
specification must also be specified as PRECOMPUTE NA.
Examples
For an example of using a model in an aggregation specification, see Example 9–16,
"Solving a Model in an Aggregation" on page 9-27.
PRECOMPUTE
Syntax
PRECOMPUTE precompute-phrase
where precompute-phrase is one of the following:
n% | AUTO
ALL
NA | NONE
Arguments
n%
Specifies an explicit percentage of the aggregate variable values that will be
aggregated as a database maintenance procedure using an AGGREGATE command.
Oracle OLAP uses special functionality called the Aggregate Advisor to determine
exactly which values are in the percentage.
AUTO
Specifies that Oracle OLAP uses the Aggregate Advisor to determine how many and
which aggregate variable values to aggregate as a database maintenance procedure
using an AGGREGATE command.
ALL
Specifies that all aggregated data will be precomputed using an AGGREGATE
command.
NA
NONE
Specifies that all values should be calculated on the fly using the AGGREGATE
function (that is, that no data should be precalculated with the AGGREGATE
command).
Syntax
RELATION rel-name [(valueset...)] -
[PRECOMPUTE (precompute-phrase)] -
[OPERATOR {operation|opvar}] -
[PARENTALIAS dimension-alias-name] -
[ARGS {argument|argsvar}] -
[LOAD_STATUS(status-valueset-name)]
where:
■ precompute-phrase is one or more of the following:
n% | AUTO
dimension-values
positions-of-dim-values
level-relation-name level-name...
valueset2
ALL
NA | NONE
■ argsvar is a text variable that contains argument phrases for some or all dimension
values.
Arguments
rel-name
A relation that defines a hierarchy by identifying the parent of every dimension value
in a hierarchy.
valueset
Sets the status of one or more dimensions for the duration of the aggregation. It
overrides the current status.
PRECOMPUTE
Indicates that some dimension values are populated only with the AGGREGATE
command. The PRECOMPUTE clause of the RELATION statement limits the data that
is aggregated by the AGGREGATE command. In its simplest form, you can think of
the PRECOMPUTE clause as working like a LIMIT dimension TO statement. Notice
that the default limit is on the dimension, which is not explicitly named in the
RELATION statement.
n%
Specifies an explicit percentage of the aggregate variable values that will be
aggregated as a database maintenance procedure using an AGGREGATE command.
Oracle OLAP uses special functionality called the Aggregate Advisor to determine
exactly which values are in the percentage.
AUTO
Specifies that Oracle OLAP uses the Aggregate Advisor to determine how many and
which aggregate variable values to aggregate as a database maintenance procedure
using an AGGREGATE command.
dimension-values
A list of one or more values of dimension.
positions-of-dim-values
For all dimensions except those with INTEGER or NUMBER values, the positions of the
dimension values that you want precomputed. Specify the positions using INTEGER
values, separated by commas.
valueset2
The name of a valueset. When you include this argument, only data that is
dimensioned by the dimension values in the valueset should be precalculated with the
AGGREGATE command. The rest of the values can be calculated on the fly.
Note that the current status of a dimension can also limit the data that is precalculated.
See the AGGREGATE command for details.
ALL
Specifies that data should be precalculated for all dimension values.
NA
NONE
Specifies that all values should be calculated on the fly using the AGGREGATE
function (that is, that no data should be precalculated with the AGGREGATE
command).
dimension to the names of the levels of the dimension. For level-name, specify, as TEXT
values, the name of one or more levels using the same level names used in
level-relation-name.
OPERATOR
Identifies the calculation method used to aggregate the data.
operation
A keyword that describes the type of calculation to perform. The keywords are listed
in Table 9–1, " Aggregation Methods" and can be retrieved by issuing a AGGROPS
statement. You can specify a fixed-length three-character abbreviation for the
keywords by specifying only the first three characters.
opvar
A TEXT variable that you define that specifies a different the operation for each of its
dimension values.
PARENTALIAS
Specifies that an alias dimension for the dimension being aggregated is QDRd to the
parent value currently being aggregated.
dimension-alias-name
The name of the alias dimension for the dimension of rel-name.
ARGS
Indicates optional handling of the aggregation.
DIVIDEBYZERO
Specifies whether to allow division by zero.
■ YES allows division by zero; a statement involving division by zero executes
without error but produces NA results.
■ NO disallows division by zero; a statement involving division by zero stops
executing and produces an error message.
The default value is the current value of the DIVIDEBYZERO option.
DECIMALOVERFLOW
Specifies whether to allow decimal overflow, which occurs when the result of a
calculation is very large and can no longer be represented by the exponent portion of
the numerical representation.
■ YES allows overflow; a calculation that generates overflow executes without error
and produces NA results.
■ NO disallows overflow; a calculation involving overflow stops executing and
generates an error message.
The default value is the current value of the DECIMALOVERFLOW option.
NASKIP
Specifies whether NA values are input.
■ YES specifies that NA values are ignored when aggregating. Only actual values are
used in calculations.
■ NO specifies that NA values are considered when aggregating. When any of the
values being considered are NA, the calculation returns NA.
The default value is the current value of the NASKIP option.
The value that you specify for the NASKIP phrase does not effect calculation
performed when you specify HAVERAGE, HFIRST, HLAST, HWAVERAGE,
HWFIRST, HWLAST for operation.
WEIGHTBY
Indicates that weighted aggregation is to be performed. You must include a
WEIGHTBY clause when you specify HWAVERAGE, HWFIRST, HWLAST, SSUM,
WAVERAGE, WFIRST, WLAST, or WSUM for operation. The WEIGHTBY phrase
always includes a wobj argument and, optionally, can include the WNAFILL keyword.
wobj
A variable, formula, or relation that provides the weighted values. It can be numeric or
BOOLEAN. When wobj is BOOLEAN, then TRUE has a weight of 1.0 and FALSE has a
weight of 0.0. A formula is queried only when needed, depending on the
dimensionality of the formula and the of the variable being aggregated. When wobj is a
relation, it should be a one-dimensional self-relation. See Using Weighted Aggregation
Methods on page 9-54 for more information about specifying values for wobj.
COUNT {YES|NO}
YES specifies that when Oracle OLAP aggregates a variable using this relation that it
also populates the Aggcount variable associated with that variable. For more
information on Aggcount variables, see "Aggcount Variables" on page 9-208.
NO specifies that when Oracle OLAP aggregates a variable using this relation that it
does not populate the Aggcount variable associated with that variable. For more
information on Aggcount variables, see "Aggcount Variables" on page 9-208.
argsvar
A TEXT variable that contains the argument options for some or all dimension values.
LOAD_STATUS
Specifies that, for the aggregation, Oracle OLAP temporarily sets the status of the
relation dimension using the values specified by status-valueset-name. Setting status in
this way, limits the dimension to the specified values for the aggregation without
changing the current status of the dimension
status-valueset-name
A previously-defined valueset that specifies the lowest-level values to have in status
when performing the aggregation. When performing any aggregation using an
aggmap with a RELATION statement with this clause, Oracle OLAP temporarily sets
the status of the dimension to the values specified by status-valueset-name and their
ancestors. The valueset specified by status-valueset-name must be a single
dimensional valueset for the relation dimension (not the hierarchy dimension).
Additionally, the valueset specified by status-valueset-name cannot contain both a value
and an ancestor of that value.
Notes
In this case, using valuesets provides a way to manage hierarchies that are in
conflict with each other, meaning, when the same dimension value stores data for
different children in different hierarchies (such as, Q1 stores data for Jan, Feb,
and Mar in the Calendar hierarchy, but Q1 stores data for May, Jun, and Jul in
the Fiscal hierarchy).
■ Specify which values should be calculated on the fly by the AGGREGATE
function and which values should be pre-calculated by the AGGREGATE
command. The valueset that you use specifies the names of dimension values. To
use a valueset in this way, use the following syntax.
In this case, you use the valueset that follows the PRECOMPUTE keyword.
When you use valuesets to limit hierarchy dimensions and when using more than
one aggmap and the hierarchies are inconsistent, you must also use the
FORCECALC keyword in the AGGREGATE function or have set an
$AGGREGATE_FORCECALC property on the variable to be aggregated.
Within the aggregation specification, use that valueset to specify that the detail-level
data should be added to the data that already exists in its parent, Q1, as shown in the
following statement.
RELATION time.r PRECOMPUTE (all_but_q4)
Average Operators
There are a number of issues involved in using the AVERAGE, HAVERAGE,
WAVERAGE, and HWAVERAGE operators:
■ Oracle OLAP needs a separate INTEGER variable in which it stores the non-NA
counts of the number of leaf nodes that contributed to aggregate values to
calculate average values. When you want to aggregate a variable using one the
average operators, include the WITH AGGCOUNT phrase in the DEFINE
VARIABLE statement for the variable.
■ Accuracy when averaging—All decimal data is converted to floating point format,
both for storing and for calculations, consequently, in some cases, an average
aggregation computed on a DECIMAL or SHORTDECIMAL variable can differ in the
least significant digits from a result you compute by hand. For this reason, you
might want to use the NUMBER data type when accuracy is more important than
computational speed, such as variables that contain currency amounts. See
"Numeric Expressions" on page 2-32 for more information.
■ Using Average operators when aggregating using an AGGREGATE
command—When you use an average operator with the PRECOMPUTE keyword,
the best practice is to use variables that have a decimal or NUMBER data type in
order to ensure the accuracy of the results.
■ Using Average operators for partial aggregations—When you use an average
operator in a partial aggregation, then you must always aggregate using the same
INTEGER variable (that is, Aggcount or Countvar variable). Do not change the
values that are stored in this INTEGER variable between aggregations. Finally, the
number of INTEGER variables must match the number of variables that are being
aggregated.
Now, the LAST operator will assume that FEB01 is the last month in Q1.
■ When the weight object is a variable, you can define it with a numeric or
BOOLEAN data type. Use a variable as your weight object when you want to
pre-calculate weight values and commit them to the Database. You can use a
variable weight object with any weight option.
■ When the weight object is a relation, you should define it as a one-dimensional
self-relation. You can use the weight object to specify that the weight for a specific
cell is contained in the current variable at a different location. Use a relation as
your weight object when you use a line item or a measure dimension. In this case,
one line item is used as the weight to calculate the aggregate value of another line
item. Using a relation enables you to specify another set of cells in the variable
being aggregated as the weight values for a weighted operation.
■ When the weight object is a formula, that formula will be queried only as often as
needed, depending on the dimensionality of the formula and the dimensionality
of the variable whose data is being aggregated. You can define the formula with a
numeric or BOOLEAN data type. Use a formula as your weight object when you
want to calculate weight values on the fly. A formula weight object is similar to a
variable weight object, except that it cannot be aggregated. The value of a formula
weight object is executed dynamically. Therefore, you cannot use a formula
weight object with many of the weight options.
Using WNAFILL
For example, suppose you use the WSUM operator to perform currency conversion.
The currency conversation rates will be applied at the detail data level. Only the detail
data needs to be converted, because the variable data is aggregated after the
conversion. In order to get the correct results, all of the non-detail level weight values
in the weight object would have to be 1. Although this strategy produces correct
results, it is inefficient. The best practice is to use the default WNAFILL value of 1.
This specifies that all NA values in the weight object should be treated as if they have a
weight of 1. In this case, because the operator is WSUM, you do not have to include
WNAFILL in the AGGREGATE command, because the default values are correct.
For example, the following statement causes the value 0.7 to be substituted for every
NA value in the salesw weight object.
When you do not want to specify a number to replace NA values, then you can use NA
instead of a number, as shown in the following statement.
AGGREGATE sales USING sales.agg WEIGHTBY WNAFILL NA salesw
-----------------------SALES-----------------------
---------------------DISTRICT----------------------
TIME North South West East
------------ ------------ ------------ ------------ ------------
1976Q1 168,776.81 362,367.87 219,667.47 149,815.65
1976Q2 330,062.49 293,392.29 237,128.26 167,808.03
1976Q3 304,953.04 354,240.51 170,892.80 298,737.70
1976Q4 252,757.33 206,189.01 139,954.56 175,063.51
1976 NA NA NA NA
Examples
For examples of aggregation specifications that include RELATION statements, see the
examples in the AGGMAP command.
Note: Although you can use the AGGMAP ADD MODEL and
AGGMAP REMOVE MODEL statements to temporarily add a model
to an aggmap object, typically you use a MAINTAIN ADD SESSION
statement like the one below to perform this action.
MAINTAIN dimension ADD SESSION member = model APPLY TO AGGMAP
aggmap
When you use a MAINTAIN ADD SESSION statement neither the
calculated member or its definition persists from session to session;
both are deleted at the end of the session in which they are created
Syntax
AGGMAP {ADD model TO aggmap|REMOVE model FROM aggmap}
Arguments
ADD
Temporarily adds a model to an aggmap object. The model is attached to the aggmap
only for the duration of the session. Even when the analytic workspace has been
updated and committed, the model is discarded from the aggmap when the session is
closed.
REMOVE
Removes a model from an aggmap.
model
The name of the model object that you wish to add to the specified aggmap.
aggmap
The name of a previously defined aggmap object of type AGGMAP.
Examples
Assume also that you want to create summarized variable data for the cells that are
dimensioned by the dimension values AAB and ABA. However, you do not want this
data to be permanently stored in the analytic workspace. You just want to see the data
during your session.
To perform this type of aggregation, you can take the following steps:
1. Create a dimension value for the custom aggregate. This dimension value will be
the parent of the dimension values AAB and ABA. The following statement adds
'BB' to the letter dimension.
MAINTAIN letter ADD 'BB'
3. Execute an AGGMAP ADD statement to append the model to the existing AGGMAP
object.
AGGMAP ADD letter.model TO letter.aggmap
4. The model is executed only by the AGGREGATE function like the one shown here;
the AGGREGATE command ignores it.
REPORT AGGREGATE(units USING letter.aggmap)
5. When you wish to remove the model from the aggmap during a session, use the
AGGMAP REMOVE statement.
6. To ensure that your aggmap does not become a permanent object in the analytic
workspace, before you close your session issue the following statement to delete
the dimension values that you added in Step 1.
MAINTAIN letter DELETE 'BB'
When your session ends, Oracle OLAP automatically removes the model added
using the AGGMAP ADD statement. You do not have to issue an explicit
AGGMAP REMOVE statement.
AGGMAP SET
Note: You can also use an $AGGMAP property to specify the default
aggregation specification for a variable or the $ALLOCMAP property
to specify the default allocation specification for a variable.
Syntax
AGGMAP SET aggmap AS DEFAULT FOR variables
Arguments
aggmap
The name of a previously defined aggmap object.
variables
A text expression that is the name of one or more variables for which the specified
aggmap is the default aggmap. When you specify a literal value, separate the names of
the variables with commas.
Examples
You can further simplify the AGGREGATE command if you make revenue_aggmap
the default aggmap for the sales_by_revenue variable. You can do this either by
defining an $AGGMAP property on the sales_by_revenue variable or by issuing
the following statement.
AGGMAP SET revuienue_aggmap AS DEFAULT FOR sales_by_revenue
Now you can aggregate the data by issuing the following AGGREGATE command
that does not include a USING clause.
AGGREGATE sales_by_revenue
AGGREGATE command
The AGGREGATE command calculates summary data in the variable that is specified
as PRECOMPUTE in the specified aggmap. (For information about specifying
precompute data, see the PRECOMPUTE and RELATION (for aggregation) statements
of the AGGMAP command.) The aggregation is limited to those values that are
currently in status.
Use the $AGGMAP property or the AGGREGATE function to calculate data that is not
specified as precomputed data.
Syntax
AGGREGATE|AGGR { var [(PARTITION partition-name)]}... [USING aggmap] -
[FROM fromspec|FROMVAR textvar] [FORCEORDER] [FUNCDATA] [COUNTVAR countvar...]
Arguments
var
A variable whose data values are to be calculated. Every variable in a single
AGGREGATE command must have exactly the same dimensions in exactly the same
order.
PARTITION
Specifies that you want AGGREGATE to recalculate only the values in the specified
partition of the specified variable. Frequently, the reason for aggregating only a single
partition is to parallize a build using multiwriter.
partition-name
The name of a previously-defined partition. See DEFINE PARTITION TEMPLATE
USING
This keyword indicates that the aggregation is performed using the specified aggmap.
When you do not include this phrase, the command uses the default aggmap for the
variable as previously specified using an AGGMAP statement or the $AGGMAP
property.
aggmap
The name of a previously-defined aggmap that specifies how the data will be
aggregated. For information about aggmaps, see the DEFINE AGGMAP command.
FROM
This keyword indicates that the detail data is obtained from a different object.
A FROM clause is only one way in which you can specify the variable from which
detail data should be obtained when performing aggregation. See "Ways of Specifying
Where to Obtain Detail Data for Aggregation" on page 9-63.
fromspec
An arbitrarily dimensioned variable, formula, or relation from which the detail data
for the aggregation is obtained.
FROMVAR
This keyword indicates that the detail data is obtained from different objects to
perform a capstone aggregation. (For an example of using the FROMVAR clause, see
Example 9–31, "Capstone Aggregation" on page 9-66.)
A FROMVAR clause is only one way in which you can specify the variable from which
detail data should be obtained when performing aggregation. See "Ways of Specifying
Where to Obtain Detail Data for Aggregation" on page 9-63.
textvar
An arbitrarily dimensioned variable used to resolve any leaf nodes. Specify NA to
indicate that a node does not need detail data to calculate the value.
FORCEORDER
Specifies that the calculation must be performed in the order in which the RELATION
statements are listed in the aggmap. Use this option when you have changed some of
the values calculated by the AGGREGATE command. Otherwise, the optimization
methods used by the AGGREGATE command may cause the modified values to be
ignored.
FUNCDATA
Compiles the aggregation specification for future use by the AGGREGATE function.
When you use FUNCDATA, you do not have to recompile the aggmap before using
the AGGREGATE function, unless afterward you make changes to the aggmap, the
relation hierarchies, or a composite.
When the variables have composite dimensions, the indexes (composite tuples) are
created and saved for use by the AGGREGATE function. Otherwise, the indexes are
re-created each time the AGGREGATE function is called. Refer to AGGINDEX for
more information about composite indexes.
COUNTVAR countvar
Indicates that Oracle OLAP should use the user-defined variable specified by countvar
to store the non-NA counts of the number of leaf nodes that contributed to aggregate
values calculated for RELATION statements that have an AVERAGE, HAVERAGE,
HWAVERAGE, or WAVERAGE operator.
The countvar variable must be an INTEGER variable with exactly the same dimensions
in exactly the same order as the dimensions of the variable specified by var. When you
aggregate several variables together, you must define an INTEGER variable for each
one to record the results.
Notes
Now suppose you change the data value for New York. When you then use
AGGREGATE with only New York, the calculation occurs without including the child
value for South (Atlanta), but still includes level 2 as it goes from level 3 to level 1
(TotalUS). When you want all the child values included in rolling up to TotalUS,
use a LIMIT TO ALL statement before you execute the AGGREGATE command.
When the data has changed for some, but not all, of the child values in a hierarchy,
you can set the status to calculate just the values that have changed. For example,
when your embedded-total dimension is called d2, and its parent relation is called
reld2, first limit d2 to the values that have changed.
To calculate the data for every hierarchy in a dimension, limit the dimension's
hierarchy dimension to ALL before you execute the AGGREGATE command.
Generation-Skipping Hierarchies
AGGREGATE automatically distinguishes between generations in the parent relation,
even to the extent of allowing generation-skipping hierarchies. For example, you can
have a four-level hierarchy (for example, neighborhoods, cities, states, and
totalUS) that has a three-level branch (for example, Boston, Massachusetts, and
totalUS).
Restrictions on Permissions
AGGREGATE does not work on variables that have cell-by-cell permissions; it will
immediately return an error. It also ignores the PERMITERROR option. However,
AGGREGATE will operate on variables with object level or dimension level
permission. See the PERMIT command and PERMITERROR option.
Examples
This section contains several examples of using the AGGREGATE command. For
additional aggregation examples, see the examples in the AGGMAP command.
The next step is to define an aggmap object, whose definition has the same dimensions
in the same dimension order. Suppose you define an aggmap object named act.agg
using DEFINE AGGMAP.
DEFINE act.agg AGGMAP <time, SPARSE <product, customer, channel>>
Suppose that the name of the hierarchy for the time dimension is time.r, the name
of the product dimension is product.r, and so on Next, you use an AGGMAP
statement to add the following text in the act.agg aggmap.
AGGMAP
RELATION time.r
RELATION product.r
RELATION customer.r
RELATION channel.r
END
The preceding text specifies the name of each dimension's hierarchy for which data
should be rolled up. Assuming that the current status of every dimension is ALL, data
will be calculated for every dimension value of every dimension in the definition of
actuals. No data will be calculated on the fly.
Use the following statements to calculate the actuals variable. (It is not necessary to
compile the aggmap, because the compilation is included as part of the AGGREGATE
command.)
AGGREGATE actuals USING act.agg
The next step is to define an aggmap object, whose definition has the same dimensions
in the same dimension order. Suppose you define the same aggmap object named
act.agg, as described in "Aggregating One Variable" on page 9-64. As long as you
want the data for each variable to be rolled up in exactly the same way, you can use
the same aggmap to calculate both variables in a single statement.
Use the following statements to calculate the actuals and the forecast variables.
AGGREGATE actuals forecast USING act.agg
Because the aggmap specifies that all data for every dimension value in each
dimension should be rolled up, this statement rolls up all of the data in actuals and
all of the data in forecast.
To tally the results with COUNTVAR, you must define three INTEGER variables that
have the same dimensionality as sales, units, and projected_sales.
DEFINE intsales INTEGER <month product geography>
DEFINE intunits INTEGER <month product geography>
DEFINE intprojsales INTEGER <month product geography>
You can then specify the INTEGER variables in the following statement.
AGGREGATE sales units projected_sales USING sales.agg -
COUNTVAR intsales intunits inprojsales
For the aggregation, time is limited to the last two time periods and all product
values are in status.
LIMIT time TO LAST 2
STATUS time product
The current status of TIME is:
Apr02, May02
LIMIT product TO ALL
The following AGGREGATE statement calculates units using the tp2.agg aggmap.
AGGREGATE units USING tp2.agg
The results of this aggregation show that parent values are calculated, regardless of
their own status, when their children are in status.
-----------------------------------------UNITS-----------------------------------------
----------------------------------------PRODUCT----------------------------------------
TIME FOOD SNACKS DRINKS POPCORN COOKIES CAKES SODA JUICE
------- -------- -------- -------- -------- -------- -------- -------- --------
2002 38 24 14 6 9 9 9 5
Q1.02 NA NA NA NA NA NA NA NA
Q2.02 38 24 14 6 9 9 9 5
Jan02 NA NA NA 8 2 4 5 8
Feb02 NA NA NA 5 3 2 2 5
Mar02 NA NA NA 3 4 4 2 4
Apr02 21 13 8 2 7 4 6 2
May02 17 11 6 4 2 5 3 3
TIME.D
--------------
Jan76
Feb76
Mar76
76Q1
Assume, also, that there are four variables with the following definitions
DEFINE sales_jan76 VARIABLE INTEGER <geog.d>
DEFINE sales_feb76 VARIABLE INTEGER <geog.d>
DEFINE sales_mar76 VARIABLE INTEGER <geog.d>
DEFINE sales_capstone76 VARIABLE INTEGER <geog.d time.d>
Assume that you issue the following REPORT statements for the variables. The output
of the reports show the detail data in the variables.
REPORT sales_jan76 sales_feb76 sales_mar76
REPORT DOWN geog.d sales_capstone76
-----------------SALES_CAPSTONE76------------------
----------------------TIME.D-----------------------
GEOG.D Jan76 Feb76 Mar76 76Q1
-------------- ------------ ------------ ------------ ------------
Boston NA NA NA NA
Medford NA NA NA NA
San Diego NA NA NA NA
Sunnydale NA NA NA NA
Massachusetts NA NA NA NA
California NA NA NA NA
United States NA NA NA NA
After aggregating the variables, when you issue the REPORT statements, the
variables are populated with the calculated data.
REPORT sales_jan76 sales_feb76 sales_mar76
REPORT DOWN geog.d sales_capstone76
-----------------SALES_CAPSTONE76------------------
----------------------TIME.D-----------------------
GEOG.D Jan76 Feb76 Mar76 76Q1
-------------- ------------ ------------ ------------ ------------
Boston 1,000 2,000 3,000 6,000
Medford 2,000 4,000 6,000 12,000
San Diego 3,000 6,000 9,000 18,000
Sunnydale 4,000 8,000 12,000 24,000
Massachusetts 3,000 6,000 9,000 18,000
California 7,000 14,000 21,000 42,000
United States 10,000 20,000 30,000 60,000
ALLCOMPILE
The ALLCOMPILE program compiles every compilable object in your current analytic
workspace, one at a time. As it works, ALLCOMPILE sends to the current outfile
messages that show the name of the object being compiled.
ALLCOMPILE uses the COMPILE command. This means that it will check for syntax
errors as it compiles an object, and it will record error messages in the current outfile
as appropriate.
Syntax
ALLCOMPILE [n]
Arguments
n
An INTEGER expression with a value of zero or higher. The expression specifies the
number of objects to be compiled before an UPDATE statement is executed. For
example, when you specify 1, an UPDATE statement is executed after each object is
compiled. When you specify 0 (zero), all the objects are compiled and an UPDATE
statement is executed only at the end. When you omit the argument, no UPDATE
statement is executed by ALLCOMPILE. Frequent updates during an ALLCOMPILE
help ensure the most efficient use of space in the analytic workspace.
Examples
ALLOCATE
Syntax
ALLOCATE source [SOURCE conjoint] [BASIS basisname [ACROSS dimname]] -
[TARGET targetname [TARGETLOG targetlogname]] -
[USING aggmap] [ERRORLOG errorlogfileunit]
Arguments
source
A variable or formula that provides the values to allocate. When the source object is a
formula, you must also specify a variable with the TARGET keyword. When you
specify a variable as source and you do not specify a target variable or a basisname
variable, then ALLOCATE uses source as the basis and the target.
SOURCE conjoint
Specifies a conjoint dimension that contains a list of cells the user has changed. The
ALLOCATE command uses this list to produce the smallest target status needed to
allocate all of the changed source cells.
BASIS basisname
Specifies a variable, relation, or formula that provides the data on which the allocation
is based. That data determines which cells of the target receive allocated values and, in
an even or proportional operation, the amount of the source allocated to a target cell.
When the OPERATOR specified by a RELATION (for allocation) statement in aggmap
is a COPY operator (COPY, MIN, MAX, FIRST, LAST), the basis tells the ALLOCATE
command which target cells to update. When the OPERATOR specified is EVEN, then
ALLOCATE derives the counts that it uses for allocation from the basis. When the
OPERATOR specified is the PROPORTIONAL, then ALLOCATE uses the basis data
to determine the amount to allocate to each target cell. When the OPERATOR is
HCOPY, HFIRST, HLAST, or HEVEN, then ALLOCATE does not use a BASIS object.
Instead, it allocates the source data to all of the target cells in the dimension hierarchy
that is specified by the relation named in the RELATION statement.
When you specify the same variable as both the basis and the target, the current values
of the target cells determine the allocation. When you do not specify a basis, then the
ALLOCATE command uses the source as the basis.
ACROSS dimname
Specifies a dimension, which can be a named composite, that the ALLOCATE
command loops over to discover the cells in a basis. Because a basis can be a formula,
you can realize a significant performance advantage by supplying a looping
dimension that eliminates the sparsity from the basis loop.
TARGET targetname
Specifies a variable to hold the allocated values. When the source object is a formula,
then you must specify a target. When the source object is a variable and you do not
specify a target, then ALLOCATE uses the source variable as the target.
TARGETLOG targetlogname
Specifies a variable (identically dimensioned to the targetname variable), or a relation
that specifies such a variable, to which ALLOCATE assigns a copy of the allocation.
For instance, when ALLOCATE assigns the value of 100 to the cell of the costs
variable that is specified by the time and product dimension values Jan01 and TV,
and the targetlog relation specifies the cell of the costacct variable that is
specified by the same dimension values, then ALLOCATE assigns the value of 100 to
the specified costacct cell, also.
USING aggmap
Specifies the name of a previously-defined aggmap to use for the allocation. When you
do not include this phrase, the command uses the default allocation specification for
the variable as previously specified using the $ALLOCMAP property.
ERRORLOG errorlogfileunit
Specifies a file unit that ALLOCATE uses for logging allocation deadlocks, errors, or
other information. When the allocation does not generate any deadlocks or errors,
ALLOCATE sets errorlogname to NA. When the allocation produces one or more
deadlocks or errors, the events are sent to the specified file. ALLOCATE writes one
line in the file for each allocation source that remains unallocated.
When you do not specify a file unit with ERRORLOG, ALLOCATE sends the
information to the standard output device.
Notes
You would then use ACTUALSWANTED as the source object with the ALLOCATE
command. In this example, you would use the ACTUALS variable as the basis.
For example, when you allocate a series of different costs to the same costs centers,
then each allocation increases the values in the target cells. You can keep track of the
individual allocations by specifying a different targetlogname variable for each
allocation.
Examples
The following statements define a self-relation on the time dimension, relate the
month values directly to the year values, and report the values of the relation.
DEFINE timemonthyear RELATION time <time>
LIMIT month TO 'JAN02' TO 'JUN02'
timemonthyear(time month) = '<YEAR: YR02>'
REPORT timemonthyear
The following statements define an aggmap and enter statements into the allocation
specification. They allocate the value that is specified by <year: Yr02> from
projbudget to the cells of the same variable that are specified by the month
dimension values, and then report projbudget. The target cells of the variable have
NA values so the RELATION statement in the allocation specification specifies the
HEVEN operator. The ALLOCATE command specifies only one variable,
projbudget, so that variable is the source and target of the allocation. No basis object
is required because the allocation is an HEVEN operation. The allocation is directly
from the year source value to the month target values because that is the hierarchy
specified by the relation in the allocation specification.
DEFINE projbudgmap AGGMAP
ALLOCMAP
RELATION timemonthyear OPERATOR HEVEN
END
ALLOCATE projbudget USING projbudgmap
REPORT projbudget
of the allocation are projbudget. The status of the division, time, and line
dimensions are the same as the direct allocation example. At the beginning of this
example, the projbudget variable again has just the single value, 6000, in the cell
specified by <year: Yr02>.
DEFINE timeparent RELATION time <time>
LIMIT quarter TO 'Q1.02' 'Q2.02'
timeparent(time quarter) = '<YEAR: YR02>'
LIMIT month TO 'JAN02' TO 'MAR02'
timeparent(time month) = '<QUARTER: Q1.02>'
LIMIT month TO 'APR02' TO 'JUN02'
timeparent(time month) = '<QUARTER: Q1.02>'
REPORT timeparent
This example demonstrates locking a cell so that it does not participate in the
allocation. Locking a cell requires a valueset, so the following statements define one,
limit the time dimension to the desired value, assign a value to the valueset, and then
reset the status of the time dimension.
DEFINE timeval TO '<QUARTER: Q2.02>'
LIMIT time TO '<Year: YR02>' '<Quarter: Q1.02>' '<Quarter: Q2.02>' -
'<month: Jan02>' '<month: Feb02>' '<month: Mar02>' -
'<month: Apr02>' '<month: May02>' '<month: Jun02>
The following statements replace the previous specification of the aggmap with the
new RELATION statement, which specifies the PROPORTIONAL operator. The
allocation specification includes a SOURCEVAL ZERO statement, which specifies that
the source value is replace with a zero value after the allocation (see the SOURCEVAL
statement of the ALLOCMAP command for more information). The statements then
allocate the source value and report the result.
CONSIDER projbudgmap
ALLOCMAP JOINLINES('RELATION timeparent OPERATOR PROPORTIONAL timeval' -
'SOURCEVAL ZERO' -
'END')
ALLOCATE projbudget USING projbudgmap
REPORT projbudget
ALLOCMAP
Syntax
ALLOCMAP [specification]
Arguments
specification
A multiline text expression that is the allocation specification for the current aggmap
object. An allocation specification begins with an ALLOCMAP statement and ends
with an END statement. Between these statements, you code one or more of the
following statements depending on the calculation that you want to specify:
CHILDLOCK
DEADLOCK
DIMENSION (for allocation)
ERRORLOG
ERRORMASK
MEASUREDIM (for allocation)
RELATION (for allocation)
SOURCEVAL
VALUESET
Each statement is a line of the multiline text expression. When coding an ALLOCMAP
statement at the command line level, separate statements with newline delimiters (\n),
or use JOINLINES.
For a discussion of how to determine which statements to include, see "Designing an
Allocation Specification" on page 9-77.
Notes
Aggmap Type
You can use the AGGMAPINFO function to learn the type of an aggmap. An aggmap
into which you have entered an allocation specification using the ALLOCMAP has the
type ALLOCMAP and an aggmap into which you have entered an aggregation
specification using an AGGMAP statement has the type AGGMAP. When you have
defined an aggmap but have not yet entered a specification in it, its type is NA.
Examples
ALLOCMAP
RELATION time.parent OPERATOR EVEN
RELATION product.parent OPERATOR EVEN
RELATION geography.parent OPERATOR EVEN
SOURCEVAL ZERO
DEADLOCK SKIP
END
The sales.agg aggmap has now been defined and contains three RELATION
statements and the SOURCEVAL and DEADLOCK statements. In this example, the
ALLOCATE statement allocates its source value evenly to all of the aggregate level
cells and the detail level cells of the target variable because the relations
time.parent, product.parent, and geography.parent relate each child
dimension value to its parent in the dimension hierarchy. The DEADLOCK statement
tells the ALLOCATE statement to log an error and continue the allocation when a
branch of a target hierarchy is locked or has a value of NA. The SOURCEVAL
statement tells ALLOCATE to assign a zero value to the source cells after allocating
the source data.
You can now use the salesalloc aggmap with an ALLOCATE statement, such as.
ALLOCATE sales USING salesalloc
The sales values that are the basis of the allocation are the following.
CHANNEL: TOTALCHANNEL
CUSTOMERS: TOTALCUSTOMER
---------------PROJECTEDSALES---------------
--------------------TIME--------------------
PRODUCT 2001 Q1.02 Q2.02 Q3.02 Q4.02
------------ ------ ------ ------ ------ ------
TotalProduct 7000 1000 2000 3000 1000
Videodiv 4100 600 1100 1900 500
Audiodiv 1700 200 600 600 300
Accdiv 1200 200 300 500 200
ALLOCMAP
RELATION time.time (time.type 'Fiscal') OPERATOR EVEN
END
CHILDLOCK
Syntax
CHILDLOCK [DETECT|NODETECT]
Arguments
DETECT
Tells the ALLOCATE statement to detect that an allocation lock exists on a parent and
also on one of its children in a dimension hierarchy. When it detects a locked parent
and child, the ALLOCATE statement creates an entry in the error log for the
allocation.
NODETECT
(Default) Tells the ALLOCATE statement to continue an allocation even when a lock
exists on a parent and also on one of its children in a hierarchy.
Examples
For an example of using a CHILDLOCK statement in an allocation specification, see
Example 9–78, "Creating an Aggmap for Allocation" on page 9-169.
DEADLOCK
Syntax
DEADLOCK [SKIP|NOSKIP]
Arguments
SKIP
Tells the ALLOCATE statement to log the error and continue with the allocation even
though it cannot distribute source values to cells specified by a branch of a dimension
hierarchy because a target cell is locked or the basis value of the cell is NA.
NOSKIP
Tells the ALLOCATE statement to stop the allocation and to return an error when it
cannot distribute source values to cells in a branch of a dimension hierarchy because a
target cell is locked or the basis value is NA. This is the default action when you do not
include a DEADLOCK statement in the aggmap used by the ALLOCATE command.
Examples
For examples of using a DEADLOCK statement in an allocation specification, see
Example 9–36, "Allocation Specification from an Input File" on page 9-78 and
Example 9–37, "Allocation Specification from a Text Expression" on page 9-79.
Syntax
DIMENSION dimension 'dimval'
Arguments
dimension
the name of the dimension that you want to limit.
dimval
The single value of the dimension to which you want the status of the dimension set
for the duration of an allocation.
Examples
For an example of using a DIMENSION statement in an allocation specification, see
Example 9–38, "Specifying a Single Dimension Value in an Allocation Specification" on
page 9-79.
ERRORLOG
Syntax
ERRORLOG [UNLIMITED|MAX <num>] [STOP|NOSTOP]
Arguments
UNLIMITED
Tells the ALLOCATE command to write an unlimited number of errors to the error
log. This is the default setting.
MAX num
Specifies a maximum number of errors that ALLOCATE can write to the error log.
STOP
NOSTOP
Specifies whether to stop the allocation when ALLOCATE has written the maximum
number of errors to the error log. When you specify STOP, the allocation stops. When
you specify NOSTOP, the allocation continues but ALLOCATE does not write any
more errors to the error log. When you have specified UNLIMITED, then the STOP
and NOSTOP arguments have no effect and the allocation continues no matter how
many errors occur.
Notes
ERRORMASK
Syntax
ERRORMASK <num...>
Arguments
num...
The number of the error that you do not want to appear in the error log.
Examples
Syntax
MEASUREDIM name
Arguments
name
The name of the measure dimension. A measure dimension is a dimension that you
define. The dimension values are names of existing variables.
Syntax
RELATION rel-name [(qdr. . .)] OPERATOR {operator|} -
[NAOPERATOR operator] [REMOPERATOR operator] -
[PARENTALIAS dimension-alias-name] -
[ARGS {[FLOOR floorval] [CEILING ceilval] [MIN minval] [MAX maxval] -
[NAHANDLE {IGNORE|CONSIDER|PREFER}] -
[ADD|ASSIGN] [PROTECT [NONORMALIZE] [READWRITE|WRITE] lockvalueset] -
[WEIGHTBY [ADD|MULTIPLY] [WNAFILL nafillval] weightobj]}]
Arguments
rel-name
An Oracle OLAP self-relation that specifies the values of a dimension hierarchy that
identify the path of allocation. The cells in the target variable identified by the values
in rel-name receive the allocated data.
qdr. . .
One or more qualified data references that specify a single dimension value for each
dimension of the relation that is not part of the self-relation. When the self-relation has
more than one hierarchy, you must provide a qdr for the hierarchy dimension of the
self-relation dimension that limits to single values any hierarchies not involved in the
allocation.
OPERATOR operator
Specifies one of the allocation methods described in Table 9–3, " Allocation Operators"
on page 9-89 or returned by ALLOCOPS. The method determines the cells of the target
variable for the rel-name relation to which ALLOCATE assigns a value. For the FIRST,
LAST, HFIRST, and HLAST operators, ALLOCATE uses the order of the value in the
dimension to determine the cell. The dimension order is the default logical order of the
allocation dimension. There is no default operator for allocation.
NAOPERATOR operator
The operator after the NAOPERATOR keyword specifies the operator that the
ALLOCATE operation uses when it encounters an NA or lock-based deadlock. Valid
operators are HFIRST, HLAST, and HEVEN which are described in Table 9–3,
" Allocation Operators" on page 9-89.
REMOPERATOR operator
The operator after the REMOPERATOR keyword specifies the operator that the
ALLOCATE operation uses when storing a remainder produced by an allocation. For
example, assume you allocate the INTEGER 10 to three cells at the same level in a
hierarchy, there is a remainder of 1. The REMOPERATOR specifies where you want
the allocation operation to store this remainder. Valid operators for REMOPERATOR
are MIN, MAX, FIRST, HFIRST, LAST, and HLAST which are described in Table 9–3,
" Allocation Operators" on page 9-89.
ARGS
Indicates additional arguments specify additional parameters for the allocation
operation. All of these arguments apply uniformly to the dimension hierarchy
specified by rel-name.
PARENTALIAS dimension-alias-name
Specifies specialized allocation depending on the parent (for example, weighting by
parent or child). For dimension-alias-name, specify the name of the alias for the
dimension of rel-name.
ARGS argument...
One or more arguments after the ARGS keyword that specify additional parameters
for the allocation operation. All of these arguments apply uniformly to the dimension
hierarchy specified by rel-name.
FLOOR floorval
Specifies that when an allocated target data value is less than floorval, the data
allocated to the target cell is NA. This argument applies to the relation only when the
PROPORTIONAL operator is specified.
CEILING ceilval
Specifies that when an allocated target data value is greater than ceilval, the data
allocated to the target cell is NA. This argument applies to the relation only when the
PROPORTIONAL operator is specified.
MIN minval
Specifies that when an allocated target data value is less than minval, the data allocated
to the target cell is minval.
MAX maxval
Specifies that when an allocated target data value is greater than maxval, the value
allocated to the target cell is maxval.
NAHANDLE
Specifies how ALLOCATE treats NA values. Valid only when the OPERATOR is MIN
or MAX.
■ IGNORE specifies that ALLOCATE does not consider NA values in a MIN or MAX
operation. (Default)
■ CONSIDER specifies that ALLOCATE treats an NA value as a zero; however, when
the data value of a target cell is actually zero, the zero cell receives the allocated
data value and not the NA cell.
■ PREFER specifies that ALLOCATE treats an NA value as a zero and the NA has
priority over a zero value, so the NA cell receives the allocated data value and not
the cell with the actual zero value.
ADD
Specifies that ALLOCATE adds the allocated data to the current data in the target cell.
ASSIGN
Specifies that ALLOCATE replaces the data in the target cell with the allocated data,
which is the default behavior.
PROTECT lockvalueset
Specifies a set of dimension values that you want to lock so that they cannot be targets
of the allocation. Before allocating the source data, the allocation operation normalizes
the sources by subtracting the data values of the specified locked cells from the source
data.
NONORMALIZE
Specifies that the allocation operation does not normalize the source data. Using
NONORMALIZE effectively removes from the allocation the values of the hierarchy at
and below the dimension values specified by lockvalueset.
READWRITE
Specifies that the locked data values cannot be used as source data in a subsequent
allocation, thereby locking the data of the hierarchy below the lockvalueset values.
WRITE
Specifies that the allocation cannot store data values in the cells identified by the
lockvalueset dimension values but the allocation can use the data in those cells as source
data in its subsequent steps. However, when in the aggmap you include a
SOURCEVAL statement that specifies NA or ZERO and the locked cell is the source of
an allocation, then ALLOCATE sets the value of the locked cell to NA or zero after the
allocation.
WEIGHTBY
Specifies that the allocation uses a the value specified by weightobj. Using this clause
allows for processes such as unit or currency conversion.
ADD
Specifies that ALLOCATE adds the value specified by weightobj to the existing data
value of the target and assigns the sum to the target cell.
MULTIPLY
(Default) Specifies that ALLOCATE multiplies the value specified by weightobj by the
data value of the target and assigning the product.
WNAFILL
Specifies that ALLOCATE replaces NA values in a cell before applying the value
specified by weightobj to the nafillval value.
nafillval
The value that the ALLOCATE replaces NA values with. When you specify the ADD
option to the WEIGHTBY clause, the default NA fill value is 0; in all other cases, the
default NA fill value is 1.
weightobj
The name of an variable, formula, or relation whose value or values are the weights
that Oracle OLAP applies to the allocated data just before it is stored in the target cell.
When a relation is used, the target variable is referenced based on the weight relation
and the cell is applied to the allocation target cell.
Notes
you want to participate in the allocation. The allocation proceeds down the hierarchy
of the dimension in the first RELATION statement in the aggmap, then down the
hierarchy of the second RELATION statement, and so on.
When the dimension has more than one hierarchy, you must use the qdr argument in
the RELATION statement to specify which hierarchy to use for the allocation. The
hierarchy that you specify with a relation must not contain a circular relation (for
example, one in which dimension value A relates to dimension value B which relates
to dimension value C which relates to dimension value A).
For example, when you want to allocate a yearly budget that you revise monthly, then
you would set the value of the budget at the Year level of the time dimension
hierarchy. You would allocate data to the elements that are at the Month level. As the
year progresses, you would enter the actual data for a month and then lock that
element and reallocate the remaining yearly budget value to see the new monthly
targets that are required to meet the annual goal.
When you lock an element, you can specify whether the source value is renormalized.
By default, when you lock an element of the hierarchy, the value of the cell of the
target variable specified by that element is subtracted from the source value and the
remainder is allocated to the target cells. When you do not want the source
renormalized during the allocation, specify NONORMALIZE after the PROTECT
argument.
Examples
For an example of using RELATION statements in an allocation statement, see the
examples in the ALLOCMAP command, especially Example 9–39, "Entering
RELATION Statements in an Allocation Specification" on page 9-80.
SOURCEVAL
Within an allocation specification, a SOURCE VAL statement specifies the value that
the ALLOCATE command assigns to a source cell in an allocation operation after it
successfully allocates the value that the cell contained before the allocation.
The default value of SOURCEVAL is NA, which means that ALLOCATE sets the value
of each of the allocated source cells to NA following the allocation. When you specify
CURRENT as the SOURCEVAL, then the allocated source cells retain the values that
they had before the allocation. When you specify ZERO as the SOURCEVAL, then
ALLOCATE assigns a zero value to each source cell that is allocated.
Syntax
SOURCEVAL [CURRENT|ZERO|NA]
Arguments
CURRENT
Specifies that the value of a source cell after the allocation is the same as its value
before the allocation.
ZERO
Specifies that the value of a source cell after the allocation is zero.
NA
Specifies that the value of a source cell after the allocation is NA. This is the default
value.
VALUESET
Syntax
VALUSET vs-name[(nondimvalueset)| qdr... ] OPERATOR operator | opvar –
[NAOPERATOR text -exp] [REMOPERATOR text -exp] -
[ARGS [FLOOR floorval] [CEILING ceilval] –
[MIN minval] [MAX maxval] –
[ADDT [ {TRUE|FALSE} | ASSIGN] –
[{PROTECTRW| PROTECTW} [NONORMALIZE] lockvalueset] –
[WEIGHTBY [ADD] weightobj [WNAFILL nafillval]] | -
[WEIGHTBY WEIGHTVAR wobjr]]
Arguments
vs-name
Specifies the name of a valueset object that specifies the values of a dimension which
are the path of allocation. The cells in the target variable identified by the values in
vs-name receive the allocated data.
nondimvalueset
When vs-name is a dimensioned valueset, specifies a nondimensioned valueset that is
the status used to loop the valueset dimension. When you do not include
nondimvalueset or qdr, Oracle OLAP uses the default logical order of the dimensions,
not its current status.
qdr
When vs-name is a a non-dimensioned valueset, one or more qualified data references
that specify the dimension values to use when allocating data.
OPERATOR operator
The operator argument after the OPERATOR keyword is a text expression that is one of
the operator types described in Table 9–3, " Allocation Operators" on page 9-89. The
operator type specifies the method of the allocation. The method determines the cells
of the target variable for the vs-name relation to which ALLOCATE assigns a value.
Unless you have specified a different status using dimorder valueset, for the FIRST,
LAST, HFIRST, and HLAST operators, ALLOCATE uses the default logical order of
the allocation dimension to determine the cell. There is no default operator for
allocation.
OPERATOR opvar
The opvar argument after OPERATOR keyword specifies a TEXT variable that specifies
different the operation for each of the values of a dimension. The values of the variable
are the allocation operators described in Table 9–3, " Allocation Operators" on
page 9-89. An operator variable is used to change the allocation operator with the
values of one dimension. The opvar argument is used with the following types of
dimensions:
■ Measure dimension -- Changes the allocation method depending upon the
variable being allocated. The values of the measure dimension are the names of
the variables to be allocated. It dimensions a text variable whose values identify
the operation to be used to allocate each measure. The allocation specification
must include a MEASUREDIM (for allocation) statement that identifies the
measure dimension.
■ Line item dimension -- Changes the allocation method depending upon the line
item being allocated. The line item dimension is typically non-hierarchical and
identifies financial allocations. The line item dimension is used both to dimension
the data variable and to dimension a text variable that identifies the operation to
be used to allocate each item. The operation variable is typically used to allocate
line items over time.
The opvar argument cannot be dimensioned by the dimension it is used to allocate. For
example, when you want to specify different operations for the geography
dimension, then opvar cannot be dimensioned by geography.
NAOPERATOR text-exp
The operator after the NAOPERATOR keyword specifies the operator that the
ALLOCATE operation uses when it encounters an NA or lock-based deadlock. Valid
operators are HFIRST, HLAST, and HEVEN which are described in Table 9–3,
" Allocation Operators" on page 9-89.
REMOPERATOR text-exp
The operator after the REMOPERATOR keyword specifies the operator that the
ALLOCATE operation uses when storing a remainder produced by an allocation. For
example, assume you allocate the INTEGER 10 to three cells at the same level in a
hierarchy, there is a remainder of 1. The REMOPERATOR specifies where you want
the allocation operation to store this remainder. Valid operators for REMOPERATOR
are MIN, MAX, FIRST, HFIRST, LAST, and HLAST which are described in Table 9–3,
" Allocation Operators" on page 9-89.
ARGS
Indicates that additional arguments specify additional parameters for the allocation
operation. All of these arguments apply uniformly to the valueset.
FLOOR floorval
Specifies that when an allocated target value falls below the value specified in floorval,
Oracle OLAP stores the value as NA.
CEILING ceilval
Specifies that when an allocated target value exceeds the value specified in ceilval, then
Oracle OLAP stores the value as NA.
MIN minval
Specifies that when an allocated target value falls below the value specified minval,
then Oracle OLAP stores the value of minval in the target.
MAX maxval
Specifies that when an allocated target value exceeds the value specified maxval, then
Oracle OLAP stores the value of maxval in the target
ADDT {TRUE|FALSE}
The ADDT phrase specifies the sign of the addition when Oracle OLAP adds target
cells to the existing contents of the target cell:
■ TRUE specifies that the results of the allocation are added to the target. (Default)
■ FALSE specifies that the results of the allocation are subtracted from the target cell.
PROTECTRW lockvalueset
Specifies that the dimension members specified by lockvalueset cannot be the targets or
source values of allocation. This lets users specify an allocation "lock" on a hierarchical
subtree. The current contents of the target cell are subtracted from the source and the
source and basis is renormalized.
PROTECTW lockvalueset
Specifies that the dimension members specified by lockvalueset cannot be the targets of
an allocation. However, these target cells are used as the source values for subsequent
steps in the allocation process. When the SOURCEVAL statement is set to 0 (zero) or
NA and these values are reallocated, they will be set appropriately.
NONORMALIZE
Specifies that Oracle OLAP should not renormalize the source and basis based on the
protected cells. Specifying this keyword has an effect similar to removing a sub-branch
from a hierarchy. Frequently, when you use this keyword, if, after allocation, data is
aggregated from the allocation level, the source cell will probably not contain the
original allocated amount
WEIGHTBY weightobj
Specifies a weight that should be applied to the target cell just before it is stored. This
allows for processes such and unit or currency conversion. Value weight objects are
variables, formulas and relations. When a relation is used, the target variable is
referenced based on the weight relation, and the cell is applied the allocation target
cell.
ADD
Specifies that Oracle OLAP adds the value of the weight to the allocation target rather
than using multiplication.
WNAFILL nafillval
Specifies the default value of the weight variable that should be used. When you do
not include an ADD clause, the default value of nafillval is 1. When you include the ADD
clause, the default value of nafillval is 0 (zero).
ALLSTAT
The ALLSTAT program sets the status of all dimensions in the current analytic
workspace to all their values. ALLSTAT does not, however, set the status of the
NAME dimension.
Syntax
ALLSTAT
Notes
Examples
After you execute an ALLSTAT statement the same STATUS statement produces this
output.
The current status of MONTH is:
ALL
The current status of PRODUCT is:
ALL
The current status of DISTRICT is:
ALL
ARGUMENT
Syntax
ARGUMENT name {datatype|dimension|VALUESET dim}
Arguments
name
The name by which the argument will be referenced in the program. An argument
cannot have the same name as a local variable or valueset. You name an argument
according to the rules for naming analytic workspace objects (see the DEFINE
command).
datatype
The data type of the argument, which indicates the kind of data to be stored. You can
specify any of the data types that are listed and described in the DEFINE VARIABLE
entry. Also, when you want to the program to be able to receive an argument without
converting it to a specific data type, you can also specify WORKSHEET for the data type.
dimension
The name of a dimension, whose value will be contained in the argument. The
argument will hold a single value of the dimension. Assigning a value that does not
currently exist in the dimension causes an error.
VALUESET dim
Indicates that name is a valueset. The keyword dim specifies the dimension for which
the valueset holds values. Argument valuesets can be used within the program in the
same way you would use a valueset in the analytic workspace.
Notes
A program can terminate when a RETURN or SIGNAL statement, or at the last line of
the program executes. When the program calls a subprogram, the original program is
temporarily suspended and the argument still exists when the subprogram ends and
control returns to the original program. A program that calls itself recursively has
separate arguments for each running copy of the program.
Arguments Passed by Value Arguments are passed into a program by value. This
means that the called program is given only the value of an argument, without access
to any analytic workspace object to which it might be related. Therefore, you can
change an argument value within the called program without affecting any value
outside the program. You can think of an argument variable or valueset as a
conveniently initialized local variable or local valueset.
Extra Arguments When the calling program specifies more arguments than there are
declarations in the called program, the extra arguments are ignored. When the calling
program specifies fewer arguments than there are declarations in the called program,
the extra arguments are given NA values.
Examples
You can create a user-defined function to make the GET expression simpler. For
example, the following program can be used as a function to check for values between
0 and 100.
DEFINE verit PROGRAM BOOLEAN
PROGRAM
ARGUMENT uservalue INT
TRAP ON haderror NOPRINT
IF uservalue GT 100
THEN SIGNAL toobig 'The value must be 100 or smaller.'
ELSE IF uservalue LT 0
THEN SIGNAL toosmall 'The value must be 0 or greater.'
RETURN TRUE
haderror:
RETURN FALSE
END
To specify eight-character columns, you could run the product.rpt program with
the following statement.
CALL product.rpt ('Missing' 8)
When the product.rpt program also requires the name of a product as a third
argument, then in the product.rpt program you would add a third ARGUMENT
statement to handle the product argument, and you would set the status of the
product dimension using this argument.
ARGUMENT natext TEXT
ARGUMENT widthamt INTEGER
ARGUMENT rptprod PRODUCT
NASPELL = natext
COLWIDTH = widthamt
LIMIT product TO rptprod
You can run the product.rpt program with the following statement.
CALL product.rpt ('Missing' 8 'TENTS')
In this example, the third argument is specified in uppercase letters with the
assumption that all the dimension values in the analytic workspace are in uppercase
letters.
To specify Missing as the text for NA values, you can execute the following
statement.
CALL product.rpt ('Missing')
In this example, literal text enclosed in single quotes provides the value of the text
argument. However, any other type of text expression works equally well, as shown in
the next example.
DEFINE natemp VARIABLE TEXT TEMP
natemp = 'Missing'
CALL product.rpt (natemp)
Note that you must enclose the expression in single quotation marks. Because the
expression contains punctuation (the minus sign), the quotation marks are necessary
to indicate that the entire expression is a single argument.
In the custom.rpt program, you could use the following statements to produce a
report of this expression.
ARGUMENT rptexp TEXT
REPORT &rptexp
After substituting the arguments, these statements are executed in the sales.rpt
program.
SORT product D units
REPORT units
AW command
The syntax of the AW command varies depending on the task that you want to
perform.
AW ALIASLIST
AW ATTACH
AW CREATE
AW DELETE
AW DETACH
AW FREEZE
AW LIST
AW PURGE CACHE
AW ROLLBACK TO FREEZE
AW SEGMENTSIZE
AW THAW
AW TRUNCATE
Notes
EXPRESS Workspace
When your Database is installed with the OLAP option, the EXPRESS workspace is
always attached in read-only mode in your session. It never automatically becomes the
current workspace, even when it is the first or only workspace in your workspace list,
because it is for internal use by Oracle OLAP. You can make the EXPRESS workspace
the current workspace by explicitly attaching it, but this is not recommended. You
cannot detach the EXPRESS workspace.
AW ALIASLIST
The AW ALIASLIST command assigns or deletes one or more workspace alias for the
specified attached workspace or, when no workspace is specified, for the current
workspace. ALIAS indicates that the alias or aliases should be assigned, and
UNALIAS indicates that the alias or aliases should be deleted. All aliases for a given
workspace are automatically deleted when you detach an analytic workspace.
Syntax
AW ALIASLIST [workspace] {ALIAS|UNALIAS} alias1, alias2, ...
Arguments
workspace
The name of the analytic workspace. You can specify either an analytic workspace
name or an analytic workspace alias, depending on the keywords you are using.
ALIAS
Assigns one or more workspace alias for the specified attached workspace or, when no
workspace is specified, for the current workspace. ALIAS indicates that the alias or
aliases should be assigned, and UNALIAS indicates that the alias or aliases should be
deleted.
All aliases for a given workspace are automatically deleted when you detach an
analytic workspace. Therefore, each time you attach an unattached workspace, you
must reassign its aliases.
UNALIAS
Deletes one or more workspace alias for the specified attached workspace or, when no
workspace is specified, for the current workspace.
alias1
alias2
The alias name for the analytic workspace. Alias names:
■ Can be from 1 - 26 characters in length. All characters must come from the
database character set and must be letters, numerals, or underscores.
■ Cannot begin with a numeral and cannot be reserved words in the DML. (Use
RESERVED to identify reserved words.)
Examples
In the following statement, the user named scott assigns mydemo as an alias for the
same workspace.
AW ALIASLIST demo ALIAS mydemo
AW ATTACH
Syntax
AW ATTACH workspace -
[ONATTACH [progname]|NOONATTACH] -
[RO {THAW]|RW|RWX|MULTI] [WAIT|NOWAIT] -
[AUTOGO [progname]|NOAUTOGO] -
[AFTER workspace|BEFORE workspace|LAST|FIRST] -
[PASSWORD password]
Arguments
workspace
The name of the analytic workspace. When you use the ATTACH keyword to attach
an analytic workspace that is not already attached, you must specify the workspace
name. Again this is because no alias has been assigned using AW ALIAS LIST.
However, when you use the ATTACH keyword on an already attached workspace
(for example, in order to change its position in the workspace list), you can assign an
alias using AW ALIAS LIST and then use that assigned alias.
ONATTACH [progname]
An Onattach program automatically executes when the workspace is started:
■ When you specify the ONATTACH keyword without following it with a program
name, Oracle OLAP looks in the workspace for a program named ONATTACH
and executes it if it exists. This syntax is provided for clarity in your programs.
You can get the same results by not specifying ONATTACH.
■ When you specify the ONATTACH keyword and you follow it with a program
name, Oracle OLAP looks in the workspace for a program of that name. When it
exists, Oracle OLAP executes that program, even when a program named
ONATTACH exists in the workspace. See "Programs Executed When Attaching
Analytic Workspaces" on page 9-109 for more information.
NOONATTACH
Specifying NOONATTACH indicates that when a program named ONATTACH exists
in the workspace, Oracle OLAP should not execute that program.
AUTOGO progname
When you do not specify progname, the AUTOGO clause automatically runs a program
named AUTOGO if one exists in the attached workspace. When you do specify
progname, the AUTOGO clause automatically runs the specified program in the
attached program. See "Programs Executed When Attaching Analytic Workspaces" on
page 9-109 for more information.
NOAUTOGO
(Default) Specifying NOAUTOGO indicates that there is no Autogo program. This
syntax is provided for clarity in your programs. You can get the same results by not
specifying AUTOGO progname.
RO
(Default) Specifies that the workspace is attached in read-only access mode. Users can
make private changes to the data in the workspace to perform what-if analysis but
cannot commit any of these changes.
an analytic workspace that is attached read-only can be accessed simultaneously by
several sessions. The read-only attach mode is compatible with the read/write and
multiwriter access mode. A user can attach an analytic workspace in read-only mode
when other users have the workspace attached in either read/write and multiwriter
access mode. Likewise, a user cannot attach an analytic workspace in read/write
exclusive mode when another user has it attached in read-only mode. When you
attach an analytic workspace with read-only access, Oracle OLAP executes a program
called PERMIT_READ, when it finds one in the workspace.
THAW
Specifies that Oracle OLAP attach the current view of an analytic workspace that was
frozen using an AW FREEZE command without the NOTHAW keyword.
RW
Specifies that the workspace is attached in read/write access mode. Only one user can
have an analytic workspace open in read/write at a time. The user has to commit
either all or none of the changes made to the workspace.
an analytic workspace that is attached read/write non-exclusive can be accessed
simultaneously by several sessions. The read/write non-exclusive attach mode is only
compatible with the read-only access mode. A user can attach an analytic workspace
in read/write mode when other users have the workspace attached in read-only
mode; however, a user cannot attach an analytic workspace in read/write mode when
another user has it attached in any other mode. Likewise, a user cannot attach an
analytic workspace in any mode other than read-only when another user has it
attached in read/write non-exclusive mode. When you attach an analytic workspace
with read/write access, Oracle OLAP executes a program called PERMIT_WRITE,
when it finds one in the workspace.
RWX
Specifies that the workspace is attached in read/write exclusive access mode. Only
one user can have an analytic workspace open in read/write exclusive at a time. The
user has to commit either all or none of the changes made to the workspace.
an analytic workspace that is attached read/write exclusive cannot be accessed by any
other sessions. The read/write exclusive attach mode is not compatible with any other
access modes. A user cannot attach an analytic workspace in read/write exclusive
mode when another user has it attached in any mode. Likewise, a user cannot attach
an analytic workspace in any other mode when another user has it attached in
read/write exclusive mode. When you attach an analytic workspace with read/write
access, Oracle OLAP executes a program called PERMIT_WRITE, when it finds one in
the workspace.
MULTI
Specifies that the workspace is attached in multiwriter access mode. An analytic
workspace that is attached in multiwriter mode can be accessed simultaneously by
several sessions. In multiwriter mode, users can simultaneously modify the same
analytic workspace in a controlled manner by specifying specify the attachment mode
(read-only or read/write) for individual variables, relations, valuesets, and
dimensions.
The multiwriter attach mode is only compatible with read-only and multiwriter
modes. A user cannot attach an analytic workspace in multiwriter mode when another
user has it attached in read/write or exclusive modes. Likewise, a user cannot attach
an analytic workspace in read/write or exclusive mode when another user has it
attached in multiwriter mode.
WAIT
NOWAIT
Specifies whether Oracle OLAP waits for an analytic workspace to become available
for access when you request access to an analytic workspace that is being used with
read/write exclusive access or when you request read/write access to an analytic
workspace that is already being used with read/write non-exclusive access. NOWAIT
(the default) causes Oracle OLAP to produce an error message indicating that the
workspace is unavailable. When you specify WAIT, Oracle OLAP will wait for the
workspace to become available for access. The number of seconds that Oracle OLAP
will wait for access depends on the value of the Oracle OLAP AWWAITTIME option.
FIRST
(Default) Makes the workspace you are attaching the current workspace in the
workspace list.
LAST
Puts the workspace after the current workspace in the workspace list and before the
EXPRESS workspace. When there are other workspaces attached before the EXPRESS
workspace, the specified workspace is attached after them. When there are no
workspaces before the EXPRESS workspace, LAST makes the specified workspace the
current one. LAST ignores any workspaces after the EXPRESS workspace.
AFTER workspace
BEFORE workspace
Let you specify the position in the workspace list of the newly attached workspace
relative to an analytic workspace that is already attached. Use AFTER, rather than
LAST, to attach an analytic workspace after the EXPRESS workspace. When specifying
BEFORE puts the workspace first, the workspace becomes the current one.
The order of the workspace list determines the order in which workspaces will be
searched when Oracle OLAP looks for programs or objects named in programs.
PASSWORD password
Specifies a password to be checked in a startup program in order to give or deny
access to the workspace being attached. See "Startup Programs" on page 4-14.
Notes
example, assume that there is an analytic workspace that has two variables: actual and
budget. Assume also that you have populated actual and then issued UPDATE and
COMMIT commands. At this point in time, there is data only in actual.
When you are attaching a frozen analytic workspace in read multi mode, you can use
the multi-writer commands (RESYNC and ACQUIRE) to retrieve up-to-date versions
of the data whether or not you have specified AW FREEZE with the NOTHAW
keyword.
Examples
END
The programs that execute when you attach awtest vary depending on the
attachment mode and keywords in the AW ATTACH statement:
■ When you attach awtest in read/write mode using the following statements.
AW DETACH awtest
AW ATTACH awtest RW
First the PERMIT_WRITE program executes, and then the ONATTACH program
executes.
■ When you attach awtest in read-only mode using the following statements.
AW DETACH axuserwtest
AW ATTACH awtest NOONATTACH RO
First the PERMIT_READ program executes, and then the ONATTACH program
executes.
■ When you attach awtest in read-only mode using the following statements.
AW DETACH awtest
AW ATTACH awtest ONATTACH myattach RO
First the PERMIT_READ program executes, and then the MYATTACH program
executes.
■ When you attach awtest in multi mode using the following statements.
AW DETACH awtest
AW ATTACH awtest MULTI
First the PERMIT_WRITE program executes, and then the ONATTACH program
executes.
■ When you attach awtest in read-only mode using the following statements.
AW DETACH awtest
AW ATTACH awtest AUTOGO
To run the ONATTACH program, attach the analysis workspace with the following
statement.
AW ATTACH analysis
When you issue an AW LIST statement, you can see from the following output, that all
three of your analytic workspaces are attached.
ANALYSIS R/W CHANGED XUSER.ANALYSIS
REVENUE R/W UNCHANGED XUSER.REVENUES
EXPENSES R/W UNCHANGED XUSER.EXPENSES
EXPRESS R/O UNCHANGED SYS.EXPRESS
AW CREATE
The AW CREATE command creates a new workspace and make it the current
workspace in your session.
Oracle OLAP automatically executes a COMMIT as part of its procedure for creating
an analytic workspace. Previously attached workspaces move down in the list of
attached workspaces to make room for the new one at the top of the list.
Also, if the current analytic workspace is creating a different analytic workspace and
the current workspace contains a program named TRIGGER_AW, then the TRIGGER_
AW program executes.
Note: Before you can create an analytic workspace you need the
appropriate SQL GRANT privileges as outlined in "Privileges Needed
to Create and Delete Analytic Workspaces" on page 1-4.
Syntax
AW CREATE workspace [position] [UNPARTITIONED|PARTITIONS n] -
[SEGMENTSIZE n [K, M, or G]] [TABLESPACE tblspname]
where position specifies the workspace's position in the workspace list and is one of the
following values. (FIRST is the default.)
AFTER workspace
BEFORE workspace
LAST
FIRST
Arguments
workspace
The name of the analytic workspace. Workspace names:
■ Can be from 1 - 26 characters in length. All characters must come from the
database character set and must be letters, numerals, or underscores.
■ Cannot begin with a numeral and cannot be reserved words in the DML. (Use
RESERVED to identify reserved words.)
FIRST
(Default) Makes the workspace you are attaching the current workspace.
LAST
Puts the workspace after the current workspace and before the EXPRESS workspace.
When there are other workspaces attached before the EXPRESS workspace, the
specified workspace is attached after them. When there are no workspaces before the
EXPRESS workspace, LAST makes the specified workspace the current one. LAST
ignores any workspaces after the EXPRESS workspace.
AFTER
BEFORE
Specify the position of the newly attached workspace relative to an analytic workspace
that is already attached. Use AFTER, rather than LAST, to attach an analytic
workspace after the EXPRESS workspace. When specifying BEFORE puts the
workspace first, the workspace becomes the current one.
The order of the workspace list determines the order in which workspaces will be
searched when Oracle OLAP looks for programs or objects named in programs.
UNPARTITIONED
Specifies that the relational table that is the analytic workspace is not a partitioned
table.
PARTITIONS n
Specifies that the relational table that is the analytic workspace is a hash partitioned
table with n partitions. Specifying a value of 0 (zero) for n is the same as specifying
UNPARTITIONED. The default value of n is 8.
SEGMENTSIZE n [K, M, or G]
With the CREATE keyword, this argument sets the maximum size of each segment for
the workspace being created. When you do not specify K, M, or G, the value you specify
for n is interpreted as bytes. When you specify K, M, or G after the value n, the value is
interpreted as kilobytes, megabytes, or gigabytes, respectively.
TABLESPACE tblspname
Specifies the name of an Oracle Database tablespace in which the analytic workspace
is created.
Notes
Examples
AW DELETE
The AW DELETE command deletes a detached analytic workspace from the Database.
It is important to note that Oracle OLAP automatically executes a COMMIT as part of
its procedure for deleting an analytic workspace. The DELETE keyword executes
successfully only when no user has the workspace attached.
Syntax
AW DELETE workspace
Arguments
workspace
The name of the analytic workspace. You must specify the name; you cannot specify
an alias.
Notes
Examples
AW DETACH
The AW DETACH command removes an analytic workspace from the workspace list.
When you remove the first workspace, the second workspace becomes the current
workspace (unless it is the EXPRESS workspace). When you detach an analytic
workspace, changes that were made before an UPDATE was issued remain in the
Database and become permanent with the next COMMIT. When changes were made
after the UPDATE was issued, they are discarded.
Syntax
AW DETACH [CACHE|NOCACHE] workspace
Arguments
CACHE
Specifies that the analytic workspace is cached if there have been no changes to it since
it was attached. (Default)
NOCACHE
Specifies that the analytic workspace is not cached even if there have been no changes
to it since it was attached.
workspace
The name of the analytic workspace. You can specify either an analytic workspace
name or an analytic workspace alias, depending on the keywords you are using.
Notes
Cache Size
By default the list of cached analytic workspaces is two. In other words, by default
only two analytic workspaces can be on the cached at one time and as new workspaces
are added to the cache list, earlier worksapces are removed. For example, assume that
you have detached two analytic workspaces in the following order: 1) mywk1, 2)
mywk2. Now you issue an AW DETACH CACHE command for mywk3. Oracle OLAP
removes mywk1 from the cache and the cache list and caches mywk3 adding it to the
cachelist after mywk2.
You can change the size of the cache by using the event number 37372 where level is
the number of analytic workspaces to retain. Specify a level of 1024 to disable the cache
entirely. Not determined for beta: Is this information valid to regular developers?
Examples
AW FREEZE
The AW FREEZE command commits the current transaction (if any) and sets a flag
that specifies that the analytic workspace is the default attach version of the
workspace. Later, when a request is made to attach the workspace in read only or read
multi mode, Oracle OLAP attaches this flagged generation of the analytic workspace.
Syntax
AW FREEZE [NOTHAW]
Arguments
NOTHAW
Specifies that you cannot specify the THAW keyword with AW ATTACH when you
attach the workspace at a later time.
Notes
Example
No example for beta.
AW LIST
The AW LIST command sends to the current outfile a list of the active workspaces,
along with their update status.
Syntax
AW LIST
Notes
Current Workspace
The name of the current workspace is first on the workspace list and is the name
returned by the AW(NAME) function. (See the AW function for details.) The NAME
dimension includes only the objects in the current workspace. Programs such as
AWDESCRIBE and LISTBY list only objects in the current workspace. When an
analytic workspace is active but not current, you can change and update its data, edit
and run its programs, and modify its objects.
Examples
Assume that you have just connected to Oracle OLAP using the OLAP Worksheet.
You issue an AW LIST statement that returns a value showing that the only attached
analytic workspace is EXPRESS.
AW LIST
EXPRESS R/O UNCHANGED SYS.EXPRESS
Now you create a new analytic workspace and issue another AW LIST statement. You
can see that both the EXPRESS analytic workspace and the newly created analytic
workspace are attached.
AW CREATE myaw
AW LIST
AW PURGE CACHE
The AW PURGE CACHE command detaches any analytic workspaces that are
currently in the cache.
Syntax
AW PURGE CACHE
AW ROLLBACK TO FREEZE
The AW ROLLBACK TO FREEZE makes current the version of the analytic workspace
that was created by the last AW FREEZE command.
Syntax
AW ROLLBACK TO FREEZE
AW SEGMENTSIZE
Syntax
AW SEGMENTSIZE n [K, M, or G] [workspace]
Arguments
workspace
The name of the analytic workspace. You can specify either an analytic workspace
name or an analytic workspace alias, depending on the keywords you are using.
AW THAW
The AW THAW command commits the current transaction (if any) and undoes a
previous AW FREEZE command.
Syntax
AW THAW
AW TRUNCATE
Deletes all of the objects and data from an existing analytic workspace. Oracle also
deallocates all of the table space used by the analytic workspace.
Removing data using AW TRUNCATE can be more efficient and less "destructive"
than deleting an analytic workspace using AW DELETE. For example, when you
remove data using AW TRUNCATE, all of the object privileges that were previously
granted remain. For more information on truncating a table, see the TRUNCATE
statement in Oracle Database SQL Language Reference.
Syntax
AW TRUNCATE workspace
Arguments
workspace
The name of the analytic workspace. You must specify the name; you cannot specify
an alias.
Examples
AWDESCRIBE
The AWDESCRIBE program sends information about the current analytic workspace
to the current outfile. After a summary page, it provides a report in two parts:
■ An alphabetic list of analytic workspace objects showing name, type, and
description.
■ A list of object definitions by object type. Each definition includes the information
you would see when you used the DESCRIBE statement. It also includes a
"Referenced By" list, which indicates any programs or other compilable objects
that call or access the object. In addition, compilable objects have a "References To"
list, indicating the analytic workspace objects that they call or access.
Syntax
AWDESCRIBE
Notes
Examples
BLANK
The BLANK command sends one or more blank lines to the current outfile. BLANK is
typically used only in OLAP DML programs. For example, in a report program,
BLANK is commonly used to insert blank lines that separate headings from data or
that separate groups of data from one another.
Syntax
BLANK [n]
Arguments
n
An INTEGER expression with a value of 0 (zero) or higher, that specifies how many
blank lines should be inserted. When you omit n, Oracle OLAP inserts one blank line.
NA produces an error.
Examples
BREAK
Syntax
BREAK
Notes
Examples
CALL
The CALL command invokes a program. When the program has arguments, which are
always enclosed in parentheses, it passes these arguments to the called program.
Syntax
CALL program-name [(arg ...)]
Arguments
program-name
The name of the program to be called.
arg
One or more optional arguments expected by the called program. These arguments
can be declared in the called program with ARGUMENT, or they can be referenced in
the program with ARG. If the program uses the ARGUMENT statement, when you
use CALL to invoke the program, specify the arguments so that they match the
positions of the arguments declared in the called program.
Notes
Dimension Arguments
When you pass a dimension value or dimension name as an argument, you must
enclose the exact text value in single quotes, for example, 'Jan96'. When the
program arguments are declared with the ARGUMENT statement, you can pass a text
expression that evaluates to a text value.
Examples
Another way to produce the same report is to write a user-defined function that can be
used as an argument to the REPORT statement as illustrated in the following program
named roundup.f.
DEFINE roundup.f PROGRAM INTEGER
PROGRAM
ARGUMENT realval DECIMAL
IF realval EQ INTPART(realval)
THEN RETURN INTPART(realval)
ELSE RETURN INTPART(realval) + 1
END
-------------------MONTH-------------------
LINE Jan95 Feb95 Mar95 Apr95
-------------- ---------- ---------- ---------- ----------
revenue 533,363 572,797 707,198 968,858
cogs 360,811 400,902 478,982 641,716
gross.margin 172,553 171,895 228,217 327,143
marketing 37,370 38,867 51,224 69,439
selling 89,008 86,458 102,233 139,567
r.d 24,308 23,400 39,943 57,186
opr.income 21,868 23,171 34,819 60,952
taxes 15,971 16,320 23,030 27,584
net.income 5,898 6,851 11,789 33,368
CDA
With the CDA command, you can identify or change the current directory object for
your session.
With an established current directory object, you can specify a file identifier in a DML
file access statement without including the name of the directory object. Some
examples of file access statements are FILECOPY, FILEMOVE, FILEDELETE,
EXPORT, and IMPORT.
Syntax
CDA [directory-alias]
Arguments
directory-alias
A text expression that specifies the directory object that you want to be the current one
for your session.
When you do not specify this argument, CDA sends the name of the current directory
object to the current outfile. When there is no current directory object, the statement
reports that fact.
Notes
Examples
CHGDFN
The CHGDFN command enables you to change certain aspects of the definitions of
analytic workspace objects.
Before you can use CHGDFN to change the definition of an object, use CONSIDER to
make that object definition the current definition.
Syntax
CHGDFN desired-change
where desired-change is one of the following:
varname SEGWIDTH length dim...
partitioned-varname {DROP | ADD } (partition-instance...)
partition-template {DEFINE | DELETE [CLEAR] } (partition-instance...)
partition-template RENAME PARTITION old-name new-name
{conjoint | composite} {HASH | BTREE | NOHASH}
concat BASE ADD dimensionlist
conjoint COMPOSITE
composite DIMENSION
dwmqy-dimname { {BEGINNING | ENDING} phase | {EARLIER | LATER} n}
concat [NOT] UNIQUE
varname {ADD |DROP} AGGCOUNT
varname [DROP] NULLTRACKING
Arguments
varname
The name of the variable whose segment size you want to set.
SEGWIDTH
Indicates explicit sizing of a variable's segments. See "Understanding Variable
Segments" on page 9-140 for more information.
partitioned-varname
Specifies the name of a partitioned variable whose partitions you want to modify.
DROP partition-instance
ADD partition-instance
Removes or adds the specified partitions from the partitioned variable. See the
DEFINE VARIABLE command for a complete description of the partition-instance
argument.
DEFINE partition
DELETE [CLEAR] partition-instance
Removes or adds the specified partitions from the partition template object. See the
DEFINE PARTITION TEMPLATE command for a complete description of the
partition-instance argument.
When you include the optional CLEAR keyword, Oracle OLAP also drops any
corresponding partitions in the variables that are partitioned using the partition
template object. In other words, including CLEAR is the same as issuing an additional
CHGDFN statements to DROP the partition from the variables partitioned by it.
length-dim...
Segment width is specified as the maximum number of values in each segment for
each dimension or composite in the variable's dimension list. The first length-dim is the
number of values for the dimension or composite in the first position of the dimension
list in the variable's definition (that is, the fastest-varying dimension or composite), the
second length-dim is the number of values for the dimension or composite in the
second position in the dimension list, and so on.
conjoint
composite
For the index syntax, the name of the conjoint dimension or composite whose index
algorithm you want to change. For the conjoint-to-composite syntax, the name of the
conjoint dimension you want to change to a composite. For the composite-to-dim syntax,
the name of the composite you want to change to a conjoint dimension. You cannot
change a conjoint dimension to a composite when the conjoint is a dimension of a
formula.
BTREE
BTREE64
HASH
NOHASH
Indicates the index algorithm used to load and access values of your conjoint
dimension or composite without losing data in objects defined with the conjoint or
composite. A composite cannot be changed to NOHASH. A conjoint can be changed to
NOHASH only when it was originally defined as HASH. See "Changing the Index
Algorithm of a Conjoint from BTREE to NOHASH" on page 9-141.
HASH, NOHASH, and BTREE are different index algorithms used to load and access
the values of a conjoint dimension or composite. (BTREE64 can only be used with
composites.) HASH is the default for conjoints. The default for composites is
determined by the SPARSEINDEX option, which has a default value of BTREE. The
index algorithm affects the performance of loading and accessing large conjoints or
COMPOSITE
Indicates changing a conjoint dimension into a named composite. There are some
restrictions on changing conjoint dimensions to composites; when a conjoint has the
NOHASH index algorithm or when it has permissions, you cannot change it to a
composite.
DIMENSION
Indicates changing a named composite into a conjoint dimension.
composite_dimension
The name of a composite that has a composite as a base dimension.
dwmqy-dimname
Specifies or changes the phase of a dimension of type DAY, WEEK, MONTH,
QUARTER, or YEAR.
BEGINNING phase
ENDING phase
Specifies the beginning phase or ending phase of a dimension of type DAY, WEEK,
MONTH, QUARTER, or YEAR. You must specify the phase as a date, giving the
month, day, and year, enclosed in single quotes, using any of the input styles that are
valid for variable values with a data type of DATE. When you specify a date with an
ambiguous meaning (such as '03 05 97'), the date is interpreted according to the
current setting of the DATEORDER option. For more information about specifying
dates, see the DATEORDER option.
EARLIER n
LATER n
n is an INTEGER expression that increments or decrements the period on which the
DAY, WEEK, MONTH, QUARTER, or YEAR dimension's phase begins or ends. For
example, for a WEEK dimension whose current begin phase is Monday, specify LATER
2 to change the phase to Wednesday.
[NOT] UNIQUE
When you include NOT, changes a unique concat dimension to a nonunique concat.
When you do not include NOT, changes a nonunique concat dimension to a unique
concat dimension. See the DEFINE DIMENSION CONCAT command for more
information on concat dimensions.
ADD AGGOUNT
Adds an Aggcount variable to the specified variable. See the WITH AGGCOUNT
phrase of the DEFINE VARIABLE command for more information about Aggcount
variables.
DROP AGGOUNT
Removes an Aggcount variable from the specified variable. See the WITH
AGGCOUNT phrase of the DEFINE VARIABLE command for more information about
Aggcount variables.
NULLTRACKING
Adds NA2 bits to the specified variable if the variable does not have NA2 bits. For
more information on NA2 bits and null tracking, see "NA2 Bits and Null Tracking" on
page 9-209.
DROP NULLTRACKING
Removes NA2 bits to the specified variable if the variable has NA2 bits.
Notes
3. Optimally, execute a CHGDFN statement for one of the variables or relations with
this dimension set, and increase the value of the length arguments to the
SEGWIDTH keyword.
4. From the EIF file, import all the values you exported in Step 1.
Examples
For an example of removing null tracking from a variable, see Example 9–103,
"Defining a Variable with Null Tracking" on page 9-219.
Suppose you want to have only one segment in the d.sales variable. You estimate
that the month dimension will eventually have 150 values and the composite will have
100,000. The following statement will create one segment for the d.sales variable.
CHGDFN d.sales SEGWIDTH 150 100000
However, a better way to specify segment size for d.sales is to specify 0 for the
slowest-varying dimension.
CHGDFN d.sales SEGWIDTH 150 0
Suppose you want one segment for a variable defined with a composite and two
dimensions. For example, suppose you have a variable called f.costs with the
following definition.
DEFINE f.costs VARIABLE DECIMAL <geog SPARSE<product channel> time>
You estimate the geog dimension will have 100 values and the composite will have
300,000. You do not have to estimate the number of values for the time dimension,
because it is the slowest-varying dimension. The following statement will create one
segment for the f.costs variable.
CHGDFN f.costs SEGWIDTH 100 300000 0
The following statements add the store_id dimension as a base to the concat
dimension and then report the values of the concat again.
CHGDFN reg.dist.ccd BASE ADD store_id
REPORT W 22 reg.dist.ccd
CLEAR
The CLEAR command deletes the data that you specify for one or more variables.
Syntax
CLEAR [STATUS | {ALL [CACHE]}] [VALUES | {aggdata [USING aggmapname]}] -
FROM {varname [ ( PARTITION partition-name ) ] } [, ... ]
where aggdata is one or more of the following keywords that identifies the type of
aggregated data that you want deleted from the variable.
AGGREGATES
LEAVES
PRECOMPUTES
NONPRECOMPUTES
Arguments
STATUS
Specifies that only the data that is currently in status will be taken into consideration.
(Default)
ALL
Specifies that the command consider all of a variable's data regardless of the current
status. Required when you specify either the CACHE or AGGREGATES keywords.
CACHE
Empties the session cache. When you specify this keyword, you must also specify the
ALL keyword.
VALUES
(Default) Deletes all of a variable's stored data and replaces each deleted data value
with an NA value.
AGGREGATES
Deletes the data in all cells populated by the execution of an AGGREGATE command
or an AGGREGATE function. When you specify this keyword, you must also specify
the ALL keyword.
PRECOMPUTES
For all variables except those dimensioned by a compressed composite, deletes any
data that was calculated when an AGGREGATE command executed and replaces that
data with NA values.
NONPRECOMPUTES
Deletes any data that was calculated on the fly when a AGGREGATE function
executed and replaces that data with NA values.
LEAVES
Deletes the detail-level data, meaning, the "leaf" data.
varname
The name of a variable from which data will be deleted.
aggmapname
The name of the aggmap that should be used.
You must include this phrase to clear a variable that is not a compressed composite or
that does not have an $AGGMAP property. You do not need to specify this phrase to
clear:
■ A variable that is dimensioned by a compressed composite. By default, CLEAR
uses the structure of the compressed composite to clear the variable.
■ A variable that has an $AGGMAP property when you want CLEAR to use the
aggmap specified by that property. If you do not specify a USING phrase for a
variable that has an $AGGMAP property, then CLEAR uses the aggmap specified
by that property.
When you include this phrase for a dimensioned aggmap, the dimensionality of every
variable included in the CLEAR command must be identical to the dimensionality of
the aggmap. In other words, every variable definition must have the same dimensions
in the same order as those in the definition of the aggmap.
PARTITION partition_name
For a partitioned variable, specifies the name of a partition from which you want to
clear data.
Examples
In this example, the VALUES keyword is assumed by default. Therefore, all of the
sales data is deleted and replaced with NA values.
After aggregating both sales and units, you learn that there are certain geographic
regions that none of your users will access. Because geography is the slowest-varying
dimension, you can probably reduce the number of pages needed to store data by
deleting data for the geographic regions that no one will need. This can reduce the size
of your analytic workspace and possibly improve performance.
1. Set the status for each dimension. The only geographic regions that users will need
are New England, Europe, and Australasia. The following statements put all time
periods and all products for every geographic region in the current status, except
for the geographic regions that users need. In other words, the following
statements put all of the data that users do not need to access in status.
LIMIT time TO ALL
LIMIT product TO ALL
LIMIT geography COMPLEMENT 'NewEngland' 'Europe' 'Australasia'
Note that the sales.agg contains a CACHE SESSION command. This means that
Oracle OLAP calculates some of the data at the time a user requests it, and then stores
it in the session cache. To clear this data from the sales variable, use the following
statement.
CLEAR ALL CACHE FROM sales
COMMIT
The COMMIT command executes a SQL COMMIT statement. When you want changes
that you have made in an analytic workspace to be committed when you execute the
COMMIT command, then you must first update the workspace using an UPDATE
statement. UPDATE moves changes from a temporary work area to the database table
in which the workspace is stored. Changes that have not been moved to the table are
not committed. When you do not use UPDATE and COMMIT statements, changes
made to an analytic workspace during your session are discarded when you end your
Oracle session.
When you execute a SQL COMMIT statement in your database session, all changes
made in your session (including all updated changes in workspaces that you have
attached with read/write access) are committed. All committed changes are visible to
other users who subsequently attach the workspace. However, another user's
UPDATE and COMMIT statements do not affect your view of an already attached
workspace.
Syntax
COMMIT
Examples
COMPILE
The COMPILE command generates compiled code for a compilable object, such as a
program, formula, model, or aggmap without running it and saves the compiled code
in the analytic workspace. During compilation, COMPILE checks for format errors, so
you can use COMPILE to help debug your code before running it. COMPILE records
the errors in the current outfile.
However, you are not required to use the COMPILE command before running a
compilable object. When you do not use COMPILE, Oracle OLAP automatically
compiles a compilable object the first time you run it after entering or changing its
contents. This automatic compilation is unnoticeable except for a slight delay while it
is happening. Use the OBJ function with the ISCOMPILED keyword to obtain
information about the compilation status of a compilable object.
Whether you compile an object explicitly with COMPILE or automatically through
running it, the code executes faster whenever you subsequently run the object during
the same session, because the code is already compiled. When you update and commit
your analytic workspace, the compiled code is saved as part of your analytic
workspace and can be used in later sessions. The code thus executes faster the first
time it is run in each later session.
Using COMPILE to compile code without running a compilable object is especially
useful when you are writing code that will be part of a read-only analytic workspace
(that is, a analytic workspace that people can use but not update).
Syntax
COMPILE object-name
Arguments
object-name
The name of a compilable object that you want to compile.
Notes
Compilation Options
A number of options effect compilation. These options are listed in "Compilation
Options" on page 6-5. By setting one or more of these options you can suppress error
messages that appear at compilation time or replace occurrences of THIS_AW with a
specified value.
Deleted Objects
When you delete or rename an object in your analytic workspace, Oracle OLAP
automatically invalidates the compiled code for every statement in a program and
every formula and model that depends on that object. When you try to execute code
that refers to the deleted or renamed object, Oracle OLAP tries to compile the code
again. Unless you have defined a new object with the same name, you will receive an
error message at this time.
When you run a program that contains invalidated code, it is compiled and executed
one statement at a time. To save compiled code for the entire program, use the
COMPILE command to explicitly compile it.
Declarative Errors
COMPILE handles declarative errors differently in programs and models:
■ When a program has a declarative error (for example, when a VARIABLE or ARG
statement follows executable code), COMPILE signals a trappable error
■ When a model has a declarative model (for example, when a model statement has
a DIMENSION statement following an assignment statement) COMPILE does not
signal a trappable error. Instead, the model is not executable.
See the TRAP command for more information on trapping error.s
Advantages of Compiling
Explicit compilation using the COMPILE command offers several advantages over
automatic compilation:
■ For any compilable object, COMPILE generates compiled code without executing
the code in the object.
■ In a program or model, automatic compilation diagnoses an error only in the first
statement that contains an error. It then displays the error message and halts the
execution of a program or the analysis of a model. So each time a program or
model is automatically compiled, only a single error message is displayed. In
contrast, COMPILE checks every statement in a program or model for correct
format, and generates multiple error messages, one for each statement that
contains an error. (In programs, some types of statements cannot be compiled, so
they are exceptions. See "Errors COMPILE Does Not Catch" on page 9-148.) Since
COMPILE shows you every statement that contains at least one error, this
minimizes the number of times you must edit the code to correct all errors.
■ For a model, you may want to examine the results of the compilation or set
options for handling simultaneous equations before you run the model.
Although the statement compiles successfully, you will get an error message at
runtime.
PRGTRACE Option
You can use the PRGTRACE option to check which statements in a program have been
compiled. When you set PRGTRACE to YES and run a program, each statement is
recorded in the current outfile before it is executed. A compiled statement is identified
with an equal sign.
(PRG= program-name) statement
Memory Use
In order for code to compile, all variables referenced in a program (with the exception
of variables in lines containing ampersand substitution) must be loaded into memory.
This means Oracle OLAP reads the definition of every variable you use and stores it in
a portion of available memory that is dedicated for storing object definitions. When
the compilation tries to bind a large variable, this may use a large amount of memory
and create a large EXPTEMP file. When the compilation tries to bind a large number of
large variables, it may fail and Oracle OLAP will record an error message such as
'Insufficient Main Memory'. See the LOAD command for more information about
loading an object's definition into memory.
Examples
Suppose you misspell the dimension month in a LIMIT command in the myprog
program.
LIMIT motnh TO LAST 6
When the COMPILE command encounters this statement, it produces the following
message.
ERROR: (MXMSERR00) Analytic workspace object MOTNH does not exist.
In DEMO!MYPROG PROGRAM:
limit month to last 6
You can edit the program to correct the error and then try to compile it again.
Oracle OLAP identifies both errors and records the following messages.
ERROR: You provided extra input starting at 'REPORT'.
In SALESRPT PROGRAM:
ROW WIDTH 80 CENTER Monthly Report
ERROR: ROWW is not a command.
In SALESRPT PROGRAM:
roww 'Total Sales' TOTAL(sales)
You can now edit the program to correct these errors, enclosing 'Monthly Report'
in single quotes and correcting the spelling of ROWW. Then you can compile the
program again, and save the compiled code as part of your analytic workspace.
CONSIDER
The CONSIDER command identifies a definition as the current definition. This enables
you to add a description, value name format, formula, program, model, permission, or
property to the definition with an LD, VNF, EQ, PROGRAM, MODEL, PERMIT, or
PROPERTY statement.
Syntax
CONSIDER name
Arguments
name
The name of a definition in the current workspace or in an attached workspace.
Notes
Examples
CONTEXT command
The CONTEXT command lets you create and use a context during your Oracle OLAP
session. A context is a means of preserving object values. After you create a context,
you can save the current status of dimensions and the values of options, single-cell
variables, valuesets, and single-cell relations in the context. You can then restore some
or all of the object values from the context. A context exists only for the duration of an
Oracle OLAP session. It is not an analytic workspace object and therefore cannot be
saved as part of any analytic workspace. When a context contains saved values for
objects in a particular analytic workspace, and you detach that analytic workspace,
Oracle OLAP removes those objects from the context. That context retains any saved
values for Oracle OLAP options, as well as objects from other analytic workspaces that
are still attached.
You can use the CONTEXT function to obtain information about a context.
The CONTEXT command and function provide an alternative to the PUSH and POP
statements. With contexts, you can access and update the saved object values, whereas
PUSH and POP simply allow you to save and restore values.
Syntax
CONTEXT context-name [ CREATE | APPLY | DISCARD | {SAVE |DROP|RESTORE} objects]
Arguments
context-name
A text expression that contains the name of the context.
CREATE
Creates a context with the name specified by context-name, which must be unique.
SAVE
Stores the values of the objects specified in objects in the context. You may save the
values of single-cell variables and relations in a context. You cannot use the CONTEXT
command to save the values of dimensioned variables, dimensioned relations, or the
NAME dimension. If you try to save values from these objects, Oracle OLAP produces
an error message.
APPLY
Sets the appropriate objects to the values of all corresponding objects saved in the
context.
DISCARD
Deletes the context.
SAVE
Stores the values of the objects specified in objects in the context.
DROP
Drops the values of the objects specified in objects from the context.
Note: When you delete an Oracle OLAP object during the session, it
is also removed from the context.
RESTORE
Sets whatever objects you specify in objects to the values of the corresponding objects
saved in the context.
objects
One or more object names. Each object name must be separated by a space. When you
are listing several name(s) that will not fit on a single line, you may use the
continuation character to continue the CONTEXT command on additional lines.
Notes
Naming Convention
A suggested programming practice is to name the context after the analytic workspace
with which it is associated.
Examples
The following statements limit product to all its values and produce a report that
lists them all.
LIMIT product TO ALL
REPORT product
The following statements apply the saved context and produce a report that lists only
the values included in the context.
CONTEXT 'democontext1' APPLY
REPORT product
CONTINUE
The CONTINUE command transfers program control to the end of a FOR or WHILE
loop (just before the DO/DOEND statement), allowing the loop to repeat. You can use
CONTINUE only within programs and only with FOR or WHILE.
For more information on controlling program execution, see also "Program
Flow-of-Control" on page 4-5.
Syntax
CONTINUE
Examples
COPYDFN
The COPYDFN program defines a new object in the analytical workspace and uses the
same definition as a specified object in the current workspace or in an attached
workspace.
COPYDFN copies the DEFINE, LD, and PROPERTY lines for any type of object, and it
copies the formula (EQ) of a formula object, and the value name format (VNF) of a
dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR. COPYDFN also
copies the text of a program or model. COPYDFN does not copy the PERMIT lines for
any object, and it does not copy the compiled code of a formula, program, or model.
Syntax
COPYDFN newobject oldobject
Arguments
newobject
The name of the new object to define.
oldobject
The name of the object whose definition you want to copy.
Examples
The statements
COPYDFN newprog oldprog
DESCRIBE newprog
DATE_FORMAT
Note: You can only use this statement with objects that have a
datetime data type that corresponds to a SQL datetime data type.You
cannot use this statement for time dimensions that have a DATE-only
data type that is unique to the OLAP DML.
In order to assign a datetime format template to a definition, the definition must be the
one most recently defined or considered during the current session. When it is not,
you must first use a CONSIDER statement to make it the current definition.
Syntax
DATE_FORMAT [datetime_format_template]
Arguments
datetime_format_template
An expression composed of one or more datetime format elements that specifies the
format for entering and displaying the values of the current object. See Table 9–4,
" Datetime Format Elements" on page 9-157 for the elements that you can specify in the
template. Keep the following points in mind when creating a template:
■ The total length of a datetime format template cannot exceed 22 characters
■ For input format models, format items cannot appear twice, and format items that
represent similar information cannot be combined. For example, you cannot use
'SYYYY' and 'BC' in the same format string.
■ Some of the datetime format elements cannot be used in the TO_* datetime
functions, as noted in Table 2–7, " Datetime Fields and Values" on page 2-9.
■ The following datetime format elements can be used in timestamp and interval
format models, but not in the original DATETIME format model: FF, TZD, TZH,
TZM, and TZR.
■ Many datetime format elements are blank padded to a specific length.
When template is omitted, any existing date format template for the current definition
is deleted and the default datetime format template is used. (See "Default Datetime
Format Template" on page 9-159, for a discussion of the default datetime format
template.)
Notes
Keep the following in mind when using date format element suffixes:
■ When you add one of these suffixes to a datetime format element, the return value
is always in English.
■ Datetime suffixes are valid only to format output. You cannot use them to insert a
date into the Database.
■ BC or AD or B.C. or A.D.
■ AM or PM or A.M or P.M.
The language in which these values are returned is specified either explicitly with the
initialization parameter NLS_DATE_LANGUAGE or implicitly with the initialization
parameter NLS_LANGUAGE. The values returned by the YEAR and SYEAR datetime
format elements are always in English.
The datetime format element D returns the number of the day of the week (1-7). The
day of the week that is numbered 1 is specified implicitly by the initialization
parameter NLS_TERRITORY.
Examples
Assume also that you define a variable named mydatetime and assign it the value of
CURRENT_TIMESTAMP.
DEFINE mydatetime VARIABLE DATETIME
mydatetime = CURRENT_TIMESTAMP
When you report on value of mydatetime, the following value is displayed. This
value has the format determined by the setting NLS_DATETIME FORMAT. It shows
only day, month, and year values in the order specified by
REPORT mydatetime
MYDATETIME
-----------
02-FEB-07
Now you change the date format map for mydatetime by issuing the following
statements.
CONSIDER mydatetime
DATE_FORMAT MON-RRRR-DD-HH24
MYDATETIME
--------------
FEB-2007-02-10
DBGOUTFILE
Syntax
DBGOUTFILE {EOF | TRACEFILE | [APPEND] file-name [NOCACHE]}
Arguments
EOF
Closes the current debugging file, and debugging output is no longer sent to a file.
TRACEFILE
Specifies that the debugging output should be directed to the Oracle trace file, which is
identified by the TRACEFILEUNIT option.
APPEND
Specifies that the output should be added to the end of an existing file. When you omit
this argument and a file exists with the specified name, the new output replaces the
current contents of the file.
file-name
A text expression that is the name of the file to which debugging output should be
written. Unless the file is in the current directory, you must include the name of the
directory object in the name of the file.
Note: Directory objects are defined in the database, and they control
access to directories and file in those directories. You can use a CDA
statement to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
NOCACHE
Specifies that Oracle OLAP should write to the debugging file each time a line is
executed. Without this keyword, Oracle OLAP reduces file I/O activity by saving text
and writing it periodically to the file.
The NOCACHE keyword slows performance significantly, but it ensures that the
debugging file records every line as soon as it is executed. When you are debugging a
program that aborts after a certain line, NOCACHE ensures that you see every line
that was executed.
Examples
PRGTRACE = yes
ECHOPROMPT = yes
DBGOUTFILE 'debug.txt'
After executing these statements, you can run your program as usual. To close the
debugging file, execute this statement.
DBGOUTFILE EOF
In the following sample program, the first LIMIT command has a syntax error.
DEFINE ERROR_TRAP PROGRAM
PROGRAM
TRAP ON traplabel
LIMIT month TO FIRST badarg
LIMIT product TO FIRST 3
LIMIT district TO FIRST 3
REPORT sales
traplabel:
SIGNAL ERRORNAME ERRORTEXT
END
With PRGTRACE and ECHOPROMPT both set to YES and with DBGOUTFILE set to send
debugging output to a file called debug.txt, the following text is sent to the
debug.txt file when you execute the error_trap program.
(PRG= ERROR_TRAP)
(PRG= ERROR_TRAP) TRAP ON traplabel
(PRG= ERROR_TRAP)
(PRG: ERROR_TRAP) LIMIT month TO FIRST badarg
ERROR: BADARG does not exist in any attached database.
(PRG= ERROR_TRAP) traplabel:
(PRG= ERROR_TRAP) SIGNAL ERRORNAME ERRORTEXT
ERROR: BADARG does not exist in any attached database.
With PRGTRACE and ECHOPROMPT both set to YES, Oracle OLAP sends the
following text to the debug.txt file when you execute the ERROR_TRAP program.
The last line in the file is the command to stop recording the debugging information.
error_trap
(PRG= ERROR_TRAP)
(PRG= ERROR_TRAP) trap on traplabel
(PRG= ERROR_TRAP)
DEFINE
The DEFINE command adds a new object to the analytic workspace. This entry
describes the DEFINE command in general. The following entries discuss the use of
the DEFINE command for creating specific types of object:
■ DEFINE AGGMAP
■ DEFINE COMPOSITE
■ DEFINE DIMENSION
■ DEFINE DIMENSION (simple)
■ DEFINE DIMENSION (conjoint)
■ DEFINE DIMENSION CONCAT
■ DEFINE DIMENSION ALIASOF
■ DEFINE FORMULA
■ DEFINE MODEL
■ DEFINE PARTITION TEMPLATE
■ DEFINE PROGRAM
■ DEFINE RELATION
■ DEFINE SURROGATE
■ DEFINE VALUESET
■ DEFINE VARIABLE
■ DEFINE WORKSHEET
Syntax
DEFINE name object-type attributes [AW workspace] [SESSION]
Arguments
name
A TEXT expression that is the name for the new object. Follow these guidelines when
specifying a value for name:
■ The name must consist of 1 to 64 characters. When you are using a multibyte
character set, you can still specify 64 characters even when this requires more than
64 bytes. Each character may be a letter (A-Z), a number (0-9), an underline (_), or
a dot (.). However, the following restrictions apply to the use of these characters:
■ The name cannot consist of a single dot (.) character or a single underscore (_)
character.
■ The name cannot duplicate a reserved word. For more information on
identifying reserved words, see the RESERVED function.
■ The first character in the name cannot be a number.
■ The first character cannot be a dot (.) when the second character is a number.
■ By default Oracle OLAP creates the definition in the current workspace. To create
the definition in a different attached workspace, you can specify a qualified object
name for name or you can use the AW argument to specify the workspace. Do not
use both.
Caution: Oracle OLAP does not warn you when you create an object
that has the same name as an existing object in another attached
workspace.
object-type
The type of object being defined. The default is VARIABLE. The object types are
discussed in the subsections for the DEFINE command.
attributes
Attributes are different for each type of object. The attributes are listed in the entry for
each object type.
AW workspace
The name of an attached workspace in which you wish to define the object. You can
also specify a noncurrent attached workspace using a qualified object name for name.
Do not use this phrase when qualified object name for name.
SESSION
Specifies that the object exists only in the current session. The object is created in the
EXPRESS analytic workspace to which you have read-only access. When you close the
current session, the object no longer exists.
Notes
DEFINE AGGMAP
The DEFINE command with the AGGMAP keyword adds a new aggmap object to an
analytic workspace. An aggmap object is a specification for how Oracle OLAP
allocates or aggregates variable data.
Defining an aggmap merely creates an aggmap object in the analytic workspace; it
does not define the calculation specification. The aggmap specification can either
specify how to aggregate or how to allocate data:
■ For information on coding an aggregation specification, see the AGGMAP
command.
■ For information on coding an allocation specification, see the ALLOCMAP
command.
Syntax
DEFINE aggname AGGMAP [<dims...>][AW workspace][SESSION]
Arguments
aggname
The name of the object that you are defining. For general information about this
argument, see the main entry for the DEFINE command.
AGGMAP
The object type when you are defining an aggmap.
dims
(Optional; retained for compatibility with earlier software versions.) When defining an
aggmap object for aggregation (that is, an AGGMAP-type aggmap), the names of the
dimensions. You cannot specify a conjoint dimension as a base dimension in the
definition or specification for the aggmap.
AW workspace
The name of an attached workspace in which you wish to define the object. For more
about this argument, see the main entry for the DEFINE command.
SESSION
Specifies that the object exists only in the current session. For more information about
this argument, see the main entry for the DEFINE command.
Examples
Assume also that you have defined an aggmap named sales.agg with the following
definition and specification.
DEFINE sales.agg AGGMAP <time, product, geography>
AGGMAP
RELATION time.r PRECOMPUTE (time NE 'Year99')
RELATION product.r PRECOMPUTE (product NE 'All')
RELATION geography.r
CACHE STORE
END
To allocate data from a source to cells in the sales variable that are specified by the
time and product dimension hierarchies, you have created an ASCII disk file called
salesalloc.txt, which contains the following aggmap definition and specification.
DEFINE sales.alloc AGGMAP
ALLOCMAP
RELATION time.r OPERATOR EVEN
RELATION product.r operator EVEN NAOPERATOR HEVEN
SOURCEVAL ZERO
CHILDLOCK DETECT
END
The sales.alloc aggmap is now defined, and it contains the preceding two
RELATION statements, the SOURCEVAL statement and the CHILDLOCK statement.
You end the entry of statements into the aggmap with the END statement. In this
example, you are specifying that the first allocation of source values occurs down the
time dimension hierarchy and that the source value is divided evenly between the
target cells at each level of the allocation. The second allocation occurs down the
product dimension hierarchy, with the source value again divided evenly between
the target cells at each level of the allocation, and when the allocation encounters a
deadlock, the source values is divided evenly between the target cells of the hierarchy
including cells that have a basis value of NA. With the SOURCEVAL statement you
specify that after the allocation, ALLOCATE sets the value of each source cell to zero.
With the CHILDLOCK statement you specify that ALLOCATE detects the existence of
locks on both a parent and a child element of a dimension hierarchy.
You can now use the sales.alloc aggmap with an ALLOCATE command, such as
the following.
ALLOCATE sales USING sales.alloc
The preceding statement does not specify a basis or a target object so ALLOCATE uses
the sales variable as the source, the basis, and the target of the allocation.
DEFINE COMPOSITE
The DEFINE command with the COMPOSITE keyword adds a new named composite
to an analytic workspace. Conceptually, you can think of a composite consisting of
two structures:
■ The composite object itself. The composite contains the dimension-value
combinations (that is, a composite tuples) that Oracle OLAP uses to determine the
structure of any variables dimensioned by the composite.
■ An index between the composite values and its base dimension values.
For a variable that is dimensioned by composite, Oracle OLAP creates array elements
(that is, variable cells) only for those dimension values that are stored in the tuples of
the composite; it does not create a cell for every value in the base dimensions. Data for
the variable is stored in order, cell by cell, for each tuple in the composite. From the
perspective of data storage, each combination of base dimension values in a composite
is treated like the value of a regular dimension. This means that when you define a
variable with one regular dimension and one composite, the data for the variable is
stored as though it was a two-dimensional variable. Using composites to reduce the
number of elements created for a variable results in more efficient data storage.
Syntax
DEFINE name COMPOSITE <dims...> [AW workspace] [index-algorithm] [SESSION]
where index-algorithm specifies the algorithm that Oracle OLAP uses to create an index
that relates the composite values to its base dimension values. When you omit this
optional argument, Oracle OLAP uses the value specified by the SPARSEINDEX
option. Valid values for index-algorithm are:
BTREE
BTREE64
COMPRESSED
HASH
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
COMPOSITE
The object type when you are defining a named composite.
dims
The names of two or more dimensions that you want to be the base dimensions of the
composite. When you specify COMPRESSED as the value of index-algorithm, at least
one of the dimensions must be a hierarchal dimension.
The order of the dimensions in dims varies by the value you specify for index-algorithm:
AW workspace
The name of an attached workspace in which you wish to define the object. For more
information about this argument, see the main entry for the DEFINE command.
BTREE
Specifies the creation of a b-tree index to relate composite values to base dimension
values. BTREE is the standard indexing method for composites. For a variable that is
dimensioned by a BTREE composite, Oracle OLAP creates array elements (that is,
variable cells) only for those dimension values that are stored in the tuples of the
composite; it does not create a cell for every value in the base dimensions.
BTREE64
Specifies the creation of a highly-scalable b-tree index to relate composite values to
base dimension values. For a variable that is dimensioned by a BTREE64 composite,
like a BTREE composite, Oracle OLAP creates array elements (that is, variable cells)
only for those dimension values that are stored in the tuples of the composite; it does
not create a cell for every value in the base dimensions. However, unlike a BTREE
composite, a BTREE64 composite supports b-trees greater than 2 gigabytes.
COMPRESSED
Specifies the creation of a compressed index to relate composite values to base
dimension values. You specify COMPRESSED only when you want to create a
composite for a variable that has at least one hierarchical dimension is specified in
dims and that will be aggregated.
A compressed composite contains one composite tuple for each set of base dimension
values that identifies non-NA detail data in the variables that use it. Additionally, for
variables dimensioned by compressed composite Oracle OLAP reduces redundancy in
the variable, composite, and composite index by creating a physical position in the
composite only for those tuples that represent a parent with more than one descendant.
Oracle OLAP then creates an index between this composite structure and the base
dimensions and uses this composite structure as the dimension of the variable. Since
the actual structure of a compressed composite is smaller than that of a b-tree or hash
composite, a variable dimensioned by a compressed composite is also smaller than a
variable dimensioned by a b-tree or hash composite. Also, since the index for a
compressed composite only has nodes for parents with more than one descendant, the
index of a compressed composite has fewer levels and is smaller than the index of a
b-tree composite. Although performance varies depending on the depth of the
hierarchies and the order of the dimensions in the composite, aggregating variables
defined with compressed composites is typically much faster than aggregating
variables defined with b-tree or hash composites.
HASH
Specifies the creation of a hash index to relate composite values to base dimension
values. HASH is rarely used and, then, typically, only when the composite has two or
three dimensions. For a variable that is dimensioned by a b-tree or hash composite,
Oracle OLAP creates array elements (that is, variable cells) only for those dimension
values that are stored in the tuples of the composite; it does not create a cell for every
value in the base dimensions.
SESSION
Specifies that the object exists only in the current session. When you close the current
session, the object no longer exists.
Notes
Shared Composites
You can use the same b-tree or hash composite to dimension several variables.
(Compressed composites cannot be shared in this manner.) The actual sparsity of a
variable dimensioned by a b-tree or hash composite varies depending on whether or
not the composite is an unshared composite or a shared composite:
■ An unshared composite is a composite that is used to dimension only one
variable. All types of composites (that is, b-tree, hash, and compressed
composites) can be unshared composites. An unshared composite is populated
only when the variable that uses it is populated. Consequently, an unshared
composite perfectly reflects the sparsity of the variable that it is used to dimension.
It only has the dimension value combinations for each non-NA value in that
variable.
■ A shared composite is a composite that is used to dimension more than one
variable. A shared composite can be either a b-tree or hash composite; it cannot be
a compressed composite. A shared composite is populated when any of the
variables that use it are populated. A shared composite has all of the dimension
value combinations for non-NA values for all of the variables that it dimensions. A
shared composite reflects the sparsity of all of the variable that it is used to
dimension. Typically, therefore, variables dimensioned by shared composites are
not perfectly sparse variables.
When the size of variables is important, when you have variables that will be sparse
along the same dimensions, but will have significantly different patterns of sparsity,
define different composites for the different variables.
Examples
This section contains a simple example of creating a named b-tree composite. For
examples of using composites to dimension variables, see Example 9–98, "Defining a
Variable Dimensioned by an Uncompressed Composite" on page 9-213 and
Example 9–99, "Defining a Variable Dimensioned by a Compressed Composite" on
page 9-214.
DEFINE DIMENSION
The DEFINE command with the DIMENSION keyword adds a new dimension object
to an analytic workspace. A dimension is a list of values that provides an index to the
data.
Because the syntax of the DEFINE DIMENSION command is different depending on
the type of the dimension that you are defining, four separate entries are provided:
■ DEFINE DIMENSION (simple) for defining a dimension with unique values of the
same data type.
■ DEFINE DIMENSION (DWMQY) for defining a non-hierarchical dimension
whose values represent a time period (day, week, month, quarter, or year).
■ DEFINE DIMENSION (conjoint) for defining a dimension over two or more other
base dimensions when the base dimensions do not contain duplicate values or
have different data types and when you want to explicitly specify the dimension
value combinations.
■ DEFINE DIMENSION CONCAT for defining a dimension over two or more other
base dimension when the base dimensions contain duplicate values or different
data types or when you want Oracle OLAP to automatically populate the
dimension value combinations.
■ DEFINE DIMENSION ALIASOF for defining an alias for a simple dimension.
Syntax
DEFINE name DIMENSION type [TEMP] [AW workspace] [SESSION]
where type is the data type of the dimension. The syntax of type varies depending on
the data type:
TEXT [WIDTH n]
NTEXT [WIDTH n]
ID
INTEGER
NUMBER [(precision , scale)]
DATETIME [( truncation-code )]
TIMESTAMP [( truncation-code )]
TIMESTAMP_TZ [( truncation-code )]
TIMESTAMP_LTZ [( truncation-code )]
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
DIMENSION
The object type when you are defining a dimension.
TEXT
Specifies that the values of the dimension have the TEXT data type which is equivalent
to the CHAR and VARCHAR2 data types in Oracle Database. This data type stores up
to 4000 bytes for each line in the database character set.
NTEXT
Specifies that the values of the dimension have the NTEXT data type which is
equivalent to the NCHAR and NVARCHAR2 data types in the Oracle Database. This
data type stores up to 4000 bytes for each line in UTF-8 character encoding.
ID
Specifies a special text data type that stores up to 8 single-byte characters for each line
in the database character set.
WIDTH n
For TEXT or NTEXT dimensions, the width, in bytes, of the storage area of each value
of an object. Valid width values are 1 through 4000. Specify a fixed width only when
you are certain that the values of a particular dimension are of similar size. When a
value exceeds the specified width, it will be truncated.
INTEGER
Specifies that the values of the dimension have the INTEGER data type. The data type
for a dimension with values that are identified by their numeric position (1, 2, and so
on). A data type of INTEGER means that the dimension has no character values. For
ease of use, you should use a text or time period data type, when possible.
NUMBER
Specifies that the values of the dimension have the NUMBER data type. A NUMBER
dimension differs from other dimensions in that its values cannot be specified by
position, only by value. To specify the values of a NUMBER dimension by position, you
can define an INTEGER type dimension surrogate for the NUMBER dimension.
precision
The total number of digits a value of type NUMBER can have.
scale
The number of digits a value of type NUMBER can have to the right of a decimal point.
For example, when you specify a precision of 7 and a scale of 2, then the highest value
that the dimension can have is 99999.99. When you specify a precision value, but do
not specify a scale value, then the scale is 0.
DATETIME
Specifies that the values of the dimension have the DATETIME data type.
TIMESTAMP
Specifies that the values of the dimension have the TIMESTAMP data type.
TIMESTAMP_TZ
Specifies that the values of the dimension have the TIMESTAMP_TZ data type.
TIMESTAMP_LTZ
Specifies that the values of the dimension have the TIMESTAMP_LTZ data type.
truncation_code
A text expression that specifies one of the format models shown in Table 8–6,
" Datetime Format Templates for the ROUND and TRUNC Date Functions" on
page 8-124. A format model indicates how the date and time number should be
truncated.
TEMP
Indicates that the dimension's values are only temporary and only for the current
session. The dimension has a definition in the current workspace and can contain
values during the current session. However, when you update and commit, only the
definition of the dimension is saved. When you leave end your session or switch to
another workspace, the data values are discarded. Each time you start the workspace,
the values of a temporary dimension are NA.
AW workspace
The name of an attached analytic workspace in which you wish to define the
dimension. Any objects dimensioned by the dimension must be defined in the same
workspace. For general information about this argument, see the main entry for the
DEFINE command.
SESSION
Specifies that the object exists only in the current session. When you close the current
session, the object no longer exists.
Notes
a variable with one or more composites or conjoint dimensions. See the DEFINE
COMPOSITE and DEFINE DIMENSION (conjoint) commands.
Examples
Note: When you want to aggregate over time do not define the time
dimension as a DWMQY dimension since you cannot aggregate over
dimensions of this type. Instead, define the time dimension as a
hierarchical dimension of type TEXT or NTEXT.
Syntax
DEFINE name DIMENSION dwmqy [TEMP] [AW workspace] [SESSION]
where dwmqy is the time period of the dimension. The valid types for dwmqy are DAY,
WEEK, MONTH, QUARTER, and YEAR. Each type indicates the span of the time
period represented by the individual dimension values of the dimension. The syntax
of dwmqy varies depending on the type:
DAY
[multiple] WEEK [BEGINNING phase ] [ ENDING phase ]
[multiple] MONTH [BEGINNING phase ] [ ENDING phase ]
QUARTER [BEGINNING phase ] [ ENDING phase ]
YEAR [BEGINNING phase ] [ ENDING phase ]
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
DIMENSION
The object type when you are defining a dimension.
multiple
For the WEEK and MONTH types, specifies time periods that span a multiple number
of weeks or months. With the WEEK keyword, multiple can be an INTEGER from 2 to
52. With the MONTH keyword, multiple can be 2, 3, 4, or 6.
BEGINNING phase
ENDING phase
Specifies the beginning or ending phase of a WEEK, MONTH, QUARTER, or YEAR
dimension:
■ For single weeks, phase can be a day of the week (corresponding to a name in the
DAYNAMES option) or a date.
■ For multiple weeks, phase must be a date.
■ For months, quarters, or years, phase must be a month, expressed as a month name
(corresponding to a name in the MONTHNAMES option) or as a date.
When you specify phase as a date, you give the month, day, and year, enclosed in
single quotes, using any of the input styles that are valid for variable values with a
data type of DATE. When you specify a date with an ambiguous meaning (such as
'03 05 97'), the date is interpreted according to the current setting of the
DATEORDER option.
TEMP
Indicates that the dimension's values are only temporary and only for the current
session. The dimension has a definition in the current workspace and can contain
values during the current session. However, when you update and commit, only the
definition of the dimension is saved. When you leave end your session or switch to
another workspace, the data values are discarded. Each time you start the workspace,
the values of a temporary dimension are NA.
AW workspace
The name of an attached analytic workspace in which you wish to define the
dimension. Any objects dimensioned by the dimension must be defined in the same
workspace. For general information about this argument, see the main entry for the
DEFINE command.
SESSION
Specifies that the object exists only in the current session. When you close the current
session, the object no longer exists.
Notes
dimension of type YEAR, Oracle OLAP automatically defines a relation that associates
all the MONTH values that fall within a particular year with the corresponding value
of the YEAR dimension.
Examples
After defining the dimension, you can give it a description and a VNF (value name
format). You can use a MAINTAIN statement to give values to the dimension.
LD Fiscal years ending June 30
VNF 'FY<ff>'
MAINTAIN fyear ADD 'FY97' 'FY00'
Example 9–82 Using the Default Phrase for Date in an ENDING Phrase
This example illustrates how DEFINE automatically supplies a phase that begins with
the date '31DEC1899' when you define a multiple-period dimension of type WEEK
but you do not specify a BEGINNING phase or an ENDING phase argument. Assume
that you issue the following statements
DEFINE twoweek DIMENSION 2 WEEK
DESCRIBE TWOWEEK
When you issue a DESCRIBE statement for twoweek, the following output is
produced.
DEFINE twoweek DIMENSION 2 WEEK ENDING '13Jan1900'
Syntax
DEFINE name DIMENSION <dims. . .> index-algorithm [AW workspace] [SESSION]
where index-algorithm specifies the algorithm that Oracle OLAP uses to create the index
into the conjoint dimension. Valid values for index-algorithm are:
BTREE
NOHASH
HASH
Arguments
name
The name of the conjoint dimension you are defining. For general information about
this argument, see the main entry for the DEFINE command.
DIMENSION
The object type when you are defining a conjoint dimension.
dims
One or more previously defined dimensions that are the base dimensions of the
conjoint dimension. Specify the dimensions in fastest to slowest-varying order as
discussed in "Effect of Dimension Order on Variable Storage and Statement Looping"
on page 9-210. You must enclose the dimension list in angle brackets.
Typically, a base dimension of a conjoint dimension is a simple dimension, but it can
also be another conjoint dimension. However, when you do have a simple dimension
for one of the values of dims, you cannot also specify for dims a conjoint or concat
dimension that has same simple dimension as one of its bases.
BTREE
Specifies the creation of a b-tree index to relate conjoint values to base dimension
values. Typically, you specify BTREE as the index algorithm for a conjoint dimension.
NOHASH
Specifies that Oracle OALP does not create an index for the conjoint dimension, but
instead uses internal structures to relate conjoint values to base dimension values.
Because no index is created for NOHASH, NOHASH decreases the number of
structures associated with the conjoint dimension; and, in many cases, decreases the
time it takes to load and access conjoint dimension values. However, NOHASH is
used infrequently, as it is a complicated algorithm that, on occasion, can result in
unpredictable performance.
HASH
(Default, but not recommended.) Specifies the creation of a has index to relate conjoint
values to base dimension values.
Tip: Even though HASH is the default, typically, you specify BTREE
as the index algorithm for a conjoint dimension. When your conjoint
dimension has more than 3 base dimensions, for best performance,
use BTREE instead of HASH.
AW workspace
The name of an attached analytic workspace in which you wish to define the
dimension. Any objects dimensioned by the dimension must be defined in the same
workspace. For general information about this argument, see the main entry for the
DEFINE command.
SESSION
Specifies that the object exists only in the current session. When you close the current
session, the object no longer exists.
Notes
conjoint dimensions, but you must limit the base dimensions of a composite to
limit your view to a subset of composite values; and you can define relations using
conjoint dimensions, but not composites.
For more information on composites, see the DEFINE COMPOSITE command.
Examples
To define a conjoint dimension named cityandstate and add values to it use the
following OLAP DML statements.
DEFINE cityandstate DIMENSION <city state>
MAINTAIN cityandstate add <'Princeton' 'New Jersey'>
MAINTAIN cityandstate add <'Newark' 'New Jersey'>
MAINTAIN cityandstate add <'Patterson' 'New Jersey'>
MAINTAIN cityandstate add <'New York' 'New York'>
MAINTAIN cityandstate add <'Chicago' 'Illinois'>
MAINTAIN cityandstate add <'Princeton' 'Indiana'>
Tip: The way that you specify the values of concat dimension varies
depending on whether the concat dimension is a unique or nonunique
concat dimension. See "Specifying a Value of a CONCAT Dimension"
on page 2-27 for more information.
Syntax
DEFINE name DIMENSION CONCAT(basedimlist. . .)[UNIQUE] [TEMP] [AW workspace] [SESSION]
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
DIMENSION CONCAT
The object type when you are defining a concat dimension.
basedimlist
One or more previously-defined dimensions that are the base dimensions of the concat
dimension. Specify the dimensions in fastest to slowest-varying order as discussed in
"Effect of Dimension Order on Variable Storage and Statement Looping" on
page 9-210. You must enclose the dimension list in parenthesis.
The types of dimensions that can be base dimensions varies depending on whether
you are defining a unique or nonunique concat dimension:
■ When defining a non-unique concat dimension, a base dimension can be a simple
dimension of any data type, a conjoint dimension, or another concat dimension.
■ When defining a unique concat dimension, a base dimension can be a simple
dimension of type TEXT or ID, or another unique concat dimension as long as the
data values of all of the base dimensions are unique and not duplicated in any of
the base dimensions.
A composite cannot be the base dimension of a concat dimension.
Simple dimensions and conjoint dimensions are the bottom-level components of a
concat dimension. When you specify a concat dimension as a base dimension when
defining a concat, then the base dimensions of that inner concat are component
dimensions of the outer concat.
The same dimension cannot appear more than once in the component dimensions of a
concat dimension. However, in a concat, a conjoint dimension is an indivisible unit
and Oracle OLAP does not consider the base dimensions of a conjoint in the definition
of the concat. Therefore, a simple dimension can be a base dimension of a conjoint and
that conjoint and the same simple dimension can be base dimensions (or components)
of a concat dimension.
UNIQUE
Specifies that the text values of the base dimensions are unique. When you specify this
keyword, the dimensions listed in basedimlist must be either simple text or ID
dimensions or unique concat dimensions.
TEMP
Indicates that the dimension's values are only temporary and only for the current
session. The dimension has a definition in the current workspace and can contain
values during the current session. However, when you update and commit, only the
definition of the dimension is saved. When you leave end your session or switch to
another workspace, the data values are discarded. Each time you start the workspace,
the values of a temporary dimension are NA.
AW workspace
The name of an attached analytic workspace in which you wish to define the
dimension. Any objects dimensioned by the dimension must be defined in the same
workspace. For general information about this argument, see the main entry for the
DEFINE command.
SESSION
Specifies that the object exists only in the current session. When you close the current
session, the object no longer exists.
Examples
You define a concat dimension based on these dimensions using the following OLAP
DML statement.
DEFINE geog DIMENSION CONCAT(region cityandstate)
Syntax
DEFINE name DIMENSION ALIASOF dimension [TEMP] [AW workspace] [SESSION]
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
DIMENSION ALIASOF
The object type when you are defining a dimension. Indicates that the dimension
being defined is an alias for another dimension.
dimension
The name of a simple dimension for which you want to define an alias. This
dimension cannot be a concat or conjoint dimension, composite, or surrogate.
TEMP
Indicates that the dimension's values are only temporary and only for the current
session. The dimension has a definition in the current workspace and can contain
values during the current session. However, when you update and commit, only the
definition of the dimension is saved. When you leave end your session or switch to
another workspace, the data values are discarded. Each time you start the workspace,
the values of a temporary dimension are NA.
AW workspace
The name of an attached analytic workspace in which you wish to define the
dimension. Any objects dimensioned by the dimension must be defined in the same
workspace. For general information about this argument, see the main entry for the
DEFINE command.
SESSION
Specifies that the object exists only in the current session. When you close the current
session, the object no longer exists.
Examples
Note that you do not have to explicitly populate the alias dimension (that is, leader).
When you populate the employee dimension, Oracle OLAP also populates its alias
dimension leader.
EMPLOYEE
--------------
Adams
Baker
Charles
LEADER
--------------
Adams
Baker
Charles
You can limit a dimension without limiting its alias; or limit an alias without limiting
the dimension for which it is an alias. For example, when you issue the following
statements to limit employee to Adams for project ProjA in year 2001, a report
displays all of the leaders of the projects that Adams participates in.
LIMIT year TO '2001'
LIMIT employee TO 'Adams'
LIMIT project TO 'projA'
REPORT DOWN leader ACROSS employee: hours
PROJECT: projA
YEAR: 2001
--HOURS---
-EMPLOYEE-
LEADER Adams
-------------- ----------
Adams 1
Baker 2
Charles 1
On the other hand, when you limit leader to Adams for project ProjA in year
2001, a report displays all of the employees of the projects that Adams leads.
LIMIT employee TO ALL
LIMIT leader TO 'Adams'
LIMIT project TO 'projA'
REPORT DOWN leader ACROSS employee: hours
PROJECT: projA
YEAR: 2001
-------------HOURS--------------
------------EMPLOYEE------------
LEADER Adams Baker Charles
-------------- ---------- ---------- ----------
Adams 1 3 3
DEFINE FORMULA
The DEFINE command with the FORMULA keyword adds a new formula object to an
analytic workspace. You define a formula to save an expression. A formula can take
the place of an expression you use repeatedly. The name of the formula takes the place
of the text of the expression. Oracle OLAP does not store the data for a formula in a
variable; instead it is calculated at runtime each time it is requested.
Syntax
DEFINE name FORMULA {expression | datatype [<dimensions...>]} [AW workspace] [SESSION]
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
FORMULA
The object type when you are defining a formula.
expression
The calculation to be performed to produce values when you use the formula. It can be
any valid expression, including a constant or the name of a variable as described in
Chapter , "OLAP DML Expressions".
You can specify an expression for a formula when you define it or after you define
using an EQ statement. When you define a formula without specify an expression, a
formula returns NA with the specified data type.
datatype
The intended data type for the formula when you do not specify a value for expression.
You can use any of the data types that apply to variables.
When you include an expression in the formula definition, DEFINE automatically
determines the data type for a formula defined using expression. Later, when you add
the expression using an EQ statement, its data type should match the type you specify
now. When it does not, DEFINE converts the output to the specified type.
dimensions
The dimensions of the formula. Enclose the list in angle brackets. The dimensions
argument is optional. When the formula is a single-cell value, you do not specify any
dimensions. Also, when you include an expression in the definition, you do not
specify a value. DEFINE automatically determines the dimensions.
However, when you do not include an expression in the definition, you must specify
the dimensions. When you add the expression later using an EQ statement, the
expression must have the same dimensions as the formula definition. When it does
not, DEFINE forces the output to have the specified dimensions.
AW workspace
The name of an attached workspace in which you wish to define the formula. When
the formula is dimensioned, it must be defined in the same workspace as its
dimensions. For general information about this argument, see the main entry for the
DEFINE command.
SESSION
Specifies that the object exists only in the current session. When you close the current
session, the object no longer exists.
Notes
Examples
DEFINE MODEL
The DEFINE command with the MODEL keyword adds a new model object to an
analytic workspace. A model is a set of interrelated equations. The calculations in an
equation can be based either on variables or on dimension values. You can assign the
results of the calculations directly to a variable or you can specify a dimension value
for which data is being calculated. For example, in a financial application, all the
equations might be based on the values of a line item dimension, and data would be
calculated for line items such as total expenses and net income.
Syntax
DEFINE name MODEL [AW workspace] [SESSION]
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
MODEL
The object type when you are defining a model.
AW workspace
The name of an attached workspace in which you wish to define the object. For more
information about this argument, see the main entry for the DEFINE command.
SESSION
Specifies that the object exists only in the current session. When you close the current
session, the object no longer exists.
Examples
Then use a MODEL statement to enter the specification for the model. For this
example, you can enter model lines such as the ones in the following model
description.
DEFINE income.calc MODEL
LD Model for calculating Income Statement items
MODEL
dimension line
net.income = opr.income - taxes
opr.income = gross.margin - (marketing+selling+r.d)
To solve the model for the actual variable, enter data in actual for the input line
items (Revenue, Cogs, Marketing, Selling, R.D, and Taxes). Then execute the
following statement.
income.calc actual
The DEFINE command with the PARTITION TEMPLATE keywords adds a new
partition template object to an analytic workspace. A partition template is a
specification for the partitions of a partitioned variable. A partitioned variable is
stored as multiple rows in the relational table of LOBs that is the analytic
workspace—each partition is a row in the table. You define both partitioned and
unpartitioned variables using DEFINE VARIABLE statements. Before you can define a
partitioned variable you must first define a partition template object.
Syntax
DEFINE name PARTITION TEMPLATE <dimlist> PARTITION BY
{RANGE|LIST} (dims_partitioned_by) ([partition_definition_statement...]) [AW workspace]
where partition_definition_statement defines a partition. The syntax varies depending on
whether you specify RANGE or LIST:
■ For RANGE:
PARTITION partition-name VALUES LESS THAN const-exp <partition-dimlist>
■ For LIST:
PARTITION partition-name VALUES ([valuelist)] <partition-dimlist>
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
dimlist
A list of all of the logical dimensions for the variable that you are partitioning. You
must enclose the names of the dimensions in a single set of angle brackets (< >). You
must define a dimension before you can include it in the definition of a partition
template.
dims_partitioned_by
The subset of dimensions specified by dimlist that actually specify the partitions of the
variable. For range and list partitioning (that is, when you specify either the RANGE
or LIST keywords), you can specify only one dimension for dims_partitioned_by. You
cannot partition a variable along an INTEGER dimension.
PARTITION partition-name
The name of the partition.
constant-exp
A constant expression that has the same data type as the data type of the dimension
specified for dims_partitioned_by.
partition-dimlist
A list of all of the of dimensions of the partition template object (although the
dimensions may be members of a composite). You must enclose the names of the
dimensions in a single set of angle brackets (< >). Use this argument to specify the
composite (if any) used to dimension the partitions that correspond to partition-name.
When you do not specify a value then the partition is dimensioned densely by all of
the of dimensions of the partition template object.
VALUES
Indicates that you are specify a LIST partition by specifying values.
valuelist
A list of dimension values, separated by commas. You must surround text values with
single quotes (for example, 'mytext'). Specify values of conjoints by specify the
values of the base dimensions, separated by a comma, in a single set of angle brackets
(for example, <'Value1', 'Value2'>). Specify values of nonunique concat
dimensions by specify the values of the base dimensions, separated by a colon, in a
single set of angle brackets (for example, <'Value1': 'Value2'>).
Examples
See Example 9–100, "Defining a Variable with Partitions" on page 9-216.
DEFINE PROGRAM
The DEFINE command with the PROGRAM keyword adds a new OLAP DML
program object to an analytic workspace. An OLAP DML program is a collection of
OLAP DML statements that helps you accomplish some workspace management or
analysis task. Defining a program merely creates a program object in the analytic
workspace. You must also code the actual lines of the program.
Syntax
DEFINE name PROGRAM [datatype|dimension] [AW workspace] [SESSION]
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
PROGRAM
The object type when you are defining a program.
datatype
The data type of the value to be returned by the program when it is called as a
function. You can use any of the data types that apply to variables.
dimension
The name of a dimension, whose value the program returns when it is called as a
function. The return value is a single value of the dimension, not a position
(INTEGER). The dimension must be defined in the same workspace as the program.
AW workspace
The name of an attached workspace in which you wish to define the program. When
the program returns a dimension, the program must be defined in the same workspace
as the dimension. For general information about this argument, see the main entry for
the DEFINE command.
SESSION
Specifies that the object exists only in the current session. When you close the current
session, the object no longer exists.
Notes
Returning Values
Use a RETURN statement in a program when you want it to return a value. The
argument to the RETURN statement is an expression that specifies the value to return.
When the expression does not match the declared data type or dimension, the value is
converted (if possible) to the declared data type or dimension value.
When you do not specify a data type or dimension in the definition of a program, its
return value is treated as worksheet data. This means Oracle OLAP converts any
return value to the data type required by the calling context. This may lead to
unexpected results.
For a program to return a value, you must call the program as a function. That is, you
must use it as an expression in a statement. In the following example, the program
isrecent is being treated as a function. It is an argument to the REPORT command.
REPORT isrecent(actual)
When the program returns values of a dimension, the program is in the output of the
LISTBY function, and OBJ(ISBY) is TRUE for the dimension.
See the entries for the ARGUMENT, CALL, and RETURN commands for more
information about programs as user-defined functions.
Examples
When total sales for the month exceeds total planned sales for the month, the THEN
statement lines are executed. The program calculates the percentage by which actual
sales exceeds planned sales and places the result in a numeric variable called excess.
The program then sends the results to the current outfile. The JOINCHARS function is
used to combine the calculated expression excess with the text expression "Sales
exceeded plan by" in the output.
When total sales does not exceed planned sales, the ELSE statement line is executed
and a different message is produced.
After the THEN or ELSE statement lines are executed, control flows to the next line in
the program, and a report of sales in excess of plan is produced.
DEFINE RELATION
The DEFINE command with the RELATION keyword adds a new relation object to an
analytic workspace. A relation describes a correspondence between the values of two
or more dimensions. It can have dimensions, just like a variable, but the values of the
relation must be values from the related dimension.
Syntax
DEFINE name RELATION related-dim [<dimensions...>] [TEMP] [AW workspace] [SESSION]
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
RELATION
The object type when you are defining a relation.
related-dim
Specifies the dimension to which one or more dimensions are related. A relation is
normally used to store information about the relationship between two dimensions;
for example, the cities that belong in each region.
In the definition, the dimension having fewer values is normally specified as the
related dimension (for example, regions). The dimension having more values is
normally specified as a dimension of the relation (for example, cities).
<dimensions...>
The names of the dimensions of the relation. You must enclose the names of the
dimensions in a single set of angle brackets (< >). You must define a dimension before
including it in the definition of a relation. Do not include composites in the dimension
list.
Tip: When defining two relations between the same dimensions, use
the RELATION command to identify which relation is the default
relation.
TEMP
Indicates that the values of the relation are only temporary. The relation is defined in
the current workspace and can contain values during the current session. However,
when you update and commit the workspace, only the definition of the relation is
saved. When you end the session or switch to another workspace, the data values are
discarded. Each time you start the workspace, the values of a temporary relation are
NA.
AW workspace
The name of an attached workspace in which you wish to define the relation. The
relation must be defined in the same workspace as its dimensions. For general
information about this argument, see the main entry for the DEFINE command.
SESSION
Specifies that the object exists only in the current session. When the session ends, the
object no longer exists. This differs from the TEMP keyword, which specifies that the
values are temporary but the object definition remains in the workspace in which you
create it.
Examples
You can use a REPORT statement to see the values stored in div.prod.
report div.prod
The div.prod relation lets you look at division totals in a report, even though the
data is dimensioned by product.
REPORT TOTAL(units division)
DEFINE SURROGATE
The DEFINE command with the SURROGATE keyword adds a a new dimension
surrogate object to an analytic workspace. A surrogate provides an alternative set of
values for a dimension. You can use a surrogate rather than a dimension in a model, in
a LIMIT command, in a qualified data reference, or in data loading with statements
such as FILEREAD, FILEVIEW, SQL FETCH, and SQL IMPORT.
Syntax
DEFINE name SURROGATE targetname type [AW workspace] [SESSION]
where type has the following syntax:
[TEXT|NTEXT] [WIDTH n]|ID|INTEGER|NUMBER (precision[, scale] | datatime-datatype)
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
SURROGATE
The object type when you are defining a dimension surrogate.
targetname
The name of the dimension for which you are creating a surrogate. See "Restrictions on
the Use of Surrogates" on page 9-200 for points to keep in mind when determining the
target.
TEXT
NTEXT
ID
The data type for a dimension surrogate with text values. When all the values of a
dimension surrogate are eight single-byte characters or less, give it a data type of ID.
When one or more dimension values has more than eight single-byte characters, you
must give it a data type of TEXT or NTEXT. For greater efficiency and ease of use, you
should give dimensions a data type of ID whenever possible.
WIDTH n
For TEXT or NTEXT dimension surrogate, the width, in bytes, of the storage area of
each value of an object. Valid width values are 1 through 4000. Specify a fixed width
only when you are certain that the values of a particular dimension surrogate are of
similar size. When a value exceeds the specified width, Oracle OLAP truncates it.
INTEGER
The data type for a dimension surrogate with values that are the ordinal positions (1,
2, and so on) of the values in its dimension. You might create an INTEGER type
dimension surrogate for a NUMBER type dimension so that you can specify dimension
values by position instead of by the value of the dimension. When you define an
NUMBER
Specifies that the dimension surrogate has a data type of NUMBER. See "Numeric Data
Types" on page 2-4 for more information.
precision
Specifies the total number of characters in the value of a dimension surrogate of type
NUMBER.
scale
Specifies the number of characters that can be to the right of a decimal point of a
dimension surrogate of type NUMBER.
datetime_datatype
Specifies one of the datetime data types (that is, DATETIME , TIMESTAMP,
TIMESTAMP_TZ, or TIMESTAMP-LTZ. See "Datetime and Interval Data Types" on
page 2-8 for more information.
AW workspace
The name of an attached workspace in which you wish to define the dimension
surrogate. The dimension for which you define the surrogate must be defined in the
same workspace. For general information about this argument, see the main entry for
the DEFINE command.
SESSION
Specifies that the object exists only in the current session. When you close the current
session, the object no longer exists. Use this keyword when the definition of the
targetname dimension includes SESSION.
Notes
Examples
DEFINE VALUESET
The DEFINE command with the VALUESET keyword adds a new valueset object to
an analytic workspace. A valueset is a list of dimension values for one or more
dimensions. You use a valueset to save dimension status lists across sessions.
Syntax
DEFINE name VALUESET dimension [<dims...>] [TEMP] [AW workspace] [SESSION]
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
VALUESET
The object type when you are defining a valueset.
dimension
The name of the previously-defined dimension whose values you want to store in the
valueset.
dims
When defining a multi-dimensional valueset, the names of the previously-defined
dimensions by which you want the valueset dimensioned.
TEMP
Indicates that the valueset's values are only temporary. The valueset has a definition in
the current workspace and can contain values during the current session. However,
when you update and commit, only the definition of the valueset is saved. When you
end the session or switch to another workspace, the values are discarded. Each time
you start the workspace, the value of a temporary valueset is null.
AW workspace
The name of an attached workspace in which you wish to define the valueset. The
valueset must be defined in the same workspace as its dimensions. For general
information about this argument, see the main entry for the DEFINE command.
SESSION
Specifies that the object exists only in the current session. When the session ends, the
object no longer exists. This differs from the TEMP keyword, which specifies that the
values are temporary but the object definition remains in the workspace in which you
create it.
Examples
SHOW lineset
Revenue
Cogs
Assume also that the analytic workspace contains the following dimensions whose
values are the names of variables and dimensions within the workspace.
DEFINE all_variables DIMENSION TEXT
MAINTAIN all_variables ADD 'sales' 'salestax'
DEFINE all_dims DIMENSION TEXT
MAINTAIN all_dims ADD 'geography' 'product'
The following statements create and populate a valueset for the values of all_
variables and all_dims, and then report the values of that valueset.
DEFINE variables_dims VALUESET all_dims <all_variables>
" Assign all values of all_dims and all_variables to the valueset
LIMIT variables_dims TO ALL
REPORT variables_dims
ALL_VARIABLES VARIABLES_DIMS
---------------- ------------------------------
sales geography
product
salestax geography
product
To create a multidimensional valueset that has the correct dimensions related to the
variables that use them, you issue the following statement that uses a QDR to limit the
all_dims values for the salestax value of all_variables.
LIMIT variables_dims(all_variables 'salestax') TO 'geography'
REPORT variables_dims
ALL_VARIABLES VARIABLES_DIMS
---------------- ------------------------------
sales geography
product
salestax geography
DEFINE VARIABLE
The DEFINE command with the VARIABLE keyword adds a new variable object to an
analytic workspace. Variables store one type of data, which can be numeric, text,
Boolean, or dates. Beside the data type of a variable, the definition that you create for a
variable also determines the following characteristics of the variable:
■ The number of elements that are actually created in the array that is the variable.
■ The logical order of the variable's elements.
■ Whether the variable's data is stored permanently or is only available for the
session.
■ The number of LOBs that Oracle OLAP creates for the variable's data.
You can also define local program variables using a VARIABLE command. These
variables exist only as long as the program is running.
Syntax
DEFINE name [VARIABLE] datatype [<dims...>] [WITH NULLTRACKING] [WITH AGGCOUNT] -
[PERMANENT | TEMP ] -
[ RANSPACE64] [(partition-instance...)] [WIDTH n] [AW workspace] [SESSION]
where:
■ dims are the dimensions of the variable separated by commas. For a dimension of a
variable you can specify a dimension object, a partition template object, a named
uncompressed composite, a compressed composite, or an unnamed uncompressed
composite using one of the following:
dimension_name
partition_template_name<dims>
uncompressed_composite_name <[basedims...]>
compressed_composite_name <[basedims...]>
SPARSE <basedims...>
Note: The order in which you list the dims of a variable is the default
order of the dimensions and behavior of a variety of statements (such
as REPORT and UNRAVEL) and affects how the data for the variable
is stored (as discussed in "Effect of Dimension Order on Variable
Storage and Statement Looping" on page 9-210. Also, when you define
more than one object with the same dimensions, most operations will
work much more efficiently when you list the dimensions in the same
order in each definition.
■ partition-instance are the partitions of the variable separated by commas. Use the
following syntax to specify a partition.
PARTITION partition-name INTERNAL [TEMP | PERMANENT]
Arguments
name
The name of the variable you are defining. For general information about this
argument, see the main entry for the DEFINE command.
VARIABLE
The object type when you are defining a variable. You do not have to include the word
VARIABLE, because it is the default.
datatype
The data type of the data to be stored in the variable. The data types, their
abbreviations, and the range of acceptable values are shown in Table 2–1, " Summary
of OLAP DML Data Types" on page 2-1.
dimension_name
The name of a simple, concat, conjoint, or alias dimension that you have previously
defined using a DEFINE DIMENSION statement. In this case, you specify the name of
the dimension.
RANSPACE64
When defining a TEXT, NTEXT, or RAW variable, specify this keyword to increase the
maximum number of characters for the values of the variable from nearly 2**32 to
nearly 2**64.
partition-template-name<dims>
The name of a partition template object that you have previously defined using a
DEFINE PARTITION TEMPLATE statement. For dims, specify the names of the
dimensions of the partition template object. These dimensions must be the same
dimensions as those used to define the partition template object.
uncompressed_composite_name <[basedims...]>
The name of an uncompressed composite previously defined using a DEFINE
COMPOSITE statement. For the optional basedims argument, specify the names,
separated by commas, of the dimensions used to define the composite.
compressed_composite_name <basedims...>>
The name of a compressed composite previously defined using a DEFINE
COMPOSITE statement. For the optional basedims argument, specify the names,
separated by commas, of the dimensions used to define the composite.
When defining a variable that is dimensioned by a compressed composite, keep the
following points in mind:
■ A compressed composite can dimension only one variable or one partition of a
variable. A compressed composite cannot be a shared composite.
■ The compressed composite must be the last dimension in the variable's dimension
list of the DEFINE VARIABLE statement that defines the variable.
SPARSE <basedims...>
Indicates that you want Oracle OLAP to create an unnamed composite and use it
when dimensioning the variable. For the basedims argument, specify the names of the
dimensions, separated by commas, for which the unnamed composite is created.
WITH NULLTRACKING
When the variable is dimensioned by a composite, specifies that Oracle OLAP create
NA2 bits for the cells of the variable.
WITH AGGCOUNT
Specifies that Oracle OLAP automatically creates an INTEGER variable in which it
stores the non-NA counts of the number of leaf nodes that contributed to aggregate
values calculated for RELATION statements that have an AVERAGE, HWAVERAGE,
or WAVERAGE operator. You must include this phrase to calculate average
aggregations for a variable dimensioned by a compressed composite. For more
information on Aggcount variables, see "Aggcount Variables" on page 9-208.
PERMANENT
TEMP
Specifies that a variable or a partition of a variable is either permanent or temporary.
After you update and commit, the definition of both permanent and temporary
variables and partitions is always saved between sessions. Specifying permanent or
temporary determines whether or not the values of a variable or partition of a variable
are saved or discarded, after you update and commit, when you leave end your
session or switch to another workspace:
■ Permanent variables and partitions—Oracle OLAP saves the data values or a
permanent variable or permanent partitions. When you start the workspace, the
data values or a permanent variable or permanent partitions are the same as they
were at the last commit.
■ Temporary variables and partitions—Oracle OLAP discards the data values of a
temporary variable or temporary partition. Each time you start the workspace, the
values of a temporary variable or temporary partition are NA.
Keep the following points in mind when specifying the PERMANENT and TEMP
keywords:
■ By default, a variable is permanent.
■ Temporary variables can be dimensioned by partition template objects or by
temporary dimensions.
■ By default, a top-level partition of a variable has the same permanence as the
variable that contains it. Specifically, a partition of a temporary variable is a
temporary partition unless you use the PEMANENT keyword to make it a
permanent partition, and a partition of a permanent variable is a permanent
partition unless you use the TEMPORARY keyword to make it a temporary
partition. To indicate different behavior, use either the PERMANENT or TEMP
keyword.
■ By default, a subpartition has the same permanence as its parent partition. To
indicate different behavior, use either the PERMANENT or TEMP keyword.
WIDTH n
(You can abbreviate WIDTH as W.) The width, in bytes, of the storage area for each
value of a variable. When you are using a multibyte character set, be sure to specify
the number of bytes, not characters.
You specify fixed widths to create faster and more compact data storage formats. You
can specify fixed widths for dimensioned TEXT, NTEXT, and INTEGER variables
only, as described in the following list:
■ For dimensioned TEXT and NTEXT variables, you can specify a width from 1 byte
through 4000 bytes. Specify a fixed width for such variables only when you are
certain that the values of a particular variable are of similar size. You cannot
assign a width to a scalar variable.
■ For dimensioned INTEGER variables, you can specify a width of 1 byte only.
Define a fixed width INTEGER variable only when you are certain that all the
values for that variable are between -128 and 127.
The default widths for variables are: 2 bytes for SHORTINTEGER, 4 bytes for DATE,
INTEGER, and SHORTDECIMAL, and 8 bytes for DECIMAL and ID. TEXT and
NTEXT variables that do not have fixed widths are stored on two sets of pages. The
first set contains 4-byte cells, each of which points to the actual text value that is stored
in the other set of pages. The default width of 4 bytes for TEXT and NTEXT variables
is for these 4-byte cells.
AW workspace
The name of an attached workspace in which you wish to define the variable. When
the variable is dimensioned, it must be defined in the same workspace as its
dimensions. For general information about this argument, see the main entry for the
DEFINE command.
SESSION
Specifies that the object exists only in the current session. When the session ends, the
object no longer exists. This differs from the TEMP keyword, which specifies that the
values are temporary but the object definition remains in the workspace in which you
create it.
Notes
Aggcount Variables
When you include the WITH AGGCOUNT phrase in a DEFINE VARIABLE statement,
Oracle OLAP automatically creates the variable specified in the DEFINE statement
and a secondary variable (often called the Aggcount variable). The Aggcount variable
is an INTEGER variable that Oracle OLAP uses when performing average aggregations
for the defined variable. When resolving RELATION statements that have an
AVERAGE, HAVERAGE, WAVERAGE, or HWAVERAGE operator and that do not
have a COUNT NO phrase, Oracle OLAP stores the non-NA counts of the number of
leaf nodes that contribute to the average aggregate values in the Aggcount variable.
Unnamed Composites
Oracle OLAP automatically defines an unnamed composite when a DEFINE
VARIABLE statement with a SPARSE <dimlist> phrase executes. An unnamed composite
can have either a b-tree or hash index. The type of index is determined by the value of
the SPARSEINDEX option at the time that Oracle OLAP defines an unnamed
composite.
Once Oracle OLAP has created a definition for an unnamed composite for a certain
dimension list, it uses that composite any time you define a variable with the same
SPARSE <dimlist> phrase. Thus all variables that are defined with the same SPARSE
<dimlist> phrase share the same unnamed composite. For more information on sharing
composites, see "Shared Composites" on page 9-173.
Variable Segments
Within a partition, variable data is stored in analytic workspace segments. An analytic
workspace segment is a group of logically contiguous analytic workspace pages. By
default, the segment sizes of a variable are automatically determined by Oracle OLAP.
Each segment is the exactly the number of analytic workspace pages needed to store
the values assigned by the one OLAP DML statement. You can explicitly specify a
segment size for a variable using the SEGWIDTH keyword of the CHGDFN
command. In this case, when you assign values to a variable, Oracle OLAP stores the
data assigned by multiple OLAP DML statements into a segment until the segment is
full.
Examples
The following statements define a NUMBER variable named numvar with 5 significant
digits and 2 decimal places. The number 1234567 is out of its range.
DEFINE numvar VARIABLE NUMBER (5, 2)
numvar = 1234567
SHOW numvar
NA
As you can see from the output of the REPORT statement, the sales_dims_reg
variable is a sparsely populated variable with 152 cells, many of which contain NA
values.
----------------------------SALES_DIMS_REG-----------------------------
---------------------------------PROD----------------------------------
<PROD_DI
<PROD_UP <PROD_UP <PROD_UP <PROD_FA <PROD_FA V: <PROD_TO
C: <PROD_UP C: C: MILY: MILY: VideoDiv P: Total
GEOG ColorTV> C: BWTV> StndVCR> StrVCR> VCR> TV> > Prod>
------------------------- -------- -------- -------- -------- -------- -------- -------- --------
<GEOG_CITY: Canberra> 11,592.0 NA 38,356.0 3,444.00 41,800.0 11,592.0 53,392.0 53,392.0
<GEOG_CITY: Sydney> NA NA NA NA NA NA NA NA
<GEOG_CITY: Darwin> 24,868.0 NA 22,104.0 32,667.0 54,771.0 24,868.0 79,639.0 79,639.0
<GEOG_CITY: Brisbane> 49,556.0 NA 48,239.0 24,285.0 72,524.0 49,556.0 122,080 122,080
<GEOG_CITY: Adelaide> NA NA NA NA NA NA NA NA
<GEOG_CITY: Hobart> 17,223.0 NA 18,872.0 48,780.0 67,652.0 17,223.0 84,875.0 84,875.0
<GEOG_CITY: Melbourne> NA 22,000.0 NA NA NA 22,000.0 22,000.0 22,000.0
<GEOG_CITY: Perth> NA NA NA NA NA NA NA NA
<GEOG_STATE: ACT> 11,592.0 NA 38,356.0 3,444.00 41,800.0 11,592.0 53,392.0 53,392.0
<GEOG_STATE: NSW> NA NA NA NA NA NA NA NA
<GEOG_STATE: NT> 24,868.0 NA 22,104.0 32,667.0 54,771.0 24,868.0 79,639.0 79,639.0
<GEOG_STATE: QLD> 49,556.0 NA 48,239.0 24,285.0 72,524.0 49,556.0 122,080 122,080
<GEOG_STATE: SA> NA NA NA NA NA NA NA NA
<GEOG_STATE: TAS> 17,223.0 NA 18,872.0 48,780.0 67,652.0 17,223.0 84,875.0 84,875.0
<GEOG_STATE: VIC> NA 22,000.0 NA NA NA 22,000.0 22,000.0 22,000.0
<GEOG_STATE: WA> NA NA NA NA NA NA NA NA
<GEOG_AREA: Aust State> 66,779.0 22,000.0 67,111.0 73,065.0 140,176 88,779.0 228,955 228,955
<GEOG_AREA: Aust Terr> 36,460.0 NA 60,460.0 36,111.0 96,571.0 36,460.0 133,031 133,031
<GEOG_CONT: Australia> 103,239 22,000.0 127,571 109,176 236,747 125,239 361,986 361,986
The result of the statement is that the value 152.00 displays. This indicates that
every value in the 152 cells of the sales_dims_reg variable (even the NA values) are
stored as part of the variable.
Assume that you populate sales_dims_composite with the same base values as
you did sales_dims_reg in Example 9–97, "Defining a Variable Dimensioned by
Two Regular Dimensions" on page 9-211, and that you aggregate sales_dims_
composite using the same aggmap (that is, sales_aggmap) and issue the following.
REPORT statement for the sales_dims_composite variable.
REPORT sales_dims_composite
A report for the sales_dims_composite variable displays the same 152 cells as the
report for the sales_dims_reg variable.
-------------------------SALES_DIMS_COMPOSITE--------------------------
---------------------------------PROD----------------------------------
<PROD_DI
<PROD_UP <PROD_UP <PROD_UP <PROD_FA <PROD_FA V: <PROD_TO
C: <PROD_UP C: C: MILY: MILY: VideoDiv P: Total
GEOG ColorTV> C: BWTV> StndVCR> StrVCR> VCR> TV> > Prod>
------------------------- -------- -------- -------- -------- -------- -------- -------- --------
<GEOG_CITY: Canberra> 11,592.0 NA 38,356.0 3,444.00 41,800.0 11,592.0 53,392.0 53,392.0
<GEOG_CITY: Sydney> NA NA NA NA NA NA NA NA
<GEOG_CITY: Darwin> 24,868.0 NA 22,104.0 32,667.0 54,771.0 24,868.0 79,639.0 79,639.0
<GEOG_CITY: Brisbane> 49,556.0 NA 48,239.0 24,285.0 72,524.0 49,556.0 122,080 122,080
<GEOG_CITY: Adelaide> NA NA NA NA NA NA NA NA
<GEOG_CITY: Hobart> 17,223.0 NA 18,872.0 48,780.0 67,652.0 17,223.0 84,875.0 84,875.0
<GEOG_CITY: Melbourne> NA 22,000.0 NA NA NA 22,000.0 22,000.0 22,000.0
<GEOG_CITY: Perth> NA NA NA NA NA NA NA NA
<GEOG_STATE: ACT> 11,592.0 NA 38,356.0 3,444.00 41,800.0 11,592.0 53,392.0 53,392.0
<GEOG_STATE: NSW> NA NA NA NA NA NA NA NA
<GEOG_STATE: NT> 24,868.0 NA 22,104.0 32,667.0 54,771.0 24,868.0 79,639.0 79,639.0
<GEOG_STATE: QLD> 49,556.0 NA 48,239.0 24,285.0 72,524.0 49,556.0 122,080 122,080
<GEOG_STATE: SA> NA NA NA NA NA NA NA NA
<GEOG_STATE: TAS> 17,223.0 NA 18,872.0 48,780.0 67,652.0 17,223.0 84,875.0 84,875.0
<GEOG_STATE: VIC> NA 22,000.0 NA NA NA 22,000.0 22,000.0 22,000.0
<GEOG_STATE: WA> NA NA NA NA NA NA NA NA
<GEOG_AREA: Aust State> 66,779.0 22,000.0 67,111.0 73,065.0 140,176 88,779.0 228,955 228,955
<GEOG_AREA: Aust Terr> 36,460.0 NA 60,460.0 36,111.0 96,571.0 36,460.0 133,031 133,031
<GEOG_CONT: Australia> 103,239 22,000.0 127,571 109,176 236,747 125,239 361,986 361,986
The result of the statement is that the value 87.00 displays. This indicates that only
the 87 non-NA values are stored as part of the sales_dims_composite variable.
Assume that you populate sales_dims_composite with the same base values as
you did sales_dims_reg in Example 9–97, "Defining a Variable Dimensioned by
Two Regular Dimensions" on page 9-211, and that you aggregate sales_dims_comp_
composite using the same aggmap (that is, sales_aggmap). Now you issue the
following statement.
REPORT sales_dims_comp_composite
The result of the statement is that the value 38.00 displays. This indicates that only
38 values are stored as part of the sales_dims_comp_composite variable. These
values are shown in the following table.
GEOG_CITY: 22,000.0
Melbourne
For simplicity's sake, in this example the time and product dimensions are only
partially populated and have only the following values.
TIME
--------------
2003
2002
Dec2003
Jan2003
Dec2002
Jan2002
31Dec2003
01Dec2003
31Jan2003
01Jan2003
31Dec2002
01Dec2002
31Jan2002
01Jan2002
PRODUCT
-------
00001
00002
(note that for simplicity's sake, only some of each year's dimension values are
specified for each partition in this example. Typically, when you want to specify a
large number of values for a partition, you do not do so within the DEFINE
PARTITION STATEMENT statement. Instead, you define the partition without
specifying any values, and then later specify the values using MAINTAIN ADD
TO PARTITION or MAINTAIN MOVE TO PARTITION statements as illustrated in
Example 10–54, "Specifying the Values of a Partition Using Valuesets" on
page 10-97.)
2. Define a partitioned sales variable with the partitions defined by the partition
template named partition_sales_by_year.
DEFINE sales DECIMAL <partition_sales_by_year<time product>>
3. After you populate sales with day values, you can issue the following REPORT
statement to see which sales values are in which partition.
REPORT DOWN PARTITION(partition_sales_by_year) time product sales
When your company does promotional marketing for certain products in some but not
all regions, then your variable data will be sparse along the product and region
dimensions. Therefore, suppose you define a composite named proddist, whose
base dimensions are product and region. There are dimension-value combinations
in the composite only for those values that have data. For example, when you run a
promotion for tents but not skis, then the composite includes the tents and region
combinations, but not the skis and region combinations.
The following statement creates a b-tree composite named proddist whose base
dimensions are product and district, and a variable called promo that is
dimensioned by month and proddist.
DEFINE proddist COMPOSITE <product region>
DEFINE promo VARIABLE INTEGER <month proddist <product district>>
For simplicity's sake assume that you have only stored the following dimension data
in your analytic workspace.
PRODUCT
--------------
Tents
Skis
REGION
--------------
Northeast
Southwest
MONTH
--------------
Jan2003
Feb2003
Mar2003
Apr2003
May2003
Jun2003
Jul2003
Aug2003
Sep2003
Oct2003
Nov2003
Dec2003
You decide to run a promotional sales for skis in the Northeast region in the month of
September, 2003 at a cost of $5,000. Once you populate promo with this, promo
contains only 12 cells—each cell is dimensioned by a value of month and the
composite tuple value of <'Skis' 'Northeast'> for proddist. The cell for
September 2003 contains the value $5,000, and all of the other cells contain NA. No
other NA values are stored in promo; there are no cells are created for any other
values of product or region.
Now assume that you define a sales variable that you want to have dimensioned by
time and the prod_geog composite. You want this variable to have null tracking
because you will eventual populating it using SQL IMPORT and you know that some
of the facts in the fact table have null values. To do this you issue the following
statement that includes the WITH NULLTRACKING phrase.
DEFINE sales VARIABLE DECIMAL <time prod_geog<product geog>> WITH NULLTRACKING
For testing purposes, you populate the variable using the RANDOM function. After
you populate the variable in this way, you issue a report on it that shows the NA
values in the variable.
REPORT DOWN time ACROSS geog: sales
PRODUCT: TVs
-----------------------SALES-----------------------
-----------------------GEOG------------------------
TIME Boston Springfield Hartford All Places
-------------- ------------ ------------ ------------ ------------
2007 NA NA NA NA
2008 NA NA NA NA
All years NA NA NA NA
Jan07 NA NA NA NA
Feb07 NA NA NA NA
Mar07 NA NA NA NA
Apr07 NA NA NA NA
May07 NA NA NA NA
Jun07 NA NA NA NA
Jul07 NA NA NA NA
Aug07 NA NA NA NA
Sep07 NA NA NA NA
Oct07 NA NA NA NA
Nov07 NA NA NA NA
Dec07 NA NA NA NA
Jan08 NA NA NA NA
Feb08 NA NA NA NA
Mar08 NA NA NA NA
Apr08 NA NA NA NA
May08 NA NA NA NA
Jun08 NA NA NA NA
Jul08 NA NA NA NA
Aug08 NA NA NA NA
Sep08 NA NA NA NA
Oct08 NA NA NA NA
Nov08 NA NA NA NA
Dec08 NA NA NA NA
PRODUCT: Radios
-----------------------SALES-----------------------
-----------------------GEOG------------------------
TIME Boston Springfield Hartford All Places
-------------- ------------ ------------ ------------ ------------
2007 NA NA NA NA
2008 NA NA NA NA
All years NA NA NA NA
Jan07 24.59 23.70 33.12 28.65
Feb07 22.78 21.42 26.28 37.06
Mar07 25.74 32.08 22.75 24.62
Apr07 22.23 23.21 20.79 28.68
May07 20.51 29.71 30.35 33.05
Jun07 34.43 35.96 33.85 39.34
Jul07 24.86 38.02 36.78 31.22
Aug07 39.05 21.08 35.80 33.81
Sep07 34.38 21.69 25.04 33.40
Oct07 33.82 39.27 20.28 24.39
Nov07 25.48 23.03 32.45 39.94
Dec07 25.14 30.66 33.75 23.37
Jan08 NA NA NA NA
Feb08 NA NA NA NA
Mar08 NA NA NA NA
Apr08 NA NA NA NA
May08 NA NA NA NA
Jun08 NA NA NA NA
Jul08 NA NA NA NA
Aug08 NA NA NA NA
Sep08 NA NA NA NA
Oct08 NA NA NA NA
Nov08 NA NA NA NA
Dec08 NA NA NA NA
For testing purposes, you also generate a report using the NAFLAG function to
retrieve the type of NAs that are in the variable. As the following report shows,
becauses it was populated using RANDOM, all of the NAs are the typical NA values;
they are not NA2 values.
REPORT DOWN time ACROSS geog: NAFLAG(sales)
PRODUCT: TVs
-------------------NAFLAG(SALES)-------------------
-----------------------GEOG------------------------
TIME Boston Springfield Hartford All Places
-------------- ------------ ------------ ------------ ------------
2007 1 1 1 1
2008 1 1 1 1
All years 1 1 1 1
Jan07 1 1 1 1
Feb07 1 1 1 1
Mar07 1 1 1 1
Apr07 1 1 1 1
May07 1 1 1 1
Jun07 1 1 1 1
Jul07 1 1 1 1
Aug07 1 1 1 1
Sep07 1 1 1 1
Oct07 1 1 1 1
Nov07 1 1 1 1
Dec07 1 1 1 1
Jan08 1 1 1 1
Feb08 1 1 1 1
Mar08 1 1 1 1
Apr08 1 1 1 1
May08 1 1 1 1
Jun08 1 1 1 1
Jul08 1 1 1 1
Aug08 1 1 1 1
Sep08 1 1 1 1
Oct08 1 1 1 1
Nov08 1 1 1 1
Dec08 1 1 1 1
PRODUCT: Radios
-------------------NAFLAG(SALES)-------------------
-----------------------GEOG------------------------
TIME Boston Springfield Hartford All Places
-------------- ------------ ------------ ------------ ------------
2007 1 1 1 1
2008 1 1 1 1
All years 1 1 1 1
Jan07 0 0 0 0
Feb07 0 0 0 0
Mar07 0 0 0 0
Apr07 0 0 0 0
May07 0 0 0 0
Jun07 0 0 0 0
Jul07 0 0 0 0
Aug07 0 0 0 0
Sep07 0 0 0 0
Oct07 0 0 0 0
Nov07 0 0 0 0
Dec07 0 0 0 0
Jan08 1 1 1 1
Feb08 1 1 1 1
Mar08 1 1 1 1
Apr08 1 1 1 1
May08 1 1 1 1
Jun08 1 1 1 1
Jul08 1 1 1 1
Aug08 1 1 1 1
Sep08 1 1 1 1
Oct08 1 1 1 1
Nov08 1 1 1 1
Dec08 1 1 1 1
Again, for testing purposes, you use the NA function to set an NA2 bit on the variable
cells dimensioned by the months of 2008. The following code shows the result of
issuing a SHOW of the NA2 funtion and using that function to set the NA2 bit on the
cells dimensioned by the months in 2008.
SHOW NA2
NA
LIMIT time TO 'Jan08' 'Feb08' 'Mar08' 'Apr08' 'May08' 'Jun08' 'Jul08' 'Aug08' 'Sep08' 'Oct08' 'Nov08' 'Dec08'
saleswithnull= NA2
For brevity’s sake assume that your test now issues the following three LIMIT
statements and then reports on the sales variable and the NAFLAG function against
the sales variable. As the NAFLAG report illustrate, the value Jan08 which is one of
the months to which an NA2 value was assigned returns the value of 2 for NAFLAG,
while the NAFLAG report still returns the value of 1 for the year 2008.
LIMIT product to 'Radios'
LIMIT time TO 'Jan08' '2008'
LIMIT geog TO 'Boston' 'All Places'
PRODUCT: Radios
----------SALES----------
----------GEOG-----------
TIME Boston All Places
-------------- ------------ ------------
Jan08 NA NA
2008 NA NA
PRODUCT: Radios
------NAFLAG(SALES)------
----------GEOG-----------
TIME Boston All Places
-------------- ------------ ------------
Jan08 2 2
2008 1 1
Now assume that you issue the following code to remove the NA2 bits from the sales
variable.
CHGDFN sales DROP NULLTRACKING
A DESCRIBE of the sales variable shows that it no longer has the WITH
NULLTRACKING phrase in its definition while a report of the results of NAFLAG
show that the NA values are now just the typical NA values without an NA2 bit.
DESCRIBE sales
PRODUCT: Radios
----------SALES----------
----------GEOG-----------
TIME Boston All Places
-------------- ------------ ------------
Jan08 NA NA
2008 NA NA
PRODUCT: Radios
------NAFLAG(SALES)------
----------GEOG-----------
TIME Boston All Places
-------------- ------------ ------------
Jan08 1 1
2008 1 1
DEFINE WORKSHEET
The DEFINE command with the WORKSHEET keyword adds a new worksheet object
to an analytic workspace. A worksheet, like a spreadsheet, is a two-dimensional object
that is dimensioned by a worksheet row and a worksheet column. It can temporarily
store data that you want to transfer between spreadsheet packages and workspace
dimensions and variables.
When you first define a worksheet, it does not contain any values. You can populate a
worksheet with values from an existing spreadsheet by using an IMPORT
(spreadsheet) statement or add or delete values from worksheet row and a worksheet
column dimensions with a MAINTAIN statement.
Syntax
DEFINE name WORKSHEET [<column-dim row-dim>] [TEMP] [AW workspace] [SESSION]
Arguments
name
The name of the object you are defining. For general information about this argument,
see the main entry for the DEFINE command.
WORKSHEET
The object type when you are defining a worksheet.
<column-dim row-dim>
The names of the dimensions of the worksheet. When you supply this argument, you
must give the names of two INTEGER dimensions for column-dim and row-dim. When
you omit this argument, the worksheet will be dimensioned automatically by WKSCOL
and WKSROW. See "Worksheet Dimensions" on page 9-224 for more information
TEMP
Indicates that the worksheet is only temporary. The worksheet is defined in the
specified workspace and can contain values during the current session. However,
when you update and commit, only the definition of the worksheet is saved. When
you end your session or switch to another workspace, the data values are discarded.
AW workspace
The name of an attached workspace in which you wish to define the worksheet. The
worksheet must be defined in the same workspace as its dimensions. For general
information about this argument, see the main entry for the DEFINE command.
SESSION
Specifies that the object exists only in the current session. When the session ends, the
object no longer exists. This differs from the TEMP keyword, which specifies that the
values are temporary but the object definition remains in the workspace in which you
create it.
Notes
Worksheet Dimensions
A worksheet must always dimensioned by two dimensions that represent a worksheet
row and a worksheet column. The worksheet row and a worksheet column
■ You create worksheet row and a worksheet column dimensions the same way you
create any other simple dimension by issuing the following statements:
1. Create two simple INTEGER dimensions using a DEFINE DIMENSION
(simple) statement. One dimension is for row numbers and the other for
column numbers.
2. Using MAINTAIN statements, populate one dimension with integers that
represent row numbers and populate with integers that represent column
numbers.
Examples
DELETE
The DELETE command deletes one or more objects from an analytic workspace. The
deletion becomes permanent when you execute UPDATE and COMMIT statements.
Before you delete an object, you must first delete all of its associated objects. For
example, before you can delete a dimension, you must first delete any variables
dimensioned by it. Also, you cannot delete an object when a PERMIT statement denies
you the right to change its permission.
Tip: When you see an error message when you try to delete an
object, then the name of that object might be a reserved word. (Use
RESERVED to identify reserved words.) When this is the case, use a
RENAME statement to give the object a new name, and then delete it.
Syntax
DELETE name... [AW workspace]
Arguments
name...
The names of one or more objects, separated by spaces or commas. DELETE removes
the definitions of these objects from the appropriate workspace.
You can specify a qualified object name or use the AW argument to indicate the
attached workspace in which each object can be found. Do not use both qualified
object names and the AW argument in the same DELETE command.
Note: Oracle OLAP does not warn you when you delete an object
that has the same name as an existing object in another attached
workspace. Also, when the NAME dimension is limited to less than
all its values, DELETE automatically sets the status of NAME to ALL
AW workspace
The name of an attached workspace in which you wish to delete all the specified
objects. When you do not use a qualified object name or the AW argument to specify
an analytic workspace, objects are deleted in the current workspace.
Examples
Placing city before population in the preceding statement would produce an error.
DESCRIBE
The DESCRIBE command produces a report that shows the definition of one or more
workspace objects. An object definition that you see in the output from a DESCRIBE
command might include a description (LD), a value name format (VNF) for a time
dimension, an expression associated with a FORMULA, permission specified a
PERMIT statements, or the contents of a calculation specification (for example, the
contents of a program). You can use DESCRIBE to show the definition of an object
even when you do not have permission to access the object or to change its permission.
Some parts of some object definitions are not reported on as described in "What's Not
in the Report Output by DESCRIBE" on page 9-227.
Syntax
DESCRIBE [names]
Arguments
names
The names of one or more workspace objects, separated by spaces or commas. When
you omit this argument, DESCRIBE shows the definition of all objects in the current
status of the NAME dimension. Consequently, when you omit this argument you can
use a LIMIT command in combination with DESCRIBE to report the definitions of a
particular group of objects in your workspace, as illustrated in Example 9–108,
"Describing All Relations" on page 9-228.
Notes
DESCRIBE command. You can then access another workspace and use an INFILE
statement to read the DESCRIBE output. The same object will be created in that
workspace.
Examples
Since the values returned by OBJ(TYPE) are always in uppercase, you have to use
'RELATION' rather than 'relation' in your LIMIT command to obtain a match.
DO ... DOEND
Within an OLAP DML program, the DO and DOEND commands bracket a group of
one or more statements in a program. DO and DOEND are normally used to bracket
one of the following:
■ A group of statements that are to be executed under a condition specified by an IF
command
■ A group of statements in a repeating loop introduced by FOR or WHILE
■ The CASE labels for a SWITCH command.
You can put one DO statement inside another to nest groups of statements. You can
nest as many groups as you want, if each DO statement has a corresponding DOEND
to indicate the end of its statement group.
Syntax
DO
statement1
...
statementN
DOEND
Arguments
statement
One or more OLAP DML statements, user-defined programs, or both.
Notes
Examples
EDIT
The EDIT command displays an OLAP Worksheet Edit window. The command is
available only when you are using OLAP Worksheet to access Oracle OLAP.
For information about using an OLAP Worksheet Edit window, see the OLAP
Worksheet Help.
Syntax
EDIT {PROGRAM|MODEL|AGGMAP|FORMULA} object-name
Arguments
PROGRAM
MODEL
AGGMAP
FORMULA
Indicates whether the object to be edited is a program, a model, an aggmap, or a
formula.
object-name
A text expression that specifies the name of an existing program, model, aggmap, or
formula. Before editing one of these objects, use a DEFINE statement to create it in an
analytic workspace.
Notes
Examples
EQ
The EQ command specifies a new expression for an already defined formula. In order
to use EQ to assign an expression to a formula definition, the definition must be the
one most recently defined or considered during the current session. When it is not,
you must first use a CONSIDER command to make it the current definition.
An alternative to the EQ command is the EDIT FORMULA command, which is
available only in OLAP Worksheet. The EDIT FORMULA command opens an Edit
window in which you can add, delete, or change the expression to be calculated for a
formula.
Be sure to distinguish between the EQ command described here and the EQ operator
used to compare values of the same type.
Syntax
EQ [expression]
Arguments
expression
The calculation that will be performed to produce values when you use the formula.
When you do not specify an expression, the EQ command sets the expression to NA.
The formula text is not converted to uppercase.
Notes
Examples
The statements
CONSIDER f1
EQ actual * 3
DESCRIBE f1
The statements
PARSE 'total(actual line year)'
SHOW INFO(PARSE DIMENSION)
The statement
SHOW INFO(PARSE DATA)
The output from INFO(PARSE) shows that the expression has the same
dimensionality and data type as the line.totals formula. The statements
CONSIDER line.totals
EQ TOTAL(actual line year)
DESCRIBE line.totals
EXPORT
The EXPORT command copies workspace objects from your analytic workspace to an
external file. You can use EXPORT to copy both data and object definitions from your
workspace to an EIF file, or you can use it to copy an OLAP DML worksheet object to
a spreadsheet file.
Because the syntax of the EXPORT command is different depending on whether it is
being used to produce an EIF file or a spreadsheet file, two separate entries are
provided:
■ EXPORT (EIF))
■ EXPORT (spreadsheet)
EXPORT (EIF)
The EXPORT (to EIF) command copies data and definitions from your Oracle OLAP
analytic workspace to an EIF file. EXPORT also copies all dimensions of the exported
data, even when you do not specify them in the command. The status of the data's
dimensions in Oracle OLAP determines which values are exported.
Tip: number of options determine how EIF files are imported and
exported. These options are listed in "EIF Options" on page 6-6.
EXPORT (to EIF) is commonly used in conjunction with IMPORT (EIF) to copy parts of
one Oracle OLAP workspace to another. You export objects from the source workspace
to an EIF file and then import the objects from the EIF file into the target workspace.
The source and target workspaces can reside on the same platform or on different
platforms. When you transfer an EIF file between computers, use a binary transfer to
overcome file-format incompatibilities between platforms. The EIF file must have been
created with the EIFVERSION set to a version that is less than or equal to the version
number of the target workspace. See the EIFVERSION option for information about
verifying the target version number.
Syntax
EXPORT export_item TO EIF FILE file-name [LIST] [NOPROP] -
[NOREWRITE|REWRITE] [FILESIZE n [K, M, or G]] -
[NOTEMPDATA] [NLS_CHARSET charset-exp] [AGGREGATE | NOAGGR]
where export_item is one of the following:
name [AS newname]
exp [SCATTER AS scattername [TYPE scattertype] [EXCLUDING (concatbasedim . . .)]
exp AS name [EXCLUDING (concatbasedim . . .)]
ALL
Arguments
name
The name of an analytic workspace object or option to be exported. You can list more
than one name for export.
AS newname
Specifies a new name for the analytic workspace object or option. When you specify
an expression, or a local variable, or a local valueset, then you must use AS name to
provide a name for the object that IMPORT (EIF) will use to receive the data
exp
An expression to be computed and exported. You can list more than one name at a
time for export.
variables (scattername and scattertype) and assign text values and their corresponding
data types to scattername. When you use SCATTER AS scattername, this tells Oracle
OLAP to export the multidimensional expression as separate variables in the slices you
have specified in scattername. When each of the slice variables is to have the same data
type, you can simply make exp have that data type, in which case you will not need to
use TYPE scattertype.
EXCLUDING (concatbasedim . . .)
The EXCLUDING phrase applies only to a concat dimension that you specify with the
name argument. The value you specify for concatbasedim, specifies the base dimensions
of the concat that Oracle OLAP does not export.
ALL
Specifies that Oracle OLAP exports all the objects currently in the status of NAME
(and, therefore, not necessarily all objects in the workspace).
TO EIF FILE
Indicates that you want to create an EIF file.
file-name
A text expression that is the name of the file to which output should be written. Unless
the file is in the current directory, you must include the name of the directory object in
the name of the file.
Note: Directory objects are defined in the database, and they control
access to directories and file in those directories. You can use the CDA
command to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
LIST
Sends to the current outfile the definition of each object as it begins to export it. For
dimensions, EXPORT indicates the number of values being exported, and for
composites, it lists the number of dimension value combinations. EXPORT also
produces a message that shows the total number of bytes read every two minutes and
at the end of the export procedure.
NOPROP
Prevents any properties that you have assigned to each object using a PROPERTY
from being written to the EIF file.
NOREWRITE
REWRITE
Specifies whether EXPORT will overwrite the target file when it already exists.
NOREWRITE (the default) leaves an existing target file intact and sends an error
message to the current outfile. REWRITE causes EXPORT to replace the existing file
with the new EIF file.
FILESIZE n [K|M|G]
Sets the maximum size of each component file (main file and extension files) for EIF
files. When a file's size grows beyond the value of FILESIZE or the current disk or
location becomes full, Oracle OLAP creates an EIF extension file. See"EIF Extension
Files" on page 9-238.
FILESIZE affects component files created after it is set. Previous component files may
have various sizes, determined by the FILESIZE setting at the time each one was
created or by the size it reached when its disk was full.
When you do not specify K, M, or G, the value you specify for n is interpreted as bytes.
When you specify K, M, or G after the value n, the value is interpreted as kilobytes,
megabytes, or gigabytes, respectively.
You can set FILESIZE to any value between 81,920 bytes (80K) and 2,147,479,552 bytes
(2G).
NOTEMPDATA
Prevents data in TEMP variables from being written to the EIF file.
NLS_CHARSET charset-exp
Specifies the character set that Oracle OLAP will use when exporting text data to the
file specified by file-name. This allows Oracle OLAP to convert the data accurately into
that character set. This argument must be the last one specified. When this argument is
omitted, then Oracle OLAP exports the data in the database character set, which is
recorded in the NLS_LANG option.
AGGREGATE
Export aggregated data. This is the default behavior.
NOAGGR
Do not export aggregated data.
Notes
Exporting Relations
When you export a relation, EXPORT exports the definition and the values in status
for the related dimension as well as the dimensions of the relation.
base dimensions. (Note that you cannot use the EXCLUDING phrase with the
EXPORT ALL keyword.)
Exporting Objects with the Same Name From Two Different Workspaces
When you want to export two objects that have the same name from two different
workspaces, you must rename one of them in the EIF file by exporting it with the AS
keyword. Objects in an EIF file cannot have duplicate names.
Examples
To import the variables, specify which of the named slices you want, as in the
following statement.
IMPORT dist1 dist2 dist3 dist4 dist5 dist6 FROM EIF FILE 'slice.eif'
EXPORT (spreadsheet)
The EXPORT (to spreadsheet) command copies an Oracle OLAP worksheet object that
you have created to a spreadsheet file and automatically translate it into the
appropriate format. An analytic worksheet's dimensions form the columns and rows
of the spreadsheet file. The current status of these dimensions determines which part
of a worksheet is exported.
You can also export an analytic worksheet to an EIF file as described in EXPORT (EIF).
EXPORT (to spreadsheet) is commonly used to copy part of your Oracle OLAP
workspace into a file that can be read by other software, such as Lotus 1-2-3, or
Symphony.
Syntax
EXPORT worksheetname TO {WKS|WK1|WRK|WR1|DIF} FILE file-name -
[STATRANK] [NOREWRITE|REWRITE] [NLS_CHARSET charset-exp]
Arguments
worksheetname
An Oracle OLAP worksheet object that you have created. In any one EXPORT (to
spreadsheet) command, you can export only one worksheetname to one spreadsheet file.
WKS
Indicates that you want to export an Oracle OLAP worksheet to a 1-2-3 file, version 1.
WK1
Indicates that you want to export an Oracle OLAP worksheet to a 1-2-3 file, version 2.
WRK
Indicates that you want to export an Oracle OLAP worksheet to a Symphony file,
version 1.0.
WR1
Indicates that you want to export an Oracle OLAP worksheet to a Symphony file,
version 1.1.
DIF
Indicates that you want to export an Oracle OLAP worksheet to a data interchange
format file.
FILE file-name
FILE specifies the file that you are creating. For file-name, specify a text expression that
is the name of the file. Unless the file is in the current directory, you must include the
name of the directory object in the name of the file.
Note: Directory objects are defined in the database, and they control
access to directories and file in those directories. You can use the CDA
command to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
STATRANK
Specifies that the row and column numbers exported with worksheet data should be
the current status rankings of the WKSROW and WKSCOL dimensions.
NOREWRITE
(Default) Specifies that Oracle OLAP does not overwrite the target file when it already
exists, but instead displays an error.
REWRITE
Specifies that Oracle OLAP overwrites the target file when it already exists.
NLS_CHARSET charset-exp
Specifies the character set that Oracle OLAP will use when exporting text data to the
worksheet file specified by file-name. This allows Oracle OLAP to convert the data
accurately into that character set. For information about the character sets that you can
specify, see Oracle Database Globalization Support Guide. This argument must be the last
one specified. When this argument is omitted, then Oracle OLAP exports the data in
the database character set, which is recorded in the NLS_LANG option.
Examples
FCCLOSE
The FCCLOSE command closes a forecasting context. When Oracle OLAP closes a
forecasting context, only data in the variables specified in the FCEXEC command
remain available to applications. Oracle OLAP purges all other data, including
temporary pages, associated with the forecast.
You must use the FCCLOSE command in combination with other OLAP DML
statements as outlined in "Forecasting Programs" on page 4-20.
Syntax
FCCLOSE handle-expression
Arguments
handle-expression
An INTEGER expression that is the handle to forecast context previously opened using
the FCOPEN function.
Examples
For an example of a forecasting program, see Example 9–118, "A Forecasting Program"
on page 9-245.
FCEXEC
The FCEXEC command executes a forecast based on the parameters options specified
by the FCSET command for the forecast. The FCEXEC command implicitly loops over
all the dimensions of the expression other than the time dimension.
You must use the FCEXEC command in combination with other OLAP DML
statements as outlined in "Forecasting Programs" on page 4-20.
Syntax
FCEXEC handle-expression [choice] time-series-expression
where choice is one or more of the following:
TIME time-dimension
TRADINGDAYS expression
INTO name
SEASONAL name
SMSEASONAL name
BACKCAST
Arguments
handle-expression
An INTEGER expression that specifies the handle to a forecasting context previously
opened using the FCOPEN function.
TIME time-dimension
The name of the time dimension. You do not have to specify this parameter when one
dimension of the time-series-expression is of type DAY, WEEK, MONTH, QUARTER, or
YEAR.
TRADINGDAYS expression
An INTEGER expression that specifies the number of business days in the unit of time
of the time data type (that is, DAY, WEEK, MONTH, or YEAR) of the
time-series-expression. By default the value is the total number of days in the unit of
time.
INTO name
The name of the Oracle OLAP variable in which the forecasting engine stores the
forecast data. This variable must be dimensioned by the time dimension and any other
dimensions of the time-series-expression that have more than one value in status. (This
variable can have additional dimensions. However, in this case, when Oracle OLAP
executes the forecast, it limits each of these additional dimensions to the first value in
the dimension's status list.).
SEASONAL name
The name of the variable that the forecasting engine populates with the data that
represents seasonal factors.The forecasting engine produces only one cycle of factors
and stores these values into this variable beginning with the first time period in status.
This variable must be dimensioned by the time dimension and any other dimensions
of the time-series-expression that have more than one value in status. (This variable can
have additional dimensions. However, in this case, when the forecasting engine
executes the forecast, Oracle OLAP limits each of these additional dimensions to the
first value in the dimension's status list.)
SMSEASONAL name
The name of the variable that the forecasting engine populates with the data that
represents smoothed seasonal factors. The forecasting engine produces only one cycle
of factors and stores these values into this variable beginning with the first time period
in status; all other values are set to NA. This variable must be dimensioned by the time
dimension and any other dimensions of the time-series-expression that have more than
one value in status. (This variable can have additional dimensions. However, in this
case, when the forecasting engine executes the forecast, Oracle OLAP limits each of
these additional dimensions to the first value in the dimension's status list.)
BACKCAST
The BACKCAST keyword specifies that the forecasting engine returns fitted historical
data. Typically this data is available only for a subset of the historical periods
(sometimes called the "fit window"). The forecasting engine sets the value of the data
that corresponds to the historical time periods that are outside of the fit window to NA.
time-series-expression
An expression that specifies the data from which FCEXEC calculates values. The
time-series-expression must be a numeric expression that is dimensioned by
time-dimension. The time-series-expression may also be dimensioned by other
dimensions. In this case, FCEXEC implicitly loops over all the dimensions of the
expression other than the time dimension. The maximum status length of the
time-series-expression is 5000.
Notes
Examples
time dimension named timedim. Assume that you have defined a program named
autofcst with the following definition and specification.
DEFINE autofcst PROGRAM
PROGRAM
" Using the Automatic forecasting method
" Suppose you want to create a forecast from the data in
" an input variable named fcin1 that is dimensionsed by
" a time dimension named timedim.
"
" Open a forecasting context
hndl = FCOPEN('MyForecast')
" Initialize the target variables
fcout1 = NA
fcseas1 = NA
fcsmseas1 = NA
" Specify that the forecast be of the AUTOMATIC type
fcset hndl method 'automatic'
" Execute the forecast
FCEXEC hndl time timedim INTO fcout1 -
seasonal fcseas1 smseasonal fcsmseas1 backcast fcin1
" Create a report showing the input and output of the forecast
REPORT DOWN timedim fcin1 fcout1 fcseas1 fcsmseas1
" Run a program named queryall to retrieve the characteristics
" of the forecasting trials
QUERYALL
" Close the forecasting context
FCCLOSE hndl
END
The autofcst program opens a forecasting context, sets the option of the forecast to
AUTOMATIC, reports on the forecasted data, and queries and reports the
characteristics of the various trials that Oracle OLAP performed to determine the
method to use, and closes the forecasting context.
The autofcst program contains the following report command that displays a report
of the input to and the output from the forecast.
REPORT DOWN timedim fcin1 fcout1 fcseas1 fcsmseas1
Feb01 NA 2,736.4811 NA NA
Mar01 NA 3,408.3656 NA NA
Apr01 NA 714.277175 NA NA
May01 NA 2,502.9315 NA NA
Jun01 NA 3,195.3626 NA NA
Jul01 NA 3,911.6058 NA NA
Aug01 NA 4,000.651 NA NA
Sep01 NA 4,220.2658 NA NA
Oct01 NA 3,416.0208 NA NA
Nov01 NA 2,827.3943 NA NA
Dec01 NA 2,990.8629 NA NA
The queryall program and a sample report created from its output is shown in
Example 7–87, "Querying a Forecast" on page 7-142.
FCSET
The FCSET command specifies the characteristics that you want the Geneva
Forecasting engine to use when executing a forecasting context created using a
FCOPEN statement.
You must use a FCSET statement in combination with other OLAP DML statements as
outlined in "Forecasting Programs" on page 4-20.
Syntax
FCSET handle-expression forecast-characteristic
where forecast-characteristic has the following syntax:
[ALLOCLAST {YES|NO}]
[ALPHA {MAX|MIN|STEP} decimal]...
[APPROACH {'APPAUTO'|'APPMANUAL']
[BETA {MAX|MIN|STEP} decimal]...
[COMPSMOOTH {YES|NO}]
[CYCDECAY {MAX|MIN} decimal]...
[GAMMA {MAX|MIN|STEP} decimal]...
[HISTPERIODS integer]
[MAXFACTOR decimal]
[METHOD 'method']
[MINFCFACTOR decimal]
[MPTDECAY {MAX|MIN} decimal]...
[NTRIALS integer]
[PERIODICITY cycle-spec]
[RATIO decimal]
[SMOOTHING {YES|NO}]
[TRANSFORM {'TRNOSEA'|'TRSEA'|'TRMPT'}]
[TRENDHOLD {MAX|MIN|STEP} decimal]...
[WINDOWLEN integer]
Arguments
handle-expression
An INTEGER expression that is the handle to forecast context that you want to query
and that was previously opened using the FCOPEN function.
ALLOCLAST {NO|YES}
Indicates whether the forecast engine reduces the risk of over-adjustment by allocating
or forecasting the last cycle.
■ NO specifies that the forecast engine forecasts the last cycle. (Default)
■ YES specifies that the forecast engine forecasts only the average value for one
period of the cycle. That average value is then multiplied by factors to give the
remaining points in that period. For example, when the last cycle has 24-hour
periods, only an average hourly value is forecast, which is then multiplied by 24
hourly factors to give the value for each hour.
APPROACH {'APPAUTO'|'APPMANUAL'}
Specifies the approach that the forecasting engine takes when it executes the forecast.
■ 'APPAUTO' is the default approach which invokes the Geneva forecasting expert
system which tests all of possible forecasting methods and options for these
methods and chooses and uses the method that best fits the data. When you
specify this value, the expert system ignores any value that you specify for the
METHOD keyword.
Once the method is chosen, the expert system chooses alpha, beta, gamma, trend
hold, cyclical decay and MPT transformation settings from the maximum and
minimum settings you code. To set these values for the APPAUTO approach, you
specify the same value for both minimum and maximum. For example, to specify
a value of .2 for alpha, set ALPHA MIN to .2 and ALPHA MAX to .2. The
expert system uses any other global parameters that you have set. (Default)
■ 'APPMANUAL' indicates that the Geneva Forecasting engine uses the method and
options you specify in this FCSET statement when executing the forecast.
COMPSMOOTH {YES|NO}
Indicates whether optimization should be done on the median smoothed data series.
■ NO specifies that the methods are done using the original historical time series
data. (Default)
■ YES specifies that optimization is done on the median smoothed data series, which
results in more smoothed or "baseline" forecasts.
HISTPERIODS integer
The number of historical periods. For integer, you can specify any INTEGER value
from 1 through 50000, which is the maximum number of time dimension values that
can be present in the time-series expression specified in the FCEXEC command. (Note
that the number of forecast periods is derived by subtracting the value of
HISTPERIODS from the STATLEN of the dimension of the time-series expression.)
MAXFCFACTOR decimal
Specifies the upper bound on the forecast data. The number you specify for decimal
indicates a multiple of the largest value in the historical series. For example, when you
specify 10.0, the upper bound will be 10 times the largest value in the historical
series. The default value is 100.0.
METHOD 'method''
Specifies the forecasting method that you want the forecasting engine to use. Values
that you specify for method are ignored unless the value of APPROACH is set to
'APPMANUAL'.
You can specify one of the following keywords for method:
■ AUTOMATIC specifies that the forecasting engine determines and uses the method
that is the best fit for the data. (Default)
■ LINREG specifies the linear regression method in which a linear relationship
(y=a*x+b) is fitted to the data.
MINFCFACTOR decimal
Specifies the lower bound on the forecast data. The number you specify indicates a
multiple of the smallest value in the historical series. For decimal, you can specify any
decimal value from 0.0 through 1.0. For example, when you specify 0.5 the lower
bound will be half the smallest value in the historical series. The default value of
decimal is 0.0.
uses when it unravels the predictions on a moving periodic total (MPT) series. For
decimal, you can specify any decimal value from 0.2 through 1.0 as long as the
difference between the values of MPTDECAY MIN and MPTDECAY MAX is
evenly divided by 0.4. The default value of decimal is 1.0.
■ MPTDECAY MIN decimal specifies the minimum value of the parameter that the
forecasting engine uses when it adjusts the decay of estimates of base values that it
uses when it unravels the predictions on a moving periodic total (MPT) series. For
decimal, you can specify any decimal value from 0.2 through 1.0 as long as the
difference between the values of MPTDECAY MIN and MPTDECAY MAX is
evenly divided by 0.4. The default value of decimal is 0.2.
NTRIALS integer
Specifies the number of trials that the forecasting engine runs to determine the
forecast. For integer, you can specify any INTEGER value from 1 through 3. The
default value of decimal is 3.
PERIODICITY cycle-spec
Specifies either the number of periods for a single cycle or the number of periods in
each of a set of nested cycles.
You do not have to specify this parameter when you are using a dimension of type
DAY, WEEK, MONTH, QUARTER, or YEAR. In this case, the forecasting engine
derives the periodicity from the number of time dimension periods that constitute a
year (for example, there are 52 WEEK periods in a year).
When you are not using a dimension of type DAY, WEEK, MONTH, QUARTER, or
YEAR, the default value for cycle-spec is 1, which specifies that the data is not grouped
at all (that is, each period is logically independent).
Cycles are groupings of time periods that repeat through the time span of the data. For
example, daily periods can be grouped into a weekly cycle and weekly periods can be
grouped into a yearly cycle. In this case, the cycles are said to be nested, with the
yearly cycle more aggregate than the weekly cycle, and the weekly cycle more detailed
than the yearly cycle. By specifying cycles at a more detailed level, you allow OLAP to
conduct a finer-grained search for factors that affect the data.
■ To specify a single cycle, set cycle-spec to an INTEGER from 1 through 25000. The
INTEGER indicates the number of periods into which the cycle should be divided.
For example, the INTEGER 12 specifies that the cycle should be divided into 12
periods.
■ To specify a series of nested cycles, set cycle-spec to a series of up to six INTEGER
values enclosed in parentheses and separated by commas. Each value in the series
is the number of periods in one of the nested cycles. The cycles are ordered from
most aggregate to least aggregate. For example, when cycle-spec is (52,7), this
indicates two cycles in which the most aggregate cycle is divided into 52 periods
and each of those periods is divided into seven periods. In this example, the year
is divided into 52 weeks, and each of those weeks is divided into seven days.
RATIO decimal
Specifies the ratio of the size of the window that the forecasting engine uses for
smoothing and the total number of historical periods. The forecasting engine uses this
value to determine the number of backcast periods. You can specify any decimal value
from 1/26 through 1/2. The default value of decimal is 1/3.
SMOOTHING {YES|NO}
Indicates whether the forecasting engine should smooth the data for the forecast. The
default value is NO. Specify YES when you want the forecasting engine to smooth the
data.
TRANSFORM {'TRNOSEA'|'TRSEA'|'TRMPT'}
The data filter that the forecasting engine uses when executing the forecast.
■ 'TRNOSEA' indicates that the forecasting engine will not seasonally adjust the data.
(Default)
■ 'TRSEA' indicates that the forecasting engine will transform using a filter that
seasonally adjusts the data.
■ 'TRMPT' indicates that the forecasting engine will transform using a moving
periodic total (MPT) filter.
WINDOWLEN integer
Specifies the number of points that the forecasting engine uses when it determines
median values when it performs median smoothing. Median smoothing eliminates
extreme variations in the data by replacing each data point in a series by the median
value of itself and its neighbors. For integer, you can specify any INTEGER value from
1 through 13. The default value of integer is 3.
Examples
For an example of a forecasting program, see Example 9–118, "A Forecasting Program"
on page 9-245.
FETCH
The FETCH command specifies how analytic workspace data is retrieved for use in the
relational table created by the OLAP_TABLE function which you use to access analytic
workspace data using SQL.
You can only use the FETCH command in the OLAP_command parameter of the OLAP_
TABLE function; you cannot use it in any other context.
Within the OLAP_TABLE function, the FETCH keyword specifies explicitly how
analytic workspace data is mapped to a table object. The FETCH keyword is provided
for Express applications that are migrating to the Oracle Database.
Note: Use the FETCH keyword in OLAP_TABLE only when you are
upgrading an Express application that used the FETCH command for
SNAPI. When you are upgrading an Express application, note that the
syntax is the same here as in Express 6.3. You can use the same
FETCH commands that you used previously.
When using FETCH as an argument in OLAP_TABLE, you must enter the entire
statement on one line, without line breaks or continuation marks of any type.
To fetch or import data from an relational table into analytic workspace objects using
SQL commands embedded in the OLAP DML, use the OLAP DML SQL command.
Syntax
FETCH expression... [TAG tag-exp] [LABELED] [data-order]
where data-order is one of the following:
USING <order-dim...>
ACROSS across-dim...
DOWN down-dim...
ACROSS across-dim... DOWN down-dim...
Arguments
expression...
One expression for each target column, in the same order they appear in the row
definition. Separate expressions with spaces or commas.
TAG tag-exp
This keyword is ignored; it is retained in the syntax only for backward compatibility.
LABELED
This keyword is ignored; it is retained in the syntax only for backward compatibility.
All fetches are labeled.
USING <order-dim...>
Orders the data block according to the dimension list specified in <order-dim...>.
Specify dimensions or composites or a combination of the two within angle brackets.
Dimensions are ordered from fastest to slowest varying, with the first dimension being
the fastest varying. When you specify a USING clause, then you cannot specify
ACROSS or DOWN.
ACROSS across-dim...
Orders the data block in columns and rows and specifies the column dimensions. For
across-dim, specify a list of one or more dimensions, composites, the NONE keyword,
or a combination of these. When you specify two or more ACROSS dimensions, then
they vary from slowest to fastest, with the first dimension being the slowest.
When you specify ACROSS but not DOWN, then all unspecified dimensions default to
DOWN dimensions, which vary from fastest to slowest in the order that the
dimensions appear in the object definitions. However, adding the NONE keyword to
the ACROSS dimension list fetches only the first value in status for the unspecified
DOWN dimensions.
When you specify an ACROSS clause, then you cannot specify a USING clause.
DOWN down-dim...
Orders the data block in columns and rows and specifies the row dimensions. For
down-dim, specify a list of one or more dimensions, composites, the NONE keyword, or
a combination of these. When you specify two or more DOWN dimensions, then they
vary from slowest to fastest, with the first dimension being the slowest.
When you specify DOWN but not ACROSS, then all unspecified dimensions default to
ACROSS dimensions, which vary from fastest to slowest in the order that the
dimensions appear in the object definitions. However, adding the NONE keyword to
the DOWN dimension list fetches only the first value in status for the unspecified
ACROSS dimensions.
When you specify a DOWN clause, you cannot specify a USING clause.
Notes
Examples
For an example of using FETCH in OLAP_TABLE, see Example A–9, "Script Using
FETCH with OLAP_TABLE" on page A-22.
FILECLOSE
The FILECLOSE command closes an open file. When the file has not been opened, an
error occurs.
Syntax
FILECLOSE fileunit
Arguments
fileunit
An INTEGER fileunit number assigned to an open file by a previous call to the
FILEOPEN function or by an OUTFILE command.
Notes
LOG Command
You must use the LOG command with the EOF keyword, rather than FILECLOSE, to
close a file that was opened with the LOG command.
Examples
FILECOPY
The FILECOPY command copies the contents of one file (the source file) to another file
(the target file). When the target file already exists, the file is overwritten with the
copy.
Syntax
FILECOPY source-file-name target-file-name
Arguments
source-file-name
A text expression specifying the name of the file you want to copy from. Unless the file
is in the current directory, you must include the name of the directory object in the
name of the file.
Note: Directory objects are defined in the database, and they control
access to directories and file in those directories. You can use the CDA
command to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
target-file-name
A text expression specifying the name of the file you want to copy to. Unless the file is
in the current directory, you must include the name of the directory object in the name
of the file.
Examples
FILEDELETE
The FILEDELETE command deletes a file from the operating system disk space.
Syntax
FILEDELETE file-name
Arguments
file-name
A text expression specifying the name of the file you want to delete. Unless the file is
in the current directory, you must include the name of the directory object in the name
of the file.
Note: Directory objects are defined in the database, and they control
access to directories and file in those directories. You can use the CDA
command to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
Examples
FILEMOVE
The FILEMOVE command changes the name or location of a file that you specify. The
new file name may be the same or different from the original name.
Syntax
FILEMOVE old-file-name new-file-name
Arguments
old-file-name
A text expression specifying the name of the file you want to move or rename. Unless
the file is in the current directory, you must include the name of the directory object in
the name of the file.
Note: Directory objects are defined in the database, and they control
access to directories and file in those directories. You can use the CDA
command to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
new-file-name
A text expression specifying the new name or location for the file. Unless the file is in
the current directory, you must include the name of the directory object in the name of
the file.
Examples
Moving a File
The following statement moves the file log.txt from your session's current directory
object to file oldlog.txt in a directory object called backup.
FILECOPY 'log.txt' 'backup/oldlog.txt'
FILEPAGE
The FILEPAGE command forces a page break in your output when PAGING is on.
FILEPAGE can send the page break conditionally, depending on how many lines are
left on the current page
Syntax
FILEPAGE fileunit [n]
Arguments
fileunit
A fileunit number assigned to a file that is opened in WRITE or APPEND mode by a
previous call to the FILEOPEN function or by the OUTFILE command.
n
A positive INTEGER expression that indicates a page break should occur when there
are fewer than n lines left on the page. When the number of lines left equals or exceeds
n, or n equals zero, no page break occurs. When n is greater than PAGESIZE, a page
break occurs when LINENUM is not zero. When n is negative or omitted, a page break
always occurs.
Oracle OLAP calculates the number of available lines left on the page using the values
of the options that specify the page size, the current line number, and the bottom
margin. The number, which is stored in LINELEFT, is calculated according to the
following formula.
LINESLEFT = PAGESIZE - LINENUM - BMARGIN
Notes
Examples
FOR product
DO
FIL.TEXT = product
FOR month
JOINCHARS(fil.text ' ' CONVERT(sales TEXT))
FILEPUT fil.unit fil.text
DOEND
FILEPUT fil.unit ''
DOEND
FILECLOSE fil.unit
FILEPUT
The FILEPUT command writes data that is specified in a text expression to a file that is
opened in WRITE or APPEND mode.
Syntax
FILEPUT fileunit {text-exp|FROM infileunit} [EOL|NOEOL]
Arguments
fileunit
A fileunit number assigned to a file that is opened for writing (WRITE or APPEND
mode) by a previous call to the FILEOPEN function or by the OUTFILE command.
text-exp
A text expression that contains data for output.
FROM infileunit
Transfers a record read from infileunit by the FILENEXT function directly to the file
specified by fileunit. When you specify this clause, you can write selected records to an
output file while continuing to process data with the FILEVIEW command.
Note: When you use the keyword phrase FROM infileunit, you
cannot mix binary and non-binary files. When either file was opened
with the BINARY keyword, the other must be binary too.
EOL
(Default) Specifies that a newline character is appended to the output string and
written to the file.
NOEOL
Specifies that no newline character is added to the text written to the file.
Examples
FILECLOSE fil.unit
END
WHILE FILENEXT(in.unit)
DO
FILEVIEW in.unit WIDTH 1 rectype
IF rectype EQ 'A'
THEN FILEVIEW COLUMN 2 WIDTH 8 district SPACE 2 -
WIDTH 8 product ACROSS month year Yr96: saleS
ELSE FILEPUT out.unit FROM in.unit
DOEND
FILECLOSE in.unit
FILECLOSE out.unit
. . .
END
FILEREAD
The FILEREAD command reads records from an input file and processes data
according to action statements that you specify. FILEREAD handles binary and
packed decimal data, as well as text. It can handle decimal data written in E-notation
(such as .1E+9) or M-notation (such as 10M). It can convert the data to any
appropriate data type before storing it in an Oracle OLAP variable, dimension,
composite, or relation.
Syntax
FILEREAD fileunit [STOPAFTER n] [file-format] {[attribute...] action-statement1}
[[attribute...] action-statementN...]
where:
■ file-format specifies the format of the records in the input file. Use one of the
following:
RULED
CSV [DELIMITER dchar]
STRUCTURED [TEXTSTART schar] [TEXTEND echar] [DELIMITER dchar]
Arguments
fileunit
A fileunit number assigned to a file that is opened for reading (READ mode) by a
previous call to the FILEOPEN function.
STOPAFTER n
The number of records to read from the input file. When STOPAFTER is left out, or
specified with a negative number or an NA, FILEREAD processes the whole file. See
"STOPAFTER Keyword" on page 9-272.
RULED
Specifies that the record is organized in fixed-width columns, that is,
character-by-character or byte-by-byte. All lines must have exactly the same format.
RULED is the default file format. Use the COLUMN, SPACE, and WIDTH attributes to
specify the location of the data in the records.
STRUCTURED
Specifies that the record is in "structured prn" format. You must use the FIELD and
SPACE attributes to specify the location of the data in the record.
Structured files are a common output format for PC software. They are text files in
which the fields are composed of groups of characters. A group of characters is
defined by two conditions: text enclosed in double quotes, or a sequence of numbers
that is uninterrupted except by a decimal point. This means that an unquoted
sequence of numbers containing a decimal point will be stored as a single value;
however, an unquoted sequence of numbers containing commas or other delimiters to
mark off thousands will be split into several values rather than stored as a single
value. Any unquoted, non-numeric characters are ignored, except a minus sign that
immediately precedes a number is considered to be part of the number. A space
cannot separate the minus sign from the number.
When your file format does not conform to the pattern described here, you can use the
TEXTSTART, TEXTEND, and DELIMITER keywords that let you customize the
delimiters FILEREAD uses to identify the start and end of each field.
TEXTSTART schar
Specifies a single character that you want Oracle OLAP to interpret as the start of a
text field in a structured file. schar is the value of the character. The default character is
a double quote (").
TEXTEND echar
Specifies a single character that you want Oracle OLAP to interpret as the end of a text
field in a structured file. echarr is the value of the character. The default character is a
double quote (").
DELIMITER dchar
Specifies a single character that you want Oracle OLAP to interpret as the general field
delimiter in a structured file. Oracle OLAP uses the general field delimiter to identify
both numeric and text fields. dchar is the value of the character. The default character is
a comma (,).
{COLUMN|COL} n
The column in which the field starts in the input record. By default, field 1 begins in
column 1 and subsequent fields begin in the column following the previous field. The
current field's default column is the sum of the previous field's first column plus its
width plus any spaces specified for the current field.
NAVALUE val
For binary or packed input, specifies that when the input is the specified numeric
value, NA is assigned to the target object.
NASPELL 'text'
For text input, specifies that Oracle OLAP stores text as NA. When the input is the
specified text, NA is assigned to the target object. Text can be a multiline string listing
several possible NA values. In addition to the values specified for text, when the input
is NA, then NA is assigned to the target object.
ZSPELL 'text'
For textual numeric input, specifies that Oracle OLAP stores text as 0. When the input
is the specified text, zero is assigned to the target object. Text can be a multiline string
that lists several possible zero values. In addition to the values specified for text, when
the input is 0, then 0 is assigned to the target object.
YESSPELL 'text'
For text input that is BOOLEAN, specifies that Oracle OLAP stores text as YES. When
the input is text then YES is assigned to the target object. Text can be a multiline string
that lists several possible YES values. In addition to the values specified in text, when
the input is YES, ON, or TRUE, YES is assigned to the target object.
NOSPELL 'text'
For text input that is BOOLEAN, specifies that Oracle OLAP stores text as NO. When
the input is text then NO is assigned to the target object. Text can be a multiline string
that lists several possible NO values. In addition to the values specified in 'text,' when
the input is NO, OFF, or FALSE, NO is assigned to the target object.
ZEROFILL
For text numeric input, specifies that Oracle OLAP fills any spaces in the resulting text
with zeros. Any spaces in the input are replaced with zeros. The default is no filling
with zeros.
action-statement
You may specify one or more action statements to be performed each time a record is
retrieved from the input file. Typically, you will use action statements to set dimension
status and assign data retrieved from the input record to a target object in Oracle
OLAP. However, you may specify action statements that do not reference the data in
the input record. For example, one of your action statements might be an assignment
Note: When you have already specified action statements for use
with FILEREAD, you can reuse the code with SQL FETCH and SQL
IMPORT by simply adjusting the assignment statements and
eliminating the VALUE keyword (if necessary). Most of the
FILEREAD attributes (with the exception of the attributes that control
dimension processing) are not meaningful for SQL loading and are
ignored when executing within SQL FETCH and SQL IMPORT.
assignment-statement
An assignment statement lets you assign a value to an Oracle OLAP object. An
assignment statement has the following form.
object [= expression]
object is the target where the data will be assigned and stored. The object can be an
Oracle OLAP variable, dimension, dimension surrogate, composite, or relation.
expression is the source of the data value to be assigned to the target.
IF-statement
An IF statement lets you perform some action depending on whether a Boolean
expression is TRUE or FALSE. An IF statement has the following form.
IF bool-exp
THEN action
[ELSE action]
IF evaluates the Boolean expression. When it is TRUE, the THEN action occurs. When
it is FALSE, the ELSE action (if specified) occurs. When the Boolean expression is NA,
no action occurs.
An action can be one of the following:
■ NULL (no action occurs)
■ An assignment statement
■ A SELECT statement
■ An IF statement
■ A DO … DOEND statement containing action-statements
A FILEREAD IF statement may contain invocations of the VALUE keyword. You can
use a FILEREAD IF statement to process varying record types (such as records with
different structures or different target objects) with one FILEREAD statement.
In FILEREAD, the VALUE keyword can be used more than once to represent different
values from the same record. For each instance, specify the column from which to read
each value.
SELECT statement
A SELECT statement lets you perform some action based on the value of an
expression. A SELECT statement has the following form.
SELECT select-expression
[WHEN expression1 action
[WHEN expression2 action . . .]
[ELSE action]
SELECT evaluates the SELECT expression and then sequentially compares the result
with the WHEN expressions. When the first match is found, the associated action
occurs. When no match is found, the ELSE action (if specified) occurs.
An action for a SELECT statement is the same as an action for an IF statement.
A FILEREAD SELECT statement may contain invocations of the VALUE keyword.
You can use a FILEREAD SELECT statement to process varying record types (such as
records with different structures or different target objects) with one FILEREAD
statement.
ACROSS-statement: action-statement
An ACROSS statement causes the following action statement to execute once for every
value in status of the ACROSS dimension. When you want the looping to apply to
more than one action statement, enclose the action statements in angle brackets.
An ACROSS statement has the following syntax.
ACROSS dimension [limit-clause]:
action-statement
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
The following example limits month to the last six values, no matter what the current
status of month is.
ACROSS month last 6: units
In a FILEREAD ACROSS statement, you can specify attributes to indicate the position
in the record where Oracle OLAP will begin reading the fields specified by the
ACROSS phrase. To specify the position, use the attributes FIELD, SPACE, and
COLUMN. A position attribute is optional when the series of fields specified in the
ACROSS phrase begins in the next field for structured records, or the next byte for
ruled records.
<action-statement-group>
You can group several action statements together by enclosing them in angle brackets.
An action-statement-group has the following form.
<action-statement1 -
[action-statement2 . . .]>
A typical use for action statement groups is after an ACROSS statement. With the
angle bracket syntax, you can cause more than one action statement to execute for
every value in status of the ACROSS dimension.
Notes
Field Order
When an input record contains both dimension values and variable data, the
dimension values must be the first fields that are read in the record, and the variable
data values must be read after those dimension values. To do this, you can either order
the fields in the input record itself or you can use FILEREAD attributes to specify the
field positions explicitly. (See the description for the attribute argument.)
To organize the input records so that you do not need to use position attributes with
FILEREAD, put all of the dimension values in the first fields of the record and put the
variable data values in the last fields of the record. For example, suppose that you
have data for two variables (units and sales) that share the same dimensions in the
same order (time, product, and geography). In this case, the first three fields in the
input record should contain dimension values, while the fourth and fifth fields should
contain variable data, such as in the following sample input record.
Sep99 Snowshoes Boston 35 5565.95
STOPAFTER Keyword
By default, FILEREAD automatically reads all the records in a file in sequential order.
When you want to process only the first part of a file, use the STOPAFTER keyword.
FILEREAD processes the number of records you specify, then stops. You can then
close the file.
When you want to skip the first part of the file and process the remaining records, you
can use the STOPAFTER keyword and omit the field descriptions. FILEREAD will
read the number of records you specify without processing the data. Then you issue a
second FILEREAD statement with field descriptions for processing the input. The
following program lines illustrate this method.
LIMIT district TO 'Boston'
unit = FILEOPEN('bostdata' READ)
FILEREAD unit STOPAFTER 25
FILEREAD unit WIDTH 8 product SPACE 2 ACROSS month 13 TO 24:-
WIDTH 4 PACKED sales
Dimension Maintenance
When the target object of a field description is a dimension, you can specify whether
or not to use the data in the file to add values to the dimension. The dimension
attributes are MATCH and APPEND. When you are adding values to a dimension
with APPEND, you can specify a dimension position attribute (LAST, FIRST, BEFORE
pos, AFTER pos) immediately after APPEND.
In an assignment statement of the form object=expression, dimension attributes
cannot appear on the right side of the equal sign, but must be specified before the
target object. The only exception is when dimensions as target objects also appear on
the right side, such as when you are maintaining a conjoint dimension. See
Example 9–129, "Maintaining Conjoint Dimensions with File Data" on page 9-278.
When the input contains position numbers, you cannot use the APPEND keyword to
add new values to a dimension of type TEXT, ID, DAY, WEEK, MONTH, QUARTER,
or YEAR, because the new position numbers have no associated value to be added.
The preceding examples show values of the product and district dimensions
being used to designate a value of the proddist concat dimension You could also
use the APPEND attribute when you needed to maintain any of the dimensions.
However, when you needed to process the values of product or district first,
so that the syntax would require an equal sign inside the angle brackets, you
would have to use an alternative method. (Nested equal signs are not allowed.)
For this method you would read and process the base dimension values first, and
then use the dimensions, without any field attributes, in the dimension list for the
conjoint dimension. For example, to convert the base dimension values of a
conjoint dimension to uppercase, use a statement similar to the following.
In this case, you can use one of two methods to avoid performance problems:
■ You can use CHGDFN with the SEGWIDTH keyword to change the segment size
for the variable before using FILEREAD. CHGDFN SEGWIDTH lets you specify
the size of a variable's segments. A segment is a portion of the total number of
values a variable holds. The number of segments in a variable affects the
performance of data loading and data accessing. The segment size that you specify
with a CHGDFN SEGWIDTH statement is used not only for the variable you
designate as varname, but also for all other variables and relations that are defined
with the same combination of dimensions and composites in the same order.
■ You can explicitly add composite values just as you would for a conjoint
dimension. You can use this method both for named and unnamed composites.
See "Composite Maintenance" on page 9-274.
Composite Maintenance
When you wish to explicitly maintain composites with FILEREAD, use the same
syntax that you use to maintain conjoint dimensions. When the composite is unnamed,
refer to it with the form SPARSE<dim1 dim2 ...>. See "FILEREAD with Variables
Blank Fields
When a field is blank, its value is NA and NA is assigned to the target variable.
Examples of blank fields are a text field filled with spaces, a field that begins beyond
the end of the record, or a field in a structured file that has nothing, not even a space,
between the field delimiters.
in data loss when the data from the file cannot be represented in the database
character set. For data from a ruled file, which has fixed-width columns, FILEREAD
does not translate into the database characters set, so there is no data loss.
Examples
The following program uses FILEREAD to add any new values for month and
productid to the analytic workspace and to put the data in the correct variables.You
should maintain dimensions in one FILEREAD statement, close the file, and process it
again to get the associated data.
DEFINE read.product PROGRAM
PROGRAM
VARIABLE fi INT
fi = FILEOPEN('Dr.Dat' READ)
FILEREAD fi COLUMN 1 APPEND WIDTH 5 month -
COLUMN 6 APPEND WIDTH 6 productid
FILECLOSE fi
fi = FILEOPEN('Dr.Dat' READ)
FILEREAD fi COLUMN 1 WIDTH 5 month -
COLUMN 6 WIDTH 6 productid -
COLUMN 12 WIDTH 30 productname -
COLUMN 44 WIDTH 22 units.sold
FILECLOSE fi
END
Kiyaks400
The following statements define a fileunit, open the file, read its contents and append
a value to the product dimension and assign a value to the prodnum surrogate, and
close the file.
DEFINE funit INT
funit = FILEOPEN('Ds.Dat' READ)
FILEREAD funit COL 1 APPEND W 6 product COL 7 ASSIGN W 3 prodnum
FILECLOSE funit
The data file for the variable value has the following format.
Jan02400Boston416
The following statements open the file, read its contents, match the value of the
prodnum surrogate and assign a value to the units variable, and close the file.
funit = FILEOPEN('Var.Dat' READ)
FILEREAD funit COL 1 W 5 month COL 6 MATCH W 3 prodnum -
COL 9 W 6 district COL 15 W 3 INTEGER units
FILECLOSE funit
In the preceding statement, the angle brackets automatically cause APPEND to apply
to all three dimensions. When you do not want to add new values to the base
dimensions, but want only to add new conjoint dimension values, you must explicitly
state the keyword MATCH or change the order of the target objects, as shown in the
two following statements.
fileread unit APPEND proddist = <W 8 MATCH product,W 8 MATCH district>
or
FILEREAD unit W 8 product W 8 district APPEND proddist = <product, district>
FILESET
Syntax
FILESET fileunit attrib-arg1 exp1 [attrib-argN expN ...]
where attrib-arg is one of the following:
BMARGIN
LINENUM
LSIZE
ORIGIN
PAGENUM
PAGEPRG
PAGESIZE
PAGING
PAUSEATPAGEEND
TABEXPAND
TMARGIN
Arguments
fileunit
A fileunit number that is assigned to a file opened previously using a FILEOPEN
statement or by an OUTFILE statement. You can set attributes only for an open file. An
attribute argument specifies the file characteristic to change. The attribute must be
appropriate for the fileunit specified; otherwise, Oracle OLAP returns an error. You
can set several attributes in one FILESET statement by listing the attribute name and
its new value in pairs.
BMARGIN
Specifies the number of blank lines that make up the bottom margin.
LINENUM
Specifies the current line number. Resets after each page break when PAGING is on;
otherwise, keeps incrementing.
LSIZE
Specifies the maximum line length for text output files, or the record length for binary
input files.
ORIGIN
Specifies the type of system on which the file was created. The default value of the
ORIGIN attribute reflects the system you are currently working on, so you must set
ORIGIN when the file originated on a different system. The setting of ORIGIN affects
how data reading statements interpret the files. For example, data reading statements
use this information to decide whether bytes of binary data need to be reversed, and
so forth. Table 9–8, " Values for ORIGIN Clause of FILESET" will help you make the
right choice. When your system is not listed, try using PC or HP as the value of
ORIGIN. When one value does not work, the other one should.
PAGENUM
Specifies the current page number.
PAGEPRG
Specifies the OLAP DML program that produces page titles and headings when
output is paged.
PAGESIZE
Specifies the number of lines on each page.
PAGING
Specifies if the output is formatted in pages. This is equivalent to setting the PAGING
option to YES.
PAUSEATPAGEEND
Specifies if Oracle OLAP should pause after each page.
TABEXPAND
Specifies if tab characters should be expanded. When TABEXPAND is zero, tab
characters are not expanded. A value greater than 0 indicates the distance, in bytes,
between tab stops. The default value of TABEXPAND is 8.
TMARGIN
Specifies the number of blank lines that make up the top margin.
exp
An expression that contains the new value for the attribute being set. The data type of
the expression must be the same as the data type of the attribute.
Examples
FILEVIEW
The FILEVIEW command works in conjunction with the FILENEXT function to read
one record at a time of an input file, process the data, and store the data in Oracle
OLAP dimensions and variables according to the descriptions of the fields. Use
FILENEXT to read the record, then use one or more FILEVIEW statements to process
the fields as needed. FILEVIEW has the same attributes as FILEREAD for specifying
the format of the input and the processing of the output.
Syntax
FILEVIEW fileunit [field-desc...]
Arguments
fileunit
A fileunit number that is assigned to a file opened for reading (READ mode) in a
previous call to the FILEOPEN function.
field-desc
A field description describes how to process one or more fields in each input record.
Attributes in the field description specify how to format the input data. FILEVIEW
reads each field according to the format specification and assigns the input data to the
specified object. You can assign the data to the object directly or you can specify an
expression to manipulate the data before you assign it. One field description can
assign data from one input field to one Oracle OLAP object. Alternately you can use
the ACROSS keyword to assign several values in the input record to a variable that is
dimensioned by the fastest varying dimension. Because field attributes include the
column number in the input record, you can process input fields in any order.
The format for the field description is as follows.
[[pos] ACROSS dim [limit-clause]:] [attribs] object [= exp]
pos
One or more attributes that specify the position in the record where Oracle OLAP will
begin reading the fields specified by the ACROSS description. To specify the position,
use the attributes FIELD, SPACE, and COLUMN (see the FILEREAD command). The
pos argument is optional when the series of fields specified in the ACROSS phrase
begins in the next field for structured records, or the next byte for ruled records.
ACROSS-statement: action-statement
Specifies the dimension of one or more data fields in the input record. FILEVIEW
assigns the data in the fields to a variable according to the values in the current status
of dim. Typically, each field description processes one value. However, using the
ACROSS keyword, you can process one input value for each dimension value
currently in the status. When you want the looping to apply to more than one action
statement, enclose the action statements in angle brackets.
An ACROSS statement has the following syntax.
ACROSS dimension [limit-clause]:
action-statement
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
The following example limits month to the last six values, no matter what the current
status of month is.
ACROSS month last 6: units
attribs
One or more attributes that tell Oracle OLAP the position in the record and the format
of the input data. (See the FILEREAD command for an explanation of the available
attributes.)
object [= exp]
An Oracle OLAP variable, dimension, or relation to which the input data is assigned.
When = exp is missing, the data is assigned implicitly to the object. When = exp is
present, the data is processed according to the expression and then assigned to object.
You can use the keyword VALUE to represent the value in a particular field of a
record. VALUE represents the data from the file, formatted according to the
FILEREAD attributes you use. When the field in the record is blank, FILEREAD
considers its value to be NA. By default, the data type of VALUE is the data type of the
target object. However, you can specify a different data type with an attribute
keyword. VALUE can be used more than once to represent different values from the
same record. For each instance, specify the column from which to read each value, as
shown in the following example code.
sales = if col 1 w 1 text value eq 'A' then col 2 w 8 value -
else col 10 w 8 value
In this example, the default data type of VALUE is decimal, which is the data type of
the target object sales. However, the first instance of VALUE is compared to a text
expression, so you must use the attribute TEXT to specify its data type.
SELECT exp
The SELECT field-description keyword processes varying record types (such as
records with different structures or different target objects) with one FILEVIEW
statement. Within a field description, you can use the following syntax:
SELECT exp -
[WHEN exp action [WHEN exp action ...]] -
[ELSE action]
IF bool-exp THEN action [ELSE action]
DO
field-desc
[field-desc]
...
DOEND
The action argument is one of the following:
■ NULL (no action occurs)
■ field-description, including nested IF and SELECT statements.
SELECT evaluates the first expression, which may contain invocations of the VALUE
keyword, and which has a default data type of TEXT. SELECT then sequentially
compares the result with the WHEN expressions. When the first match is found, the
associated action occurs. When no match is found, the ELSE action (if specified)
occurs.
IF bool-exp
The IF field-description keyword processes varying record types (such as records with
different structures or different target objects) with one FILEVIEW statement. Within a
field description, you can use the following syntax.
IF bool-exp THEN action [ELSE action]
action is the same as described for SELECT.
IF evaluates the Boolean expression, which may contain invocations of the VALUE
keyword. IF performs the THEN action when the expression is TRUE or the ELSE
action, if specified, when the expression is FALSE. No action occurs when the
expression is NA.
Notes
Record Order
FILEVIEW can process the fields in a record in any order. List the field descriptions in
the order you want to process them, identifying the fields with explicit column
numbers. You can also use several FILEVIEW statements on the same record to do
different processing depending on the data you find in the record.
Dimension Values
When the target object of a field description is a dimension, you can specify whether
the data in the file will be used to add values to the dimension or not. The dimension
attributes are MATCH and APPEND:
■ MATCH -- Any value encountered in a field must already be a value of the
dimension. FILEVIEW temporarily limits status to that value. When it is not
already a dimension value, FILEVIEW generates an error. After executing a
FILEVIEW statement, the dimension status is the same as before the execution of
the statement.
■ APPEND -- The values in the field can already exist or they can be new. When the
value exists, FILEVIEW limits status to that value; when it does not, FILEVIEW
adds the value and then limits status. The dimension is limited to ALL when
FILEVIEW is finished.
For more information about handling dimensions, see the FILEREAD command.
Attribute List
For a complete list of the attributes for FILEVIEW and FILEREAD and for more
information about processing NA values, reading date values, reading
multidimensional data, storing NTEXT values, and specifying attributes, see the
FILEREAD command.
Examples
Another record type in Record 5 represents a totals line with the contents shown in the
following table.
A third record type of Record 5 contains dashes or equal signs as row separators as
illustrated in the following table.
The program figures out which months are covered in the file, then reads the detail
lines and assigns the sales data to the appropriate district and month. The program
ignores total lines and underlines when FILEVIEW finds columns 1 through 19 blank.
The program takes the name of the data file as an argument.
DEFINE salesdata PROGRAM
LD Store Several Months of Sales Data in an Analytic Workspace
PROGRAM
VARIABLE fil.unit INTEGER
VARIABLE flag BOOLEAN
VARIABLE mname TEXT
VARIABLE label TEXT
VARIABLE savedist TEXT
FILECLOSE fil.unit
POP month district
RETURN
error:
IF fil.unit EQ NA
THEN SHOW JOINCHARS('Can\'t Open Data File ' ARG(1) '.')
ELSE IF ERRORNAME NE 'attn' AND ERRORNAME NE 'QUIT'
THEN DO
SHOW JOINCHARS('RECORD ' RECNO(fil.unit) ' is invalid.')
GOTO NEXT
DOEND
ELSE IF ERRORNAME EQ 'noread'
THEN DO
SHOW 'File Too Short.'
FILECLOSE fil.unit
DOEND
ELSE DO
SHOW 'Data Import Interrupted.'
FILECLOSE fil.unit
DOEND
POP month district
RETURN
You can read this data using the VALUE keyword as a function with FILEVIEW in a
program similar to the following one (named try). However, this first example does
not work. The FILEVIEW command will skip fields. The reason for the data skipping
is that each time FILEREAD fetches a field from the current record, it updates the
column pointer to point past the field. When the next fetch does not specify a position
(using the COLUMN, SPACE, or FIELD attribute), data will be read from the default
position established by the previous fetch. This usually desirable behavior will not
work when more than one fetch is needed to perform a single assignment. This
happens when the VALUE function is coded twice in the same IF...THEN...ELSE
command block, as shown here. The NAMELIST and DIRLIST attributes return one
value for multiple versions of a particular file name in the directory. The NAMELIST
attribute also returns only one value for multiple files in the directory with the same
root file name but different file types.
DEFINE try PROGRAM
PROGRAM
VARIABLE funit INTEGER
DEFINE dvar VARIABLE DECIMAL <year>
PUSH year
LIMIT year TO LAST 5
TRAP ON ERROR
funit=FILEOPEN('numbers.dat' R)
WHILE FILENEXT(funit)
DO
FILEVIEW funit ACROSS year: W 15 TEXT dvar = -
IF FINDCHARS(VALUE, 'e') EQ 0 - "Incorrect Use of Value
THEN CONVERT(VALUE, dec) - "Results in Skipped
ELSE -9999.99 "Fields
REPORT DOWN year dvar
DOEND
error:
FILECLOSE funit
DELETE dvar
POP year
END
YEAR DVAR
------------- ----------
Yr93 2.00
Yr94 4.00
Yr95 NA
Yr96 -9,999.99
Yr97 -9,999.99
YEAR DVAR
------------- ----------
Yr93 -2.00
Yr94 -4.00
Yr95 NA
Yr96 -9,999.99
Yr97 -9,999.99
YEAR DVAR
------------- ----------
Yr93 0.00
Yr94 -9,999.99
Yr95 -9,999.99
Yr96 -9,999.99
Yr97 -9,999.99
However, when the SPACE attribute is used to make the second VALUE back up
some distance so it reads the same field that the first VALUE read, everything works
fine. SPACE can be used in the preceding sample program by changing the THEN
clause to the following clause.
THEN CONVERT(SPACE -15 VALUE, dec) -
YEAR DVAR
------------- ----------
Yr93 1.00
Yr94 2.00
Yr95 3.00
Yr96 4.00
Yr97 5.00
YEAR DVAR
------------- ----------
Yr93 -1.00
Yr94 -2.00
Yr95 -3.00
Yr96 -4.00
Yr97 -5.00
YEAR DVAR
------------- ----------
Yr93 0.00
Yr94 0.00
Yr95 -9,999.99
Yr96 -9,999.99
Yr97 -9,999.99
FOR
Within an OLAP DML program, the FOR command specifies one or more dimensions
whose status will control the repetition of one or more statements. These statements,
along with the FOR statement itself, are often called a FOR loop.
Syntax
FOR dimension...
statement
Arguments
dimension
One or more dimensions whose current status controls the repetition of one or more
statements. The statements are repeated for each combination of the values of the
specified dimensions in the current status. When two or more dimensions are
specified, the first one varies the slowest. You can specify a composite instead of a
dimension.
statement
The statement to be repeated. To repeat two or more statements, enclose them between
DO and DOEND.
DO
statement1
...
statementN
DOEND
When you are repeating only one statement after FOR, you can omit DO and DOEND.
Notes
FOR Dimension
A FOR statement loops over the values in status of the specified dimension. After the
last dimension value, dimension status is restored to what it was before the loop, and
execution of the program resumes with the next statement.
No Sorting
Because current status defines and controls a FOR loop, you cannot sort the FOR
dimension within the loop.
Branching
You can use BREAK, CONTINUE, and GOTO statements to branch within, or out of, a
FOR loop, thereby altering the sequence of statement execution.
Examples
Jan96 307
Feb96 209
Mar96 277
When your data is multidimensional, you can specify more than one dimension in a
FOR statement to control the order of processing. For example, you can use the
following statement to control the order in which dimension values of the units data
are processed.
FOR month district product
units = ...
When this assignment statement is executed, the month dimension varies the slowest,
the district dimension varies the next slowest, and the product dimension varies
the fastest. Thus, a loop is performed over all products for the first district before
doing the next district, and over all districts for the first month before doing the next
month.
Within the FOR loop, each specified dimension is temporarily limited to a single value
while it executes the statements in the loop. You can therefore work with specific
combinations of dimension values within the loop.
4. After processing all the products, the FOR loop is complete for the first district.
5. The loop is executed for the second district, and so on.
Note that while the FOR loop executes, each dimension that is specified in a FOR
statement is limited temporarily to a single value. When you specify district in
the FOR loop, but not product, then all the values of product are in status while
the FOR loop executes. The IF...THEN...ELSE command then tests data for only
the first value of the product dimension.
FORECAST
Use the FORECAST command to forecast data by one of three methods: straight-line
trend, exponential growth, or Holt-Winters extrapolation. FORECAST performs the
calculation according to the method you specify and optionally stores the result in a
variable in your analytic workspace.
You can then execute FORECAST.REPORT to produce a standard report of the
forecast. You can also use the INFO function to obtain portions of the results for use in
your own customized reports or for further analysis.
Syntax
FORECAST [LENGTH n] -
[METHOD {TREND|EXPONENTIAL|WINTERS PERIODICITY p [argument...]}] -
[TIME dimension] [FCNAME name] time-series
where argument is one or more of the following clauses that specify the characteristics
of the forecast:
ALPHA n
BETA n
GAMMA n
STSMOOTHED n STSEASONAL n-series STTREND n
FCSMOOTHED name
FCSEASONAL name
FCTREND name
Arguments
LENGTH n
Specifies the number of periods to forecast. The default is zero. When you supply a
LENGTH, you must also supply the FCNAME option.
METHOD TREND
(Default) Specifies that the forecasting technique is a straight-line extrapolation of
historical data.
METHOD EXPONENTIAL
Specifies that the forecasting technique is an extrapolation of historical data using a
constant period-to-period percentage growth.
METHOD WINTERS
Specifies that the forecasting technique is the Holt-Winters method, an extrapolation
method that allows for both a linear trend and seasonal fluctuations in the data. Oracle
OLAP first constructs three statistically related series for each time period of the
historical data. (See "Holt-Winters Constructed Series" on page 9-296.) Then, Oracle
OLAP produces a forecast from the three series for the specified number of periods
into the future.
You can supply several arguments that affect the results of the Holt-Winters forecast.
The only required one is PERIODICITY. For the others, Oracle OLAP chooses a
reasonable value based on the data available.
PERIODICITY p
The length of the seasonal cycle, where p is an expression that specifies an INTEGER
greater than or equal to 2. For example, when the data you are analyzing has monthly
values, then p is 12.
PERIODICITY is required when you use the METHOD WINTERS keyword.
ALPHA n
BETA n
GAMMA n
Smoothing constants for the first three series calculated for the Holt-Winters forecast
(See "Holt-Winters Constructed Series" on page 9-296). ALPHA is for the smoothed
data series; BETA is for the seasonal index series; and GAMMA is for the trend series.
The value n is a decimal expression greater than 0 and less than or equal to 1. Each
value is optional. When you omit one, Oracle OLAP calculates an optimal smoothing
constant for that series that minimizes the Mean Absolute Percent Error of the
one-period-ahead forecasts in the historical time periods.
FCSMOOTHED name
FCSEASONAL name
FCTREND name
Numeric variables in which Oracle OLAP can store the data calculated for the
smoothed data series, the seasonal index series, and the trend series (See "Holt-Winters
Constructed Series" on page 9-296). The variable specified by name must have the
TIME dimension as one of its dimensions. The series calculations produce DECIMAL
results, but Oracle OLAP will convert the values to the data type of name before
storing them. You can save any or all of the preliminary series. When you do not save
a series, Oracle OLAP discards the values after completing the forecast.
TIME dimension
The name of the dimension considered to be the time dimension. The current status of
dimension determines the number of periods of historical data used to calculate the
forecast. The status of the time dimension must be an increasing, consecutive range of
values. LENGTH specifies how many values immediately beyond this range will be
forecast.
When time-series has only one dimension, the time dimension will default to that.
When time-series has more than one dimension, and one of the dimensions has a type
of DAY, WEEK, MONTH, QUARTER, or YEAR, the time dimension will default to
that. Otherwise, you must specify the time dimension, even when the additional
dimensions are limited to a single value. FORECAST only uses the first value in the
status for dimensions other than the time dimension.
FCNAME name
The name of a numeric variable in which to store the values calculated by FORECAST.
Name must be dimensioned by the time dimension; it can have other dimensions as
well. When the data type of name is not decimal, FORECAST converts the values to the
appropriate data type.
Fitted values, which correspond to the historical data, are stored in name for the
current status of the time dimension. Forecasted values are stored in name for the
number of periods specified by LENGTH. These forecasted periods immediately
follow the current status of the time dimension.
For the Holt-Winters method, the fitted values are one-period-ahead forecasts
calculated at the previous period. The final forecasted values are extrapolated from the
fitted data.
For the TREND and EXPONENTIAL methods, FORECAST obtains the fitted values by
evaluating the regression equation over the current status of the time dimension.
time-series
An expression that specifies the time series to be forecast. Time-series must be a
numeric expression that is dimensioned by the time dimension. When time-series has
other dimensions, FORECAST uses the first value only in their current status. The
time-series is the historical data from which FORECAST calculates fitted and forecasted
values. (See the explanation for FCNAME.)
Notes
Order of Arguments
You can specify the arguments for FORECAST in any order, except that time-series, the
expression specifying the data to be forecast, must be last.
Zero Values
All methods allow zero values in the historical data, specified by time-series, but those
time periods are excluded from the Mean Absolute Percent Error (MAPE) calculation.
Examples
You can now execute FORECAST.REPORT to see the values that have been generated.
Running the FORECAST.REPORT program for that forecast produces the following
report.
Forecasting Analysis
====================
You can now execute FORECAST.REPORT to see the values that have been generated.
Running the FORECAST.REPORT program for that forecast produces the following
report.
Forecasting Analysis
====================
FORECAST.REPORT
Syntax
FORECAST.REPORT
Examples
FULLDSC
The FULLDSC program produces a report that lists the definition of one or more
workspace objects, including the properties and triggers of the object(s).
Syntax
FULLDSC [names]
Arguments
names
The names of one or more workspace objects, separated by spaces or commas.
FULLDSC shows the full definition of each object specified. When you omit this
argument, FULLDSC shows the definition of all objects in the current status of the
NAME dimension.
Notes
Output of FULLDSC
The FULLDSC program is an extension to the DESCRIBE command. That is, the object
definition that you list with FULLDSC includes the definition components that are
listed by the DESCRIBE command, followed by any properties that are assigned to the
object. Each property is listed on its own line with the word PROPERTY, the name of
the property, and its value.
Paginated Output
You can produce paginated output with a FULLDSC statement by setting PAGING to
YES before using FULLDSC.
Examples
See Also: Example 10–159, "Describing Triggers" on page 10-265
Suppose the DECPLACE property had been specified with the following statement,
where PRPNAME is a variable whose value is DECPLACE.
PROPERTY prpname 4.00
The output from FULLDSC would be the same as that shown in the preceding
example; the value 4.00 would be shown as 4. Therefore, when you created an object
using the INFILE technique with the FULLDSC output, the newly created property
value would have a type of INTEGER (based on the value 4) even though the original
property value had a type of DECIMAL (based on the value 4.00). In most cases, this
difference is immaterial, because the appropriate conversions are performed when the
property values are used.
GOTO
Within an OLAP DML program, the GOTO command alters the sequence of statement
execution within a program.
Syntax
GOTO label
Arguments
label
The name of a label elsewhere in the program constructed following the "Guidelines
for Constructing a Label" on page 9-303. Execution of the program branches to the line
directly following the specified label.
Note that label, as specified in GOTO, must not be followed by a colon. However, the
actual label elsewhere in the program must end with a colon.
Notes
executed conditionally using FOR, IF...THEN...ELSE, or WHILE. You can also use a
SWITCH command to handle different cases within the same program.
Examples
SWITCH &UPCASE(ARG(1))
DO
CASE 'EAST':
..." (statement group 1)
BREAK
CASE 'WEST':
... "(statement group 2)
BREAK
CASE 'CENTRAL':
..." (statement group 3)
BREAK
DOEND
argerror:
..." statements to handle error)
END
GROUPINGID command
See also: See "Gidrel Relation" on page 1-18 for more information
and the GROUPING_ID function in Oracle Database SQL Language
Reference for more information on grouping ids.
Syntax
GROUPINGID [parent-relation] INTO destination-object -
{USING level-relation} [INHIERARCHY {inh-variable | inh-valueset}] [LEVELORDER lo-valueset] -
[ROLLUP | GROUPSET]
where destination-object is one of the following:
grouping-relation
grouping-variable
grouping-surrogate
Arguments
parent-relation
A self-relation for a hierarchical dimension. This self-relation is dimensioned by a
hierarchical dimension. The values of the self-relation are the parents of each value in
the hierarchical dimension. The parent-relation argument is optional only when you use
the GROUPINGID command to populate a surrogate and the GROUPINGID
command includes a LEVELORDER clause.
grouping-relation
The name of a previously-defined relation. One of the dimensions of grouping-relation
must be the hierarchical dimension. The values of grouping-relation are calculated and
populated when the GROUPINGID command executes. When you specify a relation
as the destination object, Oracle OLAP automatically creates and sets the $GID_
DEPTH property on the relation when it populates it.
grouping-variable
The name of a previously-defined numeric variable. One of the dimensions of
grouping-variable must be the hierarchical dimension. The data type of grouping-variable
can be any numeric type including NUMBER. The values of grouping-variable are
calculated and populated when the GROUPINGID command executes.See the
DEFINE VARIABLE command for information on defining variables.
grouping-surrogate
The name of a previously-defined surrogate for the hierarchical dimension. The values
of grouping-surrogate are calculated and populated when the GROUPINGID
command executes. See the DEFINE SURROGATE command for information on
defining surrogates.
USING
Specifies that the level of the values of the hierarchical dimension are to be considered
when creating grouping ids.
level-relation
A relation that is dimensioned by the hierarchical dimension. For each value of the
hierarchical dimension, the relation has its value the name of the level for the
dimension's value.
INHIERARCHY
Specifies that only some of the values of the hierarchical dimension are to be
considered when creating grouping ids.
inh-variable
A BOOLEAN variable that is dimensioned by the hierarchical dimension and, when
the hierarchical dimension is a multi-hierarchical dimension, by a dimension that is
the names of the hierarchies. The values of the variable are TRUE when the dimension
value is in a hierarchy and FALSE when it is not.
inh-valueset
The name of a valueset object whose values identify the hierarchical dimension values
to be considered when creating grouping ids. Values not included in the valueset are
ignored.
LEVELORDER
Specifies the top-down order of the levels when creating grouping ids.
lo-valueset
The name of a valueset object whose values are the names of the levels to be used
when creating grouping ids. The order of the values in the valueset object determine
the grouping id assigned.
ROLLUP
Specifies that Oracle OLAP creates the grouping ids in the same manner as SQL does
when you specify ROLLUP in the GROUPBY clause of a SQL SELECT statement. See
Oracle Database SQL Language Reference for more information.
The ROLLUP keyword is valid only when the destination object is a relation. When
you specify this keyword, $GID_TYPE and $GID_LIST properties.
GROUPSET
Specifies that Oracle OLAP creates the grouping ids in the same manner as SQL does
when you specify a grouping set in the GROUPBY clause of a SQL SELECT statement.
The GROUPSET keyword is valid only when the destination object is a relation. When
you specify this keyword, Oracle OLAP also creates and populates two properties on
the grouping id relation: the $GID_TYPE and $GID_LIST properties.
Examples
Example 9–144 Using GROUPINGID Command to Populate a Relation with Grouping Ids
Assume your analytic workspace contains the following objects.
DEFINE GEOG DIMENSION TEXT
LD A dimension with two hierarchies for geography
GEOG_HIERLIST
--------------
Political_Geog
Sales_Geog
-------------GEOG_PARENTREL--------------
--------------GEOG_HIERLIST--------------
GEOG Political_Geog Sales_Geog
-------------- -------------------- --------------------
Boston MA MA
Springfield MA MA
Hartford CT CT
Mansfield CT CT
Montreal Quebec Quebec
Walla Walla WA WA
Portland WA WA
Oakland CA CA
San Diego CA CA
MA USA East
CT USA East
WA USA West
CA USA West
Quebec Canada East
East NA All Regions
West NA All Regions
All Regions NA NA
USA All Countries NA
Canada All Countries NA
All Countries NA NA
->REPORT W 20 geog_inhier
GEOG_HIERLIST GEOG_INHIER
-------------- --------------------
Political_Geog Boston
Springfield
Hartford
Mansfield
Montreal
Walla Walla
Portland
Oakland
San Diego
MA
CT
WA
CA
Quebec
USA
Canada
All Countries
Sales_Geog Boston
Springfield
Hartford
Mansfield
Montreal
Walla Walla
Portland
Oakland
San Diego
MA
CT
WA
CA
Quebec
East
West
All Regions
--------------GEOG_LEVELREL--------------
--------------GEOG_HIERLIST--------------
GEOG Political_Geog Sales_Geog
-------------- -------------------- --------------------
Boston City City
Springfield City City
Hartford City City
Mansfield City City
Montreal City City
Walla Walla City City
Portland City City
Oakland City City
San Diego City City
MA State-Prov State-Prov
CT State-Prov State-Prov
WA State-Prov State-Prov
CA State-Prov State-Prov
Quebec State-Prov State-Prov
East NA Region
West NA Region
All Regions NA All Regions
USA Country NA
Canada Country NA
All Countries All Countries NA
To create grouping ids for the values of geog, you first define a GID dimension with
the following definition and you populate it with more values than you expect to have
for grouping ids.
DEFINE GID_DIMENSION DIMENSION NUMBER (16,0)
Now you execute the GROUPINGID command to populate the geog_gidrel relation.
GROUPINGID geog_parentrel INTO geog_gidrel USING geog_levelrel -
INHIERARCHY geog_inhier
---------------GEOG_GIDREL---------------
--------------GEOG_HIERLIST--------------
GEOG Political_Geog Sales_Geog
-------------- -------------------- --------------------
Boston 0 0
Springfield 0 0
Hartford 0 0
Mansfield 0 0
Montreal 0 0
Walla Walla 0 0
Portland 0 0
Oakland 0 0
San Diego 0 0
MA 1 1
CT 1 1
WA 1 1
CA 1 1
Quebec 1 1
East NA 3
West NA 3
All Regions NA 7
USA 3 NA
Canada 3 NA
All Countries 7 NA
When you execute a FULLDSC of geog_gidrel, you can see that the $GID_DEPTH
property has been created and populated for geog_gidrel.
DEFINE GEOG_GIDREL RELATION GID_DIMENSION <GEOG GEOG_HIERLIST>
PROPERTY '$GID_DEPTH' 4
Reports for the new objects created by this code (geography.newparent and
geog.gid) follow.
REPORT geography.newparent
GEOGRAPHY GEOGRAPHY.NEWPARENT
---------------- ----------------
World NA
Americas World
Canada Americas
Toronto Canada
Montreal Canada
Ottawa Canada
Vancouver Canada
Edmonton Canada
Calgary Canada
Usa Americas
Boston Usa
Losangeles Usa
Dallas Usa
Denver Usa
Newyork Usa
Chicago Usa
Seattle Usa
Mexico Americas
... ...
Japan Asia
Tokyo Japan
Osaka Japan
Kyoto Japan
China Asia
Beijing China
Shanghai China
... ...
India Asia
Ireland Europe
Taiwan Asia
Thailand Asia
REPORT geog.gid
GEOGRAPHY GEOG.GID
---------------- ----------------
World 7
Americas 3
Canada 1
Toronto 0
Montreal 0
Ottawa 0
Vancouver 0
Edmonton 0
Calgary 0
Usa 1
Boston 0
Losangeles 0
Dallas 0
Denver 0
Newyork 0
Chicago 0
Seattle 0
Mexico 1
... ...
Japan 1
Tokyo 0
Osaka 0
Kyoto 0
China 1
Beijing 0
Shanghai 0
... ...
India 1
Ireland 1
Taiwan 1
Thailand 1
This chapter provides reference topics for the second set (in alphabetical order) of the
OLAP DML commands. There is one topic for each of the OLAP DML commands that
begins with the letters H-Z, beginning with HEADING.
Alphabetical and categorical listings of the OLAP DML commands and reference
topics for the remaining OLAP DML commands appear in Chapter 9, "OLAP DML
Commands: A-G".
For other OLAP DML reference topics, see Chapter 5, "OLAP DML Properties",
Chapter 6, "OLAP DML Options", Chapter 7, "OLAP DML Functions: A - K", and
Chapter 8, "OLAP DML Functions: L - Z".
HEADING
The HEADING command produces titles and column headings for a report. The
heading output is sent to the current outfile. The form of the HEADING command is
the same as that of the ROW command. When you use HEADING, however, Oracle
OLAP does not add any numeric values from the heading to column subtotals or
grand totals.
Frequently, HEADING statements are used in a PAGEPRG program to produce titles
or column headings on each page of a report.
Tip: When you know ahead of time that you will not need the
subtotaling capability of the ROW command, using the HEADING
command instead of ROW to produce the lines of your report can
provide a time savings, since Oracle OLAP will not be keeping track
of subtotals.
Syntax
HEADING [attribs] {expression1|SKIP}, [attribs] {expressionN|SKIP}
Arguments
attribs
The attributes that specify the format for each column. (See the ROW command for a
list and detailed explanation of the available attributes.)
expression
The text to be used as a column heading. To use literal text for a column heading,
enclose the text in single quotes. (See the ROW command for more information on
using expressions, attributes, and ACROSS groups to produce columns.)
SKIP
Used in place of an expression to indicate that the column is to be left blank.
Notes
The notes for the ROW command also apply to the HEADING command (with the
exception of the note on row and column arithmetic in ROW).
Examples
HIDE
The HIDE command hides the text of a program, so that you cannot display it using a
DESCRIBE, EDIT, or OBJ statement. You can perform all other actions on the program,
including executing, compiling, renaming, or exporting.
When you hide a program, you supply a seed expression, which Oracle OLAP uses to
encode the program text. You can use this seed expression later using an UNHIDE
statement to make the text visible.
Syntax
HIDE prog-name seed-exp
Arguments
prog-name
The name of the program whose text you want to hide. Do not enclose the program
name in quotes.
seed-exp
A single-line text expression to be used as a seed value when encoding of the program
text. Do not specify NA for this value.
Keep a record of this seed expression, so that you can use it later with an UNHIDE
statement. The seed expression you specify in the UNHIDE statement must be
byte-for-byte the same value as you used in this HIDE statement. Also, the seed
expression is case-sensitive, so record uppercase and lowercase characters carefully.
Notes
Examples
HIERDEPTH
For each hierarchy of relation, the HIERDEPTH command calculates the depth of that
hierarchy from the top of all of the hierarchies and stores that value in a
previously-defined relation sometimes called the depth relation.
Syntax
HIERDEPTH parent-rel [(qdr-list)] INTO depth-rel [INHIERARCHY inh-valueset ]
Arguments
parent-rel
A child-parent self-relation for the hierarchical dimension. See "Parentrel Relation" on
page 1-11 for more information.
qdr-list
A list of QDRs that limits the values of parentrel. Specify the QDRs as described in
"Syntax of a Qualified Data Reference" on page 2-29. When you do not specify a value
for qdrlist, HIERHEIGHT uses the values of parentrel that are in current status.
depth-rel
A previously -defined relation that the HIERDEPTH command populates when it
executes. This relation can have multiple dimensions; however, it must be
dimensioned by the dimensions of parentrel and one other NUMBER dimension that
represents the depth of the hierarchical dimension.
For example, assuming that parent-rel has two dimensions, dim1 and dim2, the
following lines of code define a NUMBER dimension named numdim with 3 values and,
then, define a depth relation named depthrel which is dimensioned by dim1 and dim2
that has as its values the values of numdim.
DEFINE numdim dimension NUMBER(3)
DEFINE depthrel RELATION numdim <dim1 dim2>
inh-valueset
The name of a valueset object whose values are the hierarchical dimension values to be
considered when creating grouping ids. Values not included in the valueset are
ignored. See "Inhier Valueset or Variable" on page 1-13 for more information.
Examples
------------------DEPTHREL-------------------
----------------GEOG_HIERLIST----------------
GEOG Political_Geog Sales_Geog
-------------- ---------------------- ----------------------
Boston 3 3
Springfield 3 3
Hartford 3 3
Mansfield 3 3
Montreal 3 3
Walla Walla 3 3
Portland 3 3
Oakland 3 3
San Diego 3 3
MA 2 2
CT 2 2
WA 2 2
CA 2 2
Quebec 2 2
East 0 1
West 0 1
All Regions 0 0
USA 1 0
Canada 1 0
All Countries 0 0
HIERHEIGHT command
Syntax
HIERHEIGHT parentrelation [(qdrlist)] INTO{familyrel-
[USING level-relation | A | D] [INHIERARCHY { inh-variable | inh-valueset}]
Arguments
parentrel
A child-parent self-relation for the hierarchical dimension. See "Parentrel Relation" on
page 1-11 for more information.
qdrlist
A list of QDRs that limits the values of parentrel. Specify the QDRs as described in
"Syntax of a Qualified Data Reference" on page 2-29. When you do not specify a value
for qdrlist, HIERHEIGHT uses the values of parentrel that are in current status.
familyrel
A previously -defined relation that the HIERHEIGHT command populates when it
executes. This relation can have multiple dimensions; however, it must be
dimensioned by the dimensions of parentrel and one other dimension that represents
the levels of the hierarchical dimension. The actual construct of the dimension that
represents the levels of the hierarchical dimension varies depending on whether or not
the HIERHEIGHT statement includes the USING phrase:
■ When the statement includes the USING phrase, the dimension that represents the
levels of the hierarchical dimension is a dimension that contains the names of the
levels.
■ When the statement does not include the USING phrase, the dimension that
represents the levels of the hierarchical dimension is an INTEGER dimension that
has as values the depth of the level.
When familyrel is populated before a HIERHEIGHT statement executes, the
HIERHEIGHT statement depopulates it before computing new values.
USING levelrel
Specifies that the relation is populated using the specified levelrel. See "Levelrel
Relation" on page 1-15 for more information.
A
Specifies that the relation is populated in ascending order.
D
(Default) Specifies that the relation is populated in descending order.
inh-variable
A BOOLEAN variable that is dimensioned by the hierarchical dimension and, when
the hierarchical dimension is a multi-hierarchical dimension, by a dimension that is
the names of the hierarchies. The values of the variable are TRUE when the dimension
value is in a hierarchy and FALSE when it is not.
inh-valueset
The name of a valueset object whose values are the hierarchical dimension values to be
considered when creating grouping ids. Values not included in the valueset are
ignored. See "Inhier Valueset or Variable" on page 1-13 for more information.
Notes
Examples
GEOG.HIERDIM
------------------
Standard
Consolidated
GEOG.LEVELDIM
------------------
World
Continent
Country
City
Consolidated
Continent
Consolidated
Country
------------GEOG.LEVELREL------------
------------GEOG.HIERDIM-------------
GEOGRAPHY Standard Consolidated
------------------ ------------------ ------------------
World World NA
Americas Continent Consolidated
Continent
Canada Country Consolidated
Country
USA Country Consolidated
Country
Toronto City NA
Montreal City NA
Boston City NA
LosAngeles City NA
-------------GEOG.PARENT-------------
------------GEOG.HIERDIM-------------
GEOGRAPHY Standard Consolidated
------------------ ------------------ ------------------
World NA NA
Americas World NA
Canada Americas Americas
USA Americas Americas
Toronto Canada NA
Montreal Canada NA
Boston USA NA
LosAngeles USA NA
By issuing a REPORT statement, you can display the relational representations of both
the Standard and Consolidated hierarchies of the geography dimension.
REPORT DOWN geography geog.familyrel
GEOG.HIERDIM: Standard
-------------------------------GEOG.FAMILYREL--------------------------------
--------------------------------GEOG.LEVELDIM--------------------------------
Consolidated Consolidated
GEOGRAPHY World Continent Country City Continent Country
------------ ------------ ------------ ------------ ------------ ------------ ------------
World World NA NA NA NA NA
Americas World Americas NA NA NA NA
Canada World Americas Canada NA NA NA
USA World Americas USA NA NA NA
GEOG.HIERDIM: Consolidated
-------------------------------GEOG.FAMILYREL--------------------------------
--------------------------------GEOG.LEVELDIM--------------------------------
Consolidated Consolidated
GEOGRAPHY World Continent Country City Continent Country
------------ ------------ ------------ ------------ ------------ ------------ ------------
World NA NA NA NA NA NA
Americas NA NA NA NA Americas NA
Canada NA NA NA NA Americas Canada
USA NA NA NA NA Americas USA
Toronto NA NA NA NA NA NA
Montreal NA NA NA NA NA NA
Boston NA NA NA NA NA NA
LosAngeles NA NA NA NA NA NA
IF...THEN...ELSE command
Within an OLAP DML program, the IF...THEN...ELSE command executes one or more
statements in a program when a specified condition is met. Optionally, it also executes
an alternative statement or group of statements when the condition is not met.
Syntax
IF boolean-expression
THEN statement1
[ELSE statement2]
Arguments
boolean-expression
Any valid Boolean expression that returns either TRUE or FALSE.
THEN statement1
Oracle OLAP executes the statement1 argument when the Boolean expression is TRUE.
The statement1 must be on the same line as THEN.
ELSE statement2
Oracle OLAP executes the statement2 argument when the Boolean expression is
FALSE. The statement2 must be on the same line as ELSE. When you omit the
ELSE phrase, execution continues with the statement after the whole IF...THEN...
statement in the program.
Notes
IF with DO
You can use an IF statement for conditional execution of two or more statements by
following the THEN or ELSE (or both) keywords with a DO ... DOEND sequence. See
Example 10–5, "Using IF...THEN...ELSE" on page 10-11.
Examples
IMPORT
The IMPORT command transfers data to an analytic workspace from a text file, a
spreadsheet, or another analytic workspace from an EIF file.
Because the syntax of the IMPORT command is different depending on where the data
to be imported is located, separate topics are provided for different types of source
files:
■ IMPORT (EIF)
■ IMPORT (text)
■ IMPORT (spreadsheet)
IMPORT (EIF)
You can use the IMPORT (from EIF) command to copy data and definitions into your
Oracle OLAP analytic workspace from an EIF file. IMPORT also copies any
dimensions of the imported data that do not already exist in your workspace, even
when you do not specify them in the command.
Tip: A number of options determine how EIF files are imported and
exported. These options are listed in "EIF Options" on page 6-6.
IMPORT (from EIF) is commonly used in conjunction with EXPORT (EIF) to copy
parts of one Oracle OLAP analytic workspace to another; you export objects from the
source workspace to an EIF file and then import the objects from the EIF file into the
target workspace. The source and target workspaces can reside on the same platform
or on different platforms. When you transfer an EIF file between computers, you use a
binary transfer to overcome file-format incompatibilities between platforms. The EIF
file must have been created with the EIFVERSION set to a version that is less than or
equal to the version number of the target workspace. Use EVERSION to verify the
target version number.
You can also use IMPORT to store information in the EIFNAMES and EIFTYPES
options.
Syntax
IMPORT import_item FROM EIF FILE file-id [INTO workspace] -
[MATCH [STATUS]|APPEND|REPLACE [DELETE]] [LIST [ONLY]] [DATA] -
[DFNS] [UPDATE] [NOPROP] [NASKIP] [NLS_CHARSET charset-exp]
Arguments
name [AS newname]
The name of an analytic workspace object to be imported from an EIF file to an
attached workspace. You cannot specify a qualified object name for the object, because
the object is not yet in any workspace. You can list more than one name at a time. See
the INTO workspace argument for information about where the object will be imported.
AS newname can be used to rename any type of object being imported except
dimensions.
When you have exported a multidimensional object as separate variables, list all the
variable names. (See the SCATTER AS keyword in the EXPORT (EIF).)
ALL
(Default) Indicates that you want to import all the objects contained in the EIF file. See
the INTO workspace argument for information about where the objects will be
imported.
INTO workspace
an analytic workspace name that identifies the attached workspace into which objects
will be imported. When the objects exist in the specified workspace, then their data
will be overwritten by the imported data. When the objects do not already exist,
IMPORT creates them it in the specified workspace. IMPORT ignores identically
named objects when they exist in other attached workspaces.
When you do not specify this argument, then Oracle OLAP does the following:
■ When you have not previously defined the objects being imported in an attached
workspace, then IMPORT defines them automatically in the current workspace.
■ When the objects already exist in any attached workspace, then IMPORT
overwrites the data they contain with the imported data.
MATCH [STATUS]
Indicates that the IMPORT command should bring in only the data associated with
dimension values that match those already in the target workspace. For dimensions
other than time dimensions, be sure that corresponding dimension values are spelled
and capitalized identically in the EIF file and your target workspace when you want
them to match; for example, Tents does not match TENTS. For time dimensions,
Oracle OLAP identifies dimension values by the dates they represent rather than by
the way they are displayed. Therefore, time dimension values in the EIF file will
automatically match time dimension values in your workspace when they represent
the same time periods. When you specify MATCH STATUS, IMPORT only imports
data associated with the values included in the current status of that dimension. When
the dimension is limited in the target workspace, Oracle OLAP ignores any data in the
EIF file associated with the values excluded from the status.
APPEND
(Default) Indicates that the IMPORT command should bring in all the dimension
values, along with associated data, regardless of whether or not the dimension values
match those already present in the target workspace. APPEND adds those that do not
match to those already present; it adds new values to the end of the list of dimension
values. For time dimensions, APPEND also adds dimension values to fill in any gaps
between the dimension values in your target workspace and the new ones.
REPLACE [DELETE]
Indicates that, for objects already defined in the workspace, IMPORT should keep the
existing dimension values that match the dimension values in the EIF file. IMPORT
deletes dimension values (and their data) that do not match dimension values in the
EIF file. IMPORT replaces the associated data for the dimension values kept as part of
the new dimension when the associated data variables are included in the EIF file. For
text dimensions, the order of the dimension values in the EIF file is also adapted.
When you specify REPLACE DELETE, no matching takes place. Before importing a
dimension, Oracle OLAP performs a MAINTAIN DELETE ALL, which discards all
data associated with the existing dimension, as well as the dimension values.
LIST
LIST ONLY
Produces a list of the definitions. For dimensions, the output lists the number of values
in each dimension, as they are imported into the target workspace. For composites, the
output lists the number of dimension value combinations. IMPORT also indicates the
number of bytes read and the elapsed time every two minutes or, in any case, at the
end of the import procedure.
When you define a conjoint or composite that uses an index type other than the
default, the IMPORT LIST command displays the index type. When you use the
default index type (HASH for conjoints, BTREE for composites), that information is
not displayed.
EXPORT (EIF) sends the list to the current outfile. When you specify LIST ONLY, you
get only the listing without actually importing anything.
ONLY
Causes Oracle OLAP to place the correct values in the EIFNAMES and EIFTYPES
options without actually importing them. However, Oracle OLAP does not produce a
full listing of the object definitions. To produce the list, specify the LIST keyword
before the ONLY keyword.
DATA
Indicates that, for objects that already exist in the target workspace, IMPORT should
update only the data associated with those objects. For formulas that already exist,
IMPORT updates their EQ expressions. Objects that IMPORT creates in the target
workspace are created with their full definitions, as well as any associated data. You
can specify both DATA and DFNS, but when neither is specified, the default is DATA.
DFNS
Indicates that, for objects that already exist in the target workspace, IMPORT should
just update definitions and leave data unchanged. The components of the definition
affected by IMPORT DFNS are: LD Command, VNF, and PROPERTY. Objects that
IMPORT creates in the target workspace still get their data. You can specify both
DATA and DFNS, but when neither is specified, the default is DATA.
UPDATE
Indicates that IMPORT should execute an UPDATE statement after importing each
object. This can be useful when importing large EIF files that would otherwise cause
Oracle OLAP to run out of memory. To control the frequency of updates, use the
EIFUPDBYTES option.
NOPROP
Prevents any properties that you have assigned to each object from being read from
the EIF file.
NASKIP
Specifies that composite tuples (indexes) that contain only NA data should not be
imported into the target workspace. This argument has no effect on tuples that already
exist in the workspace.
NLS_CHARSET charset-exp
Specifies the character set that Oracle OLAP will use when importing text data from
the file specified by file-id. Normally, an EIF file contains its own specification of its
character set, so that this argument is not needed. However, when the EIF file specifies
the character set incorrectly or is missing the character set specification, then you must
use this argument to specify the character set correctly. For information about the
character sets that you can specify, see Oracle Database Globalization Support Guide.
This argument must be the last one specified. When this argument is omitted, and
Oracle OLAP is unable to determine the character set from the EIF file itself, then
Oracle OLAP imports the data using the database character set, which is recorded in
the NLS_LANG option.
Notes
Importing Relations
When you are importing a relation, IMPORT also brings in the definition and values
for the related dimension as well.
When you define a program, you may specify a data type or a dimension name, which
is used when the program is called as a function. When you specify a data type, it
determines the data type of the return value. When you specify a dimension name, the
return value is a single value of that dimension. When you import an existing
program, the data type or the dimension in the imported program definition and the
existing program definition must match. Otherwise, Oracle OLAP produces an error
message.
PERMIT Statements
The PERMIT statements associated with an object are imported with the object
definition. You can see them when you describe the object. However, permission
conditions are not evaluated when the object is imported.
When an object with the same name already exists in the target workspace and you
specify the DFNS keyword, the PERMIT statements for the object are updated.
However, you must execute a PERMITRESET to put the new permission into effect.
When an object with the same name already exists in the target workspace and you do
not specify the DFNS keyword, the PERMIT statements for the object are not updated.
When there is no pre-existing object in the target workspace, and you import with or
without the DFNS keyword, the PERMIT statements for the object are updated, but
you must execute a PERMITRESET to put the new permission into effect. (See the
PERMIT command.)
When you export and import an entire workspace, then update, detach, and reattach
the workspace, Oracle OLAP will ensure that all the permissions that were in effect
before exporting are in place in the target workspace.
For more information, see the entries for EIFBYTES, EIFNAMES, and EIFTYPES
options.
Examples
A DESCRIBE statement returns the following definitions for dimensions and variables
in the diffconcat.eif file.
DEFINE CITY TEXT DIMENSION
DEFINE REGION TEXT DIMENSION
DEFINE COUNTRY TEXT DIMENSION
DEFINE GEOG DIMENSION CONCAT (CITY, REGION, COUNTRY)
DEFINE SALES INTEGER VARIABLE <GEOG>
The following statement reports the sales data for the dimension values in the
analytic workspace from which you exported the concat dimension that is in the
diffconcat.eif file.
REPORT sales
The following statement imports the sales variable from the diffconcat.eif file
and implicitly imports the concat dimension geog. The APPEND keyword causes
Oracle OLAP to add the value Worcester to the city dimension. After that, it
imports new values for sales that correspond to <city: Boston>,
<city: Worcester>, and <country: Usa>.
IMPORT sales FROM EIF FILE diffconcat.eif APPEND
After the import operation, reporting the SALES values produces the following
results.
GEOG SALES
------------------- -----
<city: Boston> 1111
<city: Springfield> 2000
<city: Worcester> 2222
<state: Ma> 3000
<country: Usa> 4444
IMPORT (text)
You can use the IMPORT (from text) command to copy data from a text file into an
Oracle OLAP worksheet object. A worksheet's rows are similar to the lines of a text
file.
IMPORT is commonly used to copy text files into an analytic workspace from other
software products.
Normally, you should use a FILEREAD statement for text files instead of IMPORT.
FILEREAD is more efficient and does not require a worksheet object or separate
handling of each column of data.
Syntax
IMPORT worksheetname FROM [TEXT|STRUCTURED|RULED [RULER ruler-exp] -
PRN FILE file-id [STOPAFTER n] [TEXTSTART schar] [TEXTEND echar] -
[DELIMITER dchar] [NLS_CHARSET charset-exp]
Arguments
worksheetname
A text expression that specifies the name of an Oracle OLAP worksheet object. When
you have not previously defined worksheetname in your workspace, IMPORT will
define it for you automatically, using the default dimensions WKSCOL and WKSROW.
Any previous contents of worksheetname will be overwritten. In any one IMPORT
statement, you can import only one worksheetname from one text file.
FROM . . . PRN
Indicates that you want to import your Oracle OLAP worksheet from a text file.
TEXT
Imports a whole source file as-is into an Oracle OLAP worksheet on a line-by-line
basis. The source file is copied into a single wide worksheet column with a data type
of TEXT. The column is always column 1 of the worksheet. Each line in the source file
is imported into a separate cell on a separate row in the first column, using as many
rows as there are lines in the source file. A blank line in the source file produces a
TEXT value with zero characters (a null) in the corresponding row of the worksheet's
first column. (TEXT is the default.)
STRUCTURED
Imports a source file into a target worksheet on a cell-by-cell basis, automatically
performing three functions:
1. Each line of characters in the source file is copied into a single row of the target
worksheet.
2. Each group of characters on a line in the source file is copied into a separate TEXT
cell on the target worksheet row. A group of characters is defined by two
conditions: an uninterrupted (except by a decimal point) sequence of numbers, or
enclosure in double quotes. This means that numbers containing commas to mark
off thousands will be split up into different cells unless the commas are first
removed.
3. Any non-numeric characters not enclosed in double quotes are ignored, except
minus signs that immediately precede numbers and so are copied into the same
TEXT cell along with the numbers. (Be sure there are no spaces between a minus
sign and its number in the source file.)
A blank line in the source file results in an NA in the first cell of the corresponding
worksheet row.
When your file format does not conform to the pattern described here, you can use the
TEXTSTART, TEXTEND, and DELIMITER keywords. These arguments let you
customize the delimiters IMPORT uses to identify the start and end of each field.
RULED
Indicates import of a file on a column-by-column basis into worksheet cells of various
data types. Every line in the source file must follow the same pattern of data along its
length as every other line in the file. You describe this data pattern to Oracle OLAP in
the one-line ruler-exp using the RULER keyword. IMPORT loops over each line in the
source file and copies its contents into a corresponding pattern of cells on a row of the
target worksheet, one row for each line. As ruler-exp loops over successive lines in the
source file, it adds row after row to the target worksheet, building vertical columns of
similar cells as it goes along. Status messages are sent to the current outfile every 20
rows, starting with the message 20 rows processed.
When the source file contains records that follow several different patterns of character
groups, you will have to use the less exacting options, STRUCTURED or TEXT, to
import the data.
RULER ruler-exp
Used only with the RULED keyword to specify the data type, length, and repeat count
of each character group in the record pattern of the source file. Ruler-exp consists of a
list of character-group specifications. Each character-group specification must be
separated by a comma (,), by backslash N (\n), or by a space( ). You do not have to
include enough specifications to account for all the characters in the basic record
pattern (or line pattern) of the source file; RULER will step to the next record as soon
as it runs out of specifications on each line, regardless of how far it is from the end of
the current record. Remember to enclose literal text in single quotes.
The specifications for groups of characters are of three types: T for TEXT, A for
numeric (INTEGER or DECIMAL), and S for skip or ignore. The formats for these
types are shown in Table 10–1, " Character-Group Specifications for IMPORT from
Text" on page 10-23.
FILE file-id
Identifies the file you want to import. File-id is a text expression that represents the
name of the file. The name must be in a standard format for a file identifier.
STOPAFTER n
Specifies that no more than n records should be read from the file. When STOPAFTER
is omitted, Oracle OLAP will read the whole file.
TEXTSTART schar
The schar argument is a text expression that specifies a single character that you want
Oracle OLAP to interpret as the start of a text field in a structured file. The default
character is a double quote (").
TEXTEND echar
The echar argument is a text expression that specifies a single character that you want
Oracle OLAP to interpret as the end of a text field in a structured file. The default
character is a double quote (").
DELIMITER dchar
The dchar argument is a text expression that specifies a single character that you want
Oracle OLAP to interpret as the general field delimiter in a structured file. Oracle
OLAP uses the general field delimiter to identify both numeric and text fields. The
default character is a comma (,).
NLS_CHARSET charset-exp
Specifies the character set that Oracle OLAP will use when importing text data from
the file specified by file-id. This allows Oracle OLAP to convert the data accurately
from that character set. This argument must be the last one specified. When this
argument is omitted, and Oracle OLAP is unable to determine the character set from
the file itself, then Oracle OLAP imports the data in the database character set, which
is recorded in the NLS_LANG option.
Notes
Importing Numbers
When importing a number from a text file, IMPORT gives it an INTEGER data type.
Examples
The actual format for the file name must follow the conventions for your operating
system.
Character Content
1 - 10 To be ignored
11 - 17 Decimal number
18 - 28 To be ignored
29 - 30 Two single-character code
31 - 35 Integer
36 - 100 To be ignored
To import this file into an Oracle OLAP worksheet called sheet2, use the following
statement.
DEFINE sheet2 WORKSHEET temp
IMPORT sheet2 FROM RULED PRN FILE 'mix' RULER -
's10, a7, s11, 2t1, a5'
IMPORT (spreadsheet)
You can use the IMPORT (from spreadsheet) command to copy data (not formulas)
from a spreadsheet file into an Oracle OLAP worksheet object. A worksheet's
dimensions are similar to the columns and rows of a spreadsheet. IMPORT always
copies an entire spreadsheet file at a time.
IMPORT is commonly used to copy data from other software products (for example, a
Lotus spreadsheet) into an Oracle OLAP workspace.
Syntax
IMPORT worksheetname FROM source [INTO workspace]
where source is one of the following:
WKS FILE file-id [NLS_CHARSET charset-exp]
WK1 FILE file-id [NLS_CHARSET charset-exp]
WRK FILE file-id [NLS_CHARSET charset-exp]
WR1 FILE file-id [NLS_CHARSET charset-exp]
DIF FILE file-id [NLS_CHARSET charset-exp]
CSV FILE file-id [STOPAFTER n|DELIMITER dchar|NLS_CHARSET charset-exp]
Arguments
worksheetname
An Oracle OLAP worksheet object. In any one IMPORT statement, you can import
only one worksheetname from one spreadsheet file. You can specify a qualified object
name for the worksheet; however, when you specify the INTO worksheet argument, the
target workspace specified must be identical. See the INTO workspace argument for
information about where the worksheet object will be imported.
FROM WKS
FROM WK1
FROM WRK
FROM WR1
FROM DIF
Indicates that you want to import your Oracle OLAP worksheet from a 1-2-3 file,
Version 1 (WKS) or Version 2 (WK1); a Symphony file, Version 1.0 (WRK) or Version 1.1
(WR1); or a data interchange format file (DIF).
Oracle OLAP does not recognize numbers in E format (exponential notation) in DIF
files.
INTO workspace
an analytic workspace name that identifies the attached workspace into which data
will be imported. When worksheetname exists in the specified workspace, then its data
will be overwritten by the imported data. When worksheetname does not already exist,
IMPORT creates it in the specified workspace. IMPORT ignores an identically named
worksheet when it exists in another attached workspace.
When you do not specify this argument, then Oracle OLAP does the following:
■ When you have not previously defined worksheetname in an attached workspace,
IMPORT defines it automatically in the current workspace using the default
dimensions WKSCOL and WKSROW.
FILE file-id
Identifies the file you want to import. The file-id argument is a text expression that
represents the name of the file. The name must be in a standard format for a file
identifier.
NLS_CHARSET charset-exp
Specifies the character set that Oracle OLAP will use when importing text data from
the file specified by file-id. This allows Oracle OLAP to convert the data accurately
from that character set. This argument must be the last one specified. When this
argument is omitted, and Oracle OLAP is unable to determine the character set from
the worksheet itself, then Oracle OLAP imports the data in the database character set,
which is recorded in the NLS_LANG option.
Notes
CSV Import
The CSV import option automatically performs the following functions when
importing from a source file into the cells of a worksheet:
■ Each line of characters in the source file is copied into a single row in the target
worksheet.
■ Each group of characters on a line in the source file is copied into a separate TEXT
cell in the target worksheet row, and groups are separated by the delimiter
character.
When a group of characters is inside double quotation marks:
■ A delimiter character found in this group is treated as a literal.
■ When a double quotation mark occurs within this group, it must be followed by
another double quotation mark.
■ A linefeed (\n) found within the group is ignored.
■ Spaces or tabs found before a starting quotation mark and after an end quotation
mark are ignored.
Examples
INFILE
The INFILE command causes Oracle OLAP to read statement input from a specified
file.
Syntax
INFILE {file-id|EOF} [NOW] [NLS_CHARSET charset-exp]
Arguments
file-id
The name of a file from which to read input. File-id is a text expression that represents
the name of the file. The name must be in a standard format for a file identifier.
The input file must contain only OLAP DML statements, along with appropriate
responses to any prompts generated by the statements. Each statement or response
must appear on a separate line in the file.
EOF
Terminates the reading of input from the current file and causes Oracle OLAP to
resume reading input from the location from which the INFILE statement was
executed. Use of INFILE EOF is optional. See "About the Input File" on page 10-30 and
"INFILE with Both NOW and EOF" on page 10-31.
NOW
Indicates that Oracle OLAP should open the input file specified in the INFILE and
read its statements immediately upon encountering the INFILE instead of waiting
until the program containing the INFILE is finished. This has the effect of nesting the
input file's statements within the program. See "INFILE with Both NOW and EOF" on
page 10-31. This argument must be specified after file-id.
NLS_CHARSET charset-exp
Specifies the character set that Oracle OLAP will use when reading data from the file
specified by file-id. This allows Oracle OLAP to convert the data accurately into the
current character set, as identified by the NLS_LANG option. This argument must be
specified after file-id. When this argument is omitted, then Oracle OLAP handles the
data in the file as having the database character set, which is recorded in the NLS_
LANG option.
Notes
When you include an INFILE statement in a program with the NOW keyword, the
INFILE statement executes immediately. However, INFILE with the NOW keyword
requires more space than usual on the program stack. To conserve stack space, you
should use the NOW keyword only when it is necessary.
Examples
LD
The LD command adds the description to the current object definition. The description
consists of text that you specify to describe the object. You can assign a description to
any type of definition.
Tip: The current object definition is the definition of the object that
has been most recently defined or considered during the current
session. To make an object definition the current definition, use a
CONSIDER statement.
Syntax
LD [text]
Arguments
text
The text of the description you want to assign to the definition. When text is omitted,
any existing description for the current definition is deleted.
You can create a multiline description by using a hyphen as a continuation character.
However, you cannot create a description with an initial blank line with an LD
statement.
Examples
The statements
CONSIDER units
ld Actual Unit Shipments for Each Division
DESCRIBE units
LIMIT command
The LIMIT command sets the current status list of a dimension and its dimension
surrogates, or assigns values to a valuesets the current status list of a dimension and
its dimension surrogates, or assigns values to a valueset. You use LIMIT to restrict the
data values you are working on by temporarily limiting the range of the dimensions of
the data. Using LIMIT, you create a current status list for a dimension. The current
status list of a dimension is an ordered list of currently accessible values for the
dimension. Values that are in the current status list of a dimension are said to be "in
status." For more information on dimension status and its importance when working
with analytic workspace data, see "How to Specify the Set of Data that OLAP DML
Operations Work Against" on page 1-20.
Tip: You set the current status list of one or more base dimensions of
a composite, conjoint dimension, concat dimension, or a partition
template based on the selected values of that object, see the LIMIT
BASEDIMS command.
Syntax
LIMIT {dimension | valueset} [concat-component] limit-type [limit-clause] [IFNONE label]
where limit-type is one of the following keywords that specify how Oracle OLAP should
modify the current status list:
TO
ADD
INSERT [FIRST|LAST|BEFORE position|AFTER position]
KEEP
REMOVE
KEEP REORDER
COMPLEMENT
SORT [NAFIRST]
Arguments
dimension
The name of the dimension or dimension surrogate for which you are setting status.
valueset
The name of the valueset for which you are assigning values.
concat-component
Specifies the name of the component of the concat dimension whose values are used to
determine the limit. When you specify a value for concat-component, the limit sets the
status of the specified concat dimension using the values of dimension which is a
component of the concat dimension. This limit-clause applies only when dimension is a
concat dimension. The status of a concat dimension and of its component dimensions
are not shared. Changing the status of a component dimension after you have used
that dimension as the limit-clause in setting the status of a concat dimension does not
change the status of the concat dimension.
TO
Replaces the status of a dimension or valueset with the values specified by the
limit-clause arguments. The TO keyword selects values from the default status of a
dimension in the same order as they appear in the LIMIT statement or in the order
implied by the valuelist argument. When you use arguments that imply ordering, the
ordering of the values is based on their positions in the default status.
ADD
Expands the status of a dimension or valueset by adding the values specified by the
limit-clause arguments that are not already in status. The ADD keywords selects values
from the default status of a dimension in the same order as they appear in the LIMIT
statement or in the order implied by the valuelist argument. When you use arguments
that imply ordering, the ordering of the values is based on their positions in the
default status. ADD adds unique dimension values in the specified order at the end of
the current status list or valueset list.
INSERT
Expands the status of a dimension or valueset by inserting the values specified by the
limit-clause arguments in a specified position in the current status. The INSERT
keyword selects values from the default status of a dimension in the same order as
they appear in the LIMIT statement or in the order implied by the valuelist argument.
When you use arguments that imply ordering (for example,value1 TO value2), the
ordering of the values is based on their positions in the default status. INSERT adds
values to a specified position in the current status. When an added value is already in
status, it is removed from its position in the current status and added in the order in
which it appears in the valuelist, preserving the order of the added values.
FIRST
Inserts the new values before the first value in status.
LAST
Inserts new values after the last value in status.
BEFORE
AFTER
Specifies whether new values Oracle OLAP inserts new values before or after position
in the current status.
position
A dimension value in the current status, a character expression whose value is a
dimension value in the current status, or an INTEGER expression whose value
represents the position of a dimension value in the default status.
KEEP
Reduces the status of a dimension or valueset by keeping only the values specified by
the limit-clause arguments. Oracle OLAP performs the selection based on the current
dimension status. KEEP preserves the current order of values among the values that
remain in the status.
KEEP REORDER
Like a simple KEEP, KEEP REORDER reduces the status of a dimension or valueset by
keeping only the values specified by the limit-clause arguments. Oracle OLAP
performs the selection based on the current dimension status. However, KEEP
REORDER orders the result in the order of the selection arguments (that is, the
limit-clause arguments) rather than by the current status order.
REMOVE
Reduces the status of a dimension or a valueset by removing the values specified by
the limit-clause arguments. Oracle OLAP performs the selection based on the current
dimension status. KEEP preserves the current order of values among the values that
remain in the status.
COMPLEMENT
Replaces the status of a dimension or valueset with the values that are not specified by
the limit-clause arguments. When you do not specify any arguments after
COMPLEMENT, status is replaced by all values not now in status. Oracle OLAP
performs the selection based on the current dimension status. COMPLEMENT leaves
dimension values that remain in their default order. (Abbreviated COMP)
SORT
Sorts the values of a dimension or valueset according to the limit-clause arguments.
LIMIT creates a temporary list of values based on the limit-clause arguments, and uses
this list to sort the current status list. Any values not present in the temporary list are
moved to the end of the current status list.
NAFIRST
Specifies that NA values are placed first in the sort list rather than last.
limit-clause
Specifies the values to use for the limit. The syntax is quite complex and, consequently,
has been divided into the following topics:
LIMIT (using values) command
LIMIT using LEVELREL command
LIMIT (using related dimension) command
LIMIT command (using parent relation)
LIMIT NOCONVERT command
LIMIT command (using POSLIST)
IFNONE
(For use only within an OLAP DML program) Specifies that program execution should
branch to label when the requested status has null status or is based on a related
dimension that turns out to have null status (that is, to have no values). In either case,
the null status is not put into effect when program execution branches. Instead, the
original status, before the LIMIT statement was executed, is retained. This is true even
when OKNULLSTATUS is YES. Within an OLAP DML program, you cannot use both
IFNONE and NULL in the same statement.
label
The name of a label elsewhere in the program constructed following the "Guidelines
for Constructing a Label" on page 9-303. Execution of the program branches to the line
directly following the specified label.
Note that label, as specified in IFNONE, must not be followed by a colon. However, the
actual label elsewhere in the program must end with a colon.
Notes
Unique Values
LIMIT selects only unique values of a dimension. When a value appears more than
once in a LIMIT statement, it is placed in status in the order of its first appearance. For
example, the following lines.
LIMIT time TO 'Jan97', 'Feb97', 'Jan97'
STATUS time
Nonexistent Values
Oracle OLAP does not signal an error when you try to set the status of a dimension or
valueset that has no values, unless you explicitly list values that do not exist. For
example, assume that you have not added any values to a newly defined dimension
WEEK. In this case, the statement LIMIT week TO FIRST 10 does not cause an
error. However, LIMIT week TO 'Pete' causes an error because Pete is not a
value. Similarly, LIMIT week TO 20 causes an error because week does not have a
value at position 20.
Limiting a Conjoint
To limit a conjoint dimension to a value list, you can use the following constructions:
■ Specify the actual values, surrounding each combination with angle brackets
LIMIT proddist TO '<Tents, Boston>' -
'<Footwear, Denver>'
■ Use a variable name for the values, surrounding the combination with angle
brackets.
prodname = 'Canoes'
distname = 'Seattle'
LIMIT proddist To <prodname, distname>
■ Use the implicit relation between a conjoint dimension and its base dimension to
limit the conjoint dimension. For example, use the following statement to limit
PRODDIST to all conjoint values having "Canoes" as one of its base values.
LIMIT proddist TO product 'Canoes'
Note: You can use logical position numbers for base dimension
values in a conjoint dimension. "Using INSTAT When the Dimension
is a Conjoint Dimension" on page 7-209 illustrates using logical
position numbers
For an example of how you can limit a conjoint dimension that has a concat base
dimension, see Example 10–25, "Limiting a Conjoint Dimension with a Concat Base
Dimension" on page 10-50.
Limiting a Concat
You can define a concat dimension using simple dimensions, conjoint dimensions, and
other concat dimensions as the base dimensions of the concat. The syntax for limiting a
concat dimension to one of its values is the following.
LIMIT concatdim TO <base-dim: value>
For example, the concat dimension reg.dist.ccdim has the simple dimensions
region and district as its base dimensions. The following statement sets the status
of reg.dist.ccdim to two of its values, region: East and district: Atlanta.
LIMIT reg.dist.ccdim TO <region: 'East'> <district: 'Atlanta'>
For other methods of setting the status of a concat dimension, see Example 10–16,
"Limiting a Concat Dimension" on page 10-39.
Examples
This line removes values from the status for the month dimension.
LIMIT month REMOVE 'Jan96' TO 'Mar96'
The following statements set the status of the store_id dimension by limiting
storename, which is a TEXT dimension surrogate for store_id, and report the
values of store_id.
LIMIT storename TO 'Raoul\'s Sweets' TO 'Henry\'s Flowers'
REPORT store_id
10
20
30
■ The following statement limits the concat dimension directly to the values
specified by positions of the concat dimension.
LIMIT reg.dist.ccdim TO 1, 4, 5
■ The following statements set the status of district and then limit
reg.dist.ccdim to the status of district.
LIMIT district TO LAST 3
LIMIT reg.dist.ccdim TO district
■ In the following statement, the limit-clause argument is a list of values of the concat
dimension.
LIMIT reg.dist.ccdim TO <region: 'East'> <district:
'Boston'> <district: 'Atlanta'>
REG.DIST.CCDIM
----------------------
<region: East>
<district: Boston>
<district: Atlanta>
You can also limit a concat dimension using a valueset of one of its component
dimensions:
■ When the component dimensions contain identical values, you can limit the
concat dimension to those values by using a Boolean expression. When the
district and region dimensions both have New York as a value, then the
following statement limits the reg.dist.ccdim to those values.
LIMIT reg.dist.ccdim TO BASEVAL(reg.dist.ccdim) EQ 'New York'
■ In the following example, the concat dimension geog has the simple dimension
region and the conjoint dimension cityandstate as its base dimensions. The
following statement sets the status of the concat dimension by limiting the conjoint
base dimension.
LIMIT geog TO cityandstate <'Princeton' 'New Jersey'> -
<'Patterson' 'New Jersey'>
■ The following statements sets the status of the concat dimension by limiting the
conjoint base dimension by specifying a value of a base dimension of the conjoint
dimension.
LIMIT geog TO cityandstate city 'Princeton'
RPR W 30 geog
5 May96
6 Jun96
7 Jul96
8 Aug96
9 Sep96
10 Oct96
11 Nov96
12 Dec96
The following statement limits the month dimension to the values that are listed in the
first column of workitem.
LIMIT month TO CHARLIST(workitem)
You can run the program and specify that you want the first three products in the
report.
CALL product.rpt ('Missing' 8 'first 3')
The single quotation marks are necessary to indicate that "first 3" should be taken as a
single argument, rather than two separate arguments separated by a space. The
ampersand causes the LIMIT command to interpret 'first 3' as a keyword
expression rather than as a dimension value.
In the commands following the novals label, you can handle the special situation in
which no products have units sales greater than 500.
A LIMIT command with a using values limit clause assigns values to a valueset or sets
the current status list of a dimension or dimension surrogates to:
■ Specified value or values. The values can be any of the following:
■ Dimension values, expressed as literal values separated by commas, or as a
multiline text expression, each line of which is a value of the dimension.
■ Ranges of dimension values, expressed as value1 TO value2.
■ Integer values that represent the logical positions of dimension values,
expressed as comma-delimited INTEGER values.
■ Ranges of INTEGER values that represent the logical positions of dimension
values, expressed as value1 TO value2.
■ Valuesets.
■ Values for which a Boolean expression is TRUE.
■ The top or bottom performers of a dimension based on a criterion
■ The top or bottom performers of a dimension, by percentage, based on a criterion
represented as an expression
Syntax
LIMIT {dimension | valueset} [concat-component] limit-type -
{inclusive-val-args....| exclusive-val-args} [IFNONE label]
where:
■ inclusive-val-args is one or more of the following constructs:
intvaluelist
text-expression
value1 TO value2
valuelist
valueset
Arguments
dimension
The name of the dimension or dimension surrogate for which you are setting status.
valueset
The name of the valueset for which you are assigning values.
concat-component
The name of the component of the concat dimension whose values are used to
determine the limit. (See the main entry for LIMIT command for complete description
of this argument.)
limit-type
A keyword that specifies how Oracle OLAP should modify the current status list. (See
the main entry for LIMIT command for a list and descriptions of these keywords.)
intvaluelist
A list of one or more INTEGER values, or the name of a single-cell variable that holds a
numeric value. Separate the values with commas (,). Numeric values with decimal
places (SHORTDECIMAL or DECIMAL values) are automatically truncated to
INTEGER values before being used as dimension values. An INTEGER specifies a
dimension value by its logical position in the full set of dimension values. You cannot
specify a NUMBER dimension value by an INTEGER position. When the values of the
NUMBER dimension are INTEGER values, then you can set the status of the dimension
by specifying dimension values, as in intvalue1, intvalue2 and so on.
text-expression
A multiline text expression, each line of which is a value of dimension.
value1 TO value2
Specifies a range of dimension values where value1 and value2 can be either dimension
values or INTEGER values. Such a range can be increasing (for example, 1 to 10) or
decreasing (for example, 10 to 1). The status of the dimension or valueset is assigned
accordingly. You cannot specify the values of a NUMBER dimension by using INTEGER
positions. Instead, you can define an INTEGER dimension surrogate for the NUMBER
dimension and limit the dimension by the positions of the surrogate.
valuelist
A list of one or more values of dimension. A dimension value can be specified as a text
expression whose value is a valid dimension value. For a NUMBER dimension,
dimension values are numbers. For dimensions with a type of DAY, WEEK, MONTH,
QUARTER, or YEAR, dimension values can also be specified as DATE expressions.
valueset
An analytic workspace valueset object that is a saved list that holds the values for the
dimension whose status is being set. You cannot define a valueset for a dimension
surrogate, therefore you cannot specify a valueset when setting the status of a
dimension surrogate. However, when you limit a dimension with a valueset, then you
automatically limit to the same set any dimension surrogates of that dimension.
ALL
Specifies that all dimension values in the default status are to be included in the status.
The default status is made up of all dimension values for which read permission is
granted, in the same order as when the dimension was last maintained. When you
start up an analytic workspace, the status for each dimension in your analytic
workspace is the default status. Changing the read permission for a dimension with
PERMIT or PERMITRESET statement changes the default status for the dimension.
boolean-expression
An expression whose TRUE values are used by Oracle OLAP when limiting the
dimension or status. The boolean-expression must be dimensioned by the dimension
whose status is being set. For a dimension surrogate, the Boolean expression is
evaluated over the dimension for which it is a surrogate. The data types of the
expressions you are comparing in the Boolean expression must be similar. See the
CONVERT function for information on converting data types. To correctly use LIMIT
with a Boolean expression you need to understand how it works with a Boolean
expression that has with more than one dimension, see "How LIMIT Handles Boolean
Expressions With More Than One Dimension" on page 10-46 for details.
FIRST n
LAST n
Specifies the first n, last n values in the dimension's full set of values when used with
TO, ADD, COMPLEMENT, or INSERT. When used with KEEP or REMOVE, specifies
the first n, last n or nth values in the current status.
NTH {n |n TO n}
Specifies the n values in the dimension's full set of values when used with TO, ADD,
COMPLEMENT, or INSERT. When used with KEEP or REMOVE, specifies the n
values in the current status. You can specify any number of values or range of values.
LONGLIST
Indicates that there can be up to 2,000 arguments in the LIMIT statement. When there
are less than 300 arguments, LONGLIST is not needed.
SESSION
Specifies that Oracle OLAP use only those dimension members that were created
using a MAINTAIN ADD SESSION statement when performing the limit.
STATUS
Specifies that Oracle OLAP use the values that are presently in status when
performing the limit. Specifying this keyword is equivalent to (but more efficient than)
using a VALUES (dimname) statement.
NULL
Indicates an empty dimension or valueset list. Using this keyword with the TO or
KEEP arguments removes all values from the current status, leaving an empty
dimension or valueset list, even when OKNULLSTATUS is NO. You cannot use
IFNONE and NULL in the same LIMIT statement. ADD, INSERT, and REMOVE
NULL leave status unchanged. COMPLEMENT NULL places all values in status.
IFNONE label
Specifies that program execution should branch to label when the requested status has
null status or is based on a related dimension that turns out to have null status (that is,
to have no values). (See the main entry for LIMIT command for complete description
of this phrase.)
Notes
only need to supply the month and year (for example, Jun95 or 0695 for June
1995). For a YEAR dimension, you only need to specify the year (for example, 95
for 1995). The valid input styles for dates are discussed in DATEORDER.
When you specify a DATE expression or a text value that represents a complete
date, you can specify any date that falls within the time period that is represented
by the desired dimension value. Oracle OLAP uses the DATEORDER option to
resolve any ambiguities.
How LIMIT Handles Boolean Expressions With More Than One Dimension
In the following LIMIT statement, the sales variable is dimensioned by three
dimensions: product, district, and month.
LIMIT product TO sales GT 90000
The result of the previous LIMIT statement is evident when the district and
month dimensions are limited to a single value, as they are when you execute these
statements.
LIMIT month TO 'Jan95'
LIMIT district TO 'Boston'
STATUS product
In this case, the resulting status is all of the products whose sales exceed $90,000 for
the month of January 1995 in the Boston district, which is only Footwear.
Consider the following example in which the MONTH dimension is not limited to a
single value.
LIMIT product TO ALL
LIMIT month TO 'Jan95' 'Feb95' 'Mar95'
LIMIT district TO 'Boston'
When you execute a REPORT sales statement, you can see the BOSTON sales figures
for three months.
DISTRICT: BOSTON
-------------SALES--------------
-------------MONTH--------------
PRODUCT Jan95 Feb95 Mar95
-------------- ---------- ---------- ----------
Tents 32,153.52 32,536.30 43,062.75
Canoes 66,013.92 76,083.84 91,748.16
Racquets 52,420.86 56,837.88 58,838.04
Sportswear 53,194.70 58,913.40 62,797.80
Footwear 91,406.82 86,827.32 100,199.46
However, the following LIMIT and STATUS commands produce the output shown
following them. Again, only Footwear is in the status for month.
LIMIT product TO sales GT 90000
STATUS product
In this case, each product has three sales figures, one for each month. For each
product, LIMIT evaluates the sales data for only the first month in status. A product is
added to the status when its sales data exceeds $90,000 in that month.
When you would like all months evaluated for each product, you can use the EVERY,
ANY, or NONE functions. For example, the following LIMIT statement adds a product
to the status when any of its months has a sales figure that exceeds $90,000.
LIMIT product TO ANY(sales GT 90000, product)
This statement temporarily limits quarter to year, then limits month to quarter,
and finally, restores quarter to its original status.
Examples
Assume also as shown by the following reports that you have populated the
dimensions but not the variables. All of the elements of the costs and sales
variables appear in the report and all have the value of NA.
PRODUCTS
------------
TVs
Radios
Skis
Bikes
GEOG
------------
Boston
Springfield
New Orleans
Baton Rouge
Quebec City
Montreal
Toronto
Norfolk
-------------------SALES-------------------
-----------------PRODUCTS------------------
GEOG TVs Radios Skis Bikes
------------ ---------- ---------- ---------- ----------
Boston NA NA NA NA
Springfield NA NA NA NA
New Orleans NA NA NA NA
Baton Rouge NA NA NA NA
Quebec City NA NA NA NA
Montreal NA NA NA NA
Toronto NA NA NA NA
Norfolk NA NA NA NA
-------------------COSTS-------------------
-----------------PRODUCTS------------------
GEOG TVs Radios Skis Bikes
------------ ---------- ---------- ---------- ----------
Boston NA NA NA NA
Springfield NA NA NA NA
New Orleans NA NA NA NA
Baton Rouge NA NA NA NA
Quebec City NA NA NA NA
Montreal NA NA NA NA
Toronto NA NA NA NA
Norfolk NA NA NA NA
Now you issue the following LIMIT command so that only values indexed by Boston
and Springfield values of the geog dimension are accessible to Oracle OLAP.
LIMIT geog TO 'Boston' 'Springfield'
Now you issue new reports for geog, costs, and sales. For the geog dimension only
the Boston and Springfield elements values appear. Also, only the elements of the
costs and sales variables that are indexed by Boston and Springfield appear in the
report.
GEOG
------------
Boston
Springfield
-------------------SALES-------------------
-----------------PRODUCTS------------------
GEOG TVs Radios Skis Bikes
------------ ---------- ---------- ---------- ----------
Boston NA NA NA NA
Springfield NA NA NA NA
-------------------COSTS-------------------
-----------------PRODUCTS------------------
GEOG TVs Radios Skis Bikes
------------ ---------- ---------- ---------- ----------
Boston NA NA NA NA
Springfield NA NA NA NA
Now you issue two assignment statements that use the RANDOM function to
populate the costs and sales variables, followed by the LIMIT command that sets
the status of the geog dimension to its default status of ALL.
Now you issue new reports for geog, costs, and sales. All of the values of the geog
dimension and all of the elements of the costs and sales variables appear.
However, only the elements of the costs and sales variables that are indexed by
Boston and Springfield have non-NA values.
GEOG
------------
Boston
Springfield
New Orleans
Baton Rouge
Quebec City
Montreal
Toronto
Norfolk
-------------------SALES-------------------
-----------------PRODUCTS------------------
GEOG TVs Radios Skis Bikes
------------ ---------- ---------- ---------- ----------
Boston 199.97 133.82 10.07 148.17
Springfield 173.94 27.56 32.21 47.40
New Orleans NA NA NA NA
Baton Rouge NA NA NA NA
Quebec City NA NA NA NA
Montreal NA NA NA NA
Toronto NA NA NA NA
Norfolk NA NA NA NA
-------------------COSTS-------------------
-----------------PRODUCTS------------------
GEOG TVs Radios Skis Bikes
------------ ---------- ---------- ---------- ----------
Boston 43.52 25.32 68.68 10.38
Springfield 9.49 27.96 61.76 16.12
New Orleans NA NA NA NA
Baton Rouge NA NA NA NA
Quebec City NA NA NA NA
Montreal NA NA NA NA
Toronto NA NA NA NA
Norfolk NA NA NA NA
produces this output, which shows the results of the LIMIT commands.
PRODUCT: SPORTSWEAR
--SALES---
--MONTH---
DISTRICT Jul96
-------------- ----------
Dallas 220,416.81
Atlanta 211,666.14
There are two different ways that you can set the status of a conjoint dimension that
has a concat dimension as a base dimension:
■ By specifying the concat dimension, one of its component dimensions, and a value
of the component dimension. The following LIMIT statement sets the status of
prod.regdist in this manner.
LIMIT prod.regdist TO reg.proddist.ccdim district 'Atlanta'
RPR W 20 prod.regdist
■ You can also set the status of the conjoint by specifying its values. The following
LIMIT statement sets the status of prod.regdist in this manner.
LIMIT prod.regdist TO <'Tents' '<region: East>'> <'Tents' '<district: Boston>'>
RPR W 20 prod.regdist
A LIMIT command that uses only dimension values that are at the same level as the
current level of the hierarchical dimension or dimension surrogate when setting status
or assigning values to a valueset.
Syntax
LIMIT {dimension | valueset} [concat-component] limit-type-
LEVELREL level-relation-clause [IFNONE label]
where the syntax of level-relation-clause varies depending on the dimensionality of the
object you want to specify:
■ To specify a level relation which is multidimensional you must use the following
syntax:
RELATION level-relation-name [QUALIFY relation-dimension-name [inclusive-val-args...]...]
(You can also use this syntax when the level relation is one-dimensional.)
■ To specify a level relation which is one-dimensional, you can use the following
simplified syntax:
level-relation-name [valueset2]
Arguments
dimension
The name of the dimension or dimension surrogate for which you are setting status.
valueset
The name of the valueset for which you are assigning values.
concat-component
The name of the component of the concat dimension whose values are used to
determine the limit. (See the main entry for LIMIT command for complete description
of this argument.)
limit-type
A keyword that specifies how Oracle OLAP should modify the current status list. (See
the main entry for LIMIT command for a list and descriptions of these keywords.)
LEVELREL
Sets the status of a hierarchical dimension to all of the values of the hierarchical
dimension that are at the same level as the current value of the dimension; or, that
limits a hierarchical dimension to those values of the hierarchical dimension that are at
the same level as the current value of the dimension and that are also in a specified
valueset.
RELATION
Specifies that Oracle OLAP performs the limit based on the values of the relation
specified by level-relation-name. This keyword must be specified if level-relation-name is
a multidimensional relation.
level-relation-name
Specifies the name of a level relation for the hierarchical dimension you want to limit.
See "Levelrel Relation" on page 1-15 for more information.
valueset2
Specifies the name of a valueset object is dimensioned by the level dimension for the
hierarchical dimension that you want to limit. Assume that there are the objects
described in the description of the level-relation parameter. Additionally, assume that
you have defined a valueset named bestsalesyear that is dimensioned by
tlevels and, for each value, contains only the values of time that pertain to the year
with the best sales year (for example, 1998). In this case, for Month, bestsalesyear
would have a list of all of the months in 1998 (that is, Jan98 through Dec98 and for
Year would have only one value (1998).
IFNONE label
Specifies that program execution should branch to label when the requested status has
null status or is based on a related dimension that turns out to have null status (that is,
to have no values). (See the main entry for LIMIT command for complete description
of this phrase.)
Examples
A LIMIT command with a related-dimension limit clause that uses the values of a
different related dimension to assign values to a valueset or to set the status of a
dimension or a dimension surrogate.
Syntax
LIMIT {dimension | valueset} limit-type related-dim-clause [IFNONE label]
where the syntax of related-dim-clause varies depending on the type of object being
specified:
■ When you want to specify a relation, the syntax is:
RELATION relation-name [QUALIFY relation-dimension-name [inclusive-val-args...]...]
■ When you want to specify a dimension that is related to the dimension being
limited, the syntax is:
related-dimension-name [related-dimension-valuelist]
(You can also use this simplified syntax when the object is a a one-dimensional
relation.)
Arguments
dimension
The name of the dimension or dimension surrogate for which you are setting status.
valueset
The name of the valueset for which you are assigning values.
concat-component
The name of the component of the concat dimension whose values are used to
determine the limit. (See the main entry for LIMIT command for complete description
of this argument.)
limit-type
A keyword that specifies how Oracle OLAP should modify the current status list. (See
the main entry for LIMIT command for a list and descriptions of these keywords.)
RELATION relation-name
Specifies that Oracle OLAP performs the limit based on the values of the relation
specified by relation-name. This keyword must be specified if relation-name is a
multidimensional relation. Also, when there is more than one relation between the
dimension being limited and the dimension specified by related-dimension-name, you
can use this phrase to identify which relation Oracle OLAP uses to perform the limit.
When you omit this argument, Oracle OLAP uses the current status of the
dimension when performing the limit.
related-dimension-name
Specifies the name of a one-dimensional relation or a dimension that is related to the
dimension being limited. For related-dimension-name, you can also specify a dimension
surrogate for the dimension you are limiting, or a dimension surrogate of the related
dimension. For example, dimsurr is a dimension surrogate of dim2 and dim2 is
related to dim1. The dimension surrogate dimsurr has the values Dsv1, Dsv2, Dsv3
and Dsv4. The following statement limits dim1 by specifying values of dimsurr.
LIMIT dim1 TO dimsurr dsv1 dsv3
related-dimension-valuelist
The values of the related dimension or a dimension surrogate for the related
dimension or the dimension specified using the syntax shown in LIMIT command. See
LIMIT (using values) command for detailed syntax. When this argument is present in
a LIMIT statement, status is obtained by selecting the values of the dimension being
limited, which are related to the related-dimension values. When valuelist is omitted, the
current status of related-dimension is used.
IFNONE label
Specifies that program execution should branch to label when the requested status has
null status or is based on a related dimension that turns out to have null status (that is,
to have no values). (See the main entry for LIMIT command for complete description
of this phrase.)
Notes
Examples
This statement limits product to Sportswear and Footwear, which are in the
division that appears last in the list of division values.
LIMIT product TO division LAST 1
A LIMIT command that uses a parent relation in its limit clause to set the status of a
hierarchical dimension or its dimension surrogate, or assigns values to a valueset,
based on family relationships within the hierarchy.
Syntax
LIMIT {dimension | valueset} [concat-component] limit-type-
[family-keyword] USING parent-relation-clause [IFNONE label]
where:
■ family-keyword has one of the following constructs:
PARENTS
CHILDREN
ANCESTORS
DESCENDANTS
SIBLINGS
TOPANCESTORS
BOTTOMDESCENDANTS
HIERARCHY [INVERTED] [NOORIGIN] [SKIP n] [DEPTH n] [RUN textexp]]
Arguments
dimension
The name of the dimension or dimension surrogate for which you are setting status.
valueset
The name of the valueset for which you are assigning values.
concat-component
The name of the component of the concat dimension whose values are used to
determine the limit. (See the main entry for LIMIT command for complete description
of this argument.)
limit-type
A keyword that specifies how Oracle OLAP should modify the current status list. (See
the main entry for LIMIT command for a list and descriptions of these keywords.)
PARENTS
Finds the parent of each value in valuelist. For a dimension, when there is no valuelist,
finds the parent for each value in status. For a valueset, when there is no valuelist, it
finds the parent of each value in the valueset. It uses the parent-relation to look up the
parent.
CHILDREN
Finds the children of each value in valuelist. For a dimension, when there is no
valuelist, finds the children for each value in status. For a valueset, when there is no
valuelist, it finds the children of each value in the valueset. It uses the parent-relation to
look up the children.
ANCESTORS
Finds the ancestors (that is, parents, grandparents, and so on) of each value in valuelist.
For a dimension, when there is no valuelist, it finds the ancestors of each value in
status. For a valueset, when there is no valuelist, it finds the ancestors of each value in
the valueset. In other words it finds "parents" for the values and the "parents of the
parents" until there are no new parents.
DESCENDANTS
Finds the descendants (that is, children, grandchildren, and so on) of each value in
valuelist. For a dimension, when there is no valuelist, it finds descendants for each
value in status. For a valueset, when there is no valuelist, it finds the descendants of
each value in the valueset. In other words, it finds the children of the values and the
children of the children until there are no new children.
SIBLINGS
Finds all siblings of each value in valuelist, including the valuelist values, themselves.
Issuing one LIMIT statement with the SIBLIGS keyword is the same as issuing two
consecutive LIMIT statements: 1) LIMIT with PARENTS, 2) LIMIT with CHILDREN.
For a dimension, when there is no valuelist, it finds siblings for each value in status.
For a valueset, when there is no valuelist, it finds the siblings of each value in the
valueset.
TOPANCESTORS
(Abbreviated TOPANC) Finds those members that are at the top of the hierarchy; that
is, those members that do not have any ancestors. This is equivalent to issuing the
following two LIMIT commands.
LIMIT dimension to ANCESTORS ....
LIMIT dimension REMOVE DESCENDANTS....
BOTTOMDESCENDANTS
(Abbreviated BOTTOMDESC) Finds those members that are at the bottom of the
hierarchy; that is, those members that do not have any descendants.
HIERARCHY
Finds the descendants (that is, children, grandchildren, and so on) based on a
particular parent-relation. The difference is the order of the values. DESCENDANTS
groups the values by level (all children, then all grandchildren, and so on);
HIERARCHY places each group of children next to its parent. HIERARCHY includes
the original values (that is, those in status before the LIMIT statement was executed) in
status.
INVERTED
Indicates that children should be listed before their parents. By default, children are
listed after their parents.
NOORIGIN
Excludes the original values from the status. The default is to include original values.
SKIP
Skips n generations for each value in valuelist. For dimensions, when there is no
valuelist, it skips n generations for each value in status. For a valueset, when there is no
valuelist, it skips n generations for each value in the valueset. This keyword, in
combination with DEPTH, is helpful when drilling down; see Example 10–29, "Drilling
Down Using SKIP and DEPT".
DEPTH
Includes n generations down from each value of valuelist. For dimensions, when there
is no valuelist, it includes n generations for each value in status. For a valueset, when
there is no valuelist, it includes n generations of each value in the valueset. The default
depth value is 99. This keyword, in combination with SKIP, is helpful when drilling
down on values.
RUN
Executes a statement, represented as a text expression, every time a group of children
is constructed. For example, you can sort each group of children based on information
stored in an Oracle OLAP variable. In the following statement, markets will be sorted
in increasing order based on unit sales every time a group of children is constructed.
LIMIT market TO HIERARCHY RUN 'SORT market a unit.m' USING -
market.market
USING
Specifies the values to use when determining parent values.
parentrel
Specifies the name of the parent relation for the dimension. See "Parentrel Relation" on
page 1-11 for more information. To limit a dimension surrogate, use the parent relation
for the dimension for which it is a surrogate.
RELATION
Identifies the beginning of the parent-relation-clause. This keyword must be specified if
parentrel is a multidimensional relation.
QUALIFY relation-dimension-name
Specifies the name of one of the dimensions of parentrel.
inclusive-val-args
Specifies the values to use when determining the parent values. You can specify any
inclusive valuelist argument as described in the syntax of the inclusive-val-args
argument for the valuelist clause for LIMIT command. See LIMIT (using values)
command for detailed syntax.
IFNONE label
Specifies that program execution should branch to label when the requested status has
null status or is based on a related dimension that turns out to have null status (that is,
to have no values). (See the main entry for LIMIT command for complete description
of this phrase.)
Examples
The following LIMIT statement limits the values of MARKET, and the STATUS
statement produces the values currently in status. The output of STATUS is shown
following the statements.
LIMIT market TO mlv.market 'Region'
STATUS market
To drill down on the district level data from the region level, you can use LIMIT with
the CHILDREN keyword. The following example uses a parent-relation called
market.market to perform the drill down. For each value of the market dimension,
this relation contains the name of its parent.
DEFINE market.market RELATION market <market>
LD Self-relation for the Market Dimension
You can limit market to the children of the East, Central, and West regions by
using the CHILDREN keyword with LIMIT.
Oracle OLAP will look in the child-parent relation (market.market) to find the
children and the grandchildren (DEPTH 2) of Totus and it will discard the first
generation (SKIP 1). The resulting status follows.
Totus
Boston
Atlanta
Chicago
Dallas
Denver
Seattle
Note that Totus is included in status. With HIERARCHY, the original values are
included in status.
The LIMIT command sets the current status list of a dimension and its dimension
surrogates, or assigns values to a valueset.
A LIMIT command with the NOCONVERT keyword sets the status of one dimension
based on the numeric position of values in a different dimension.
Syntax
LIMIT{dimension | valueset} [concat-component] limit-type -
NOCONVERT [{unrelated-dimension|numeric-valueset}] -
[IFNONE label]
Arguments
dimension
The name of the dimension or dimension surrogate for which you are setting status.
valueset
The name of the valueset for which you are assigning values.
concat-component
The name of the component of the concat dimension whose values are used to
determine the limit. (See the main entry for LIMIT command for complete description
of this argument.)
limit-type
A keyword that specifies how Oracle OLAP should modify the current status list. (See
the main entry for LIMIT command for a list and descriptions of these keywords.)
NOCONVERT
Sets the status of a dimension based on the numeric position of the specified values in
the status list of an another dimension.
unrelated-dimension
Specifies the name of a dimension not related to the dimension being limited. Using
this argument specifies that the status of a dimension or valueset is set based on the
numeric position of each value in status of the unrelated-dimension. This is
particularly useful when the two dimensions are in different analytic workspaces (for
example, when a one-to-one correspondence exists between the product dimension in
two analytic workspaces)
numeric-valueset
Specifies the a numeric valueset. When you use this argument, NOCONVERT sets the
status based on the numeric values in the valueset. The numeric values represent the
positions of the values in the default status of the dimension.
IFNONE label
(For use only within an OLAP DML program) Specifies that program execution should
branch to label when the requested status has null status or is based on a related
dimension that turns out to have null status (that is, to have no values). (See the main
entry for LIMIT command for complete description of this phrase.)
The LIMIT command sets the current status list of a dimension and its dimension
surrogates, or assigns values to a valueset.
A LIMIT command with the POSLIST keyword sets the status of a dimension based on
the position of the values within that dimension.
Syntax
LIMIT {dimension | valueset} [concat-component] limit-type -
POSLIST poslist-exp [IFNONE label]
Arguments
dimension
The name of the dimension or dimension surrogate for which you are setting status.
valueset
The name of the valueset for which you are assigning values.
concat-component
The name of the component of the concat dimension whose values are used to
determine the limit. (See the main entry for LIMIT command for complete description
of this argument.)
limit-type
One of the standard keywords (documented in the main entry for LIMIT command)
that specifies how Oracle OLAP should modify the current status list.
POSLIST poslist-textexp
Sets the status of a dimension based on the position of a value within a dimension.
poslist-textexp is a text expression, each line of which is a numeric value that evaluates
to a numeric position of the dimension being limited.
IFNONE label
Specifies that program execution should branch to label when the requested status has
null status or is based on a related dimension that turns out to have null status (that is,
to have no values). (See the main entry for LIMIT command for complete description
of this phrase.)
LIMIT BASEDIMS
The LIMIT BASEDIMS command sets the current status list of one or more base
dimensions of a composite, conjoint dimension, concat dimension, or a partition
template based on the selected values of that object. You can also use the LIMIT
BASEDIMS command to assign a value to one or more valuesets for the base
dimensions.
Values that are in the current status list of a dimension are said to be "in status." The
status of the base dimensions of a composite, conjoint dimension, concat dimension, or
a partition template is determined by the current status of its base dimensions.
Syntax
LIMIT BASEDIMS [dimlist] TO object [ [KEEP] limit-clause ]
Arguments
dimlist
A space-delimited list of objects that identifies the base dimensions for which you
want Oracle OLAP to change status and the valuesets for which you want Oracle
OLAP to add values. Within dimlist, you can specify the following values:
base-dimension-name
The name of a base dimension of object.
relation-name
The name of a relation. When you specify a relation, Oracle OLAP sets the status
of the related dimension.
valueset-name
The name of a valueset for a base dimension. When you specify the name of a
valueset, Oracle OLAP assigns a single value to the specified valueset.
The default value of dimlist is the completely expanded list of the base dimensions of
object.
object
The name of a composite, a conjoint dimension, a concat dimension, or a partition
template object.
KEEP
Specifies that Oracle OLAP performs the selection based on the current dimension
status of the base dimensions of the object. KEEP preserves the current order of values
among the values that remain in the status.
limit-clause
Specifies how Oracle OLAP should select values from object to modify the current
status lists of the base dimensions.
The syntax of limit-clause is the same syntax as any of the non-positional limit-clause
arguments in the various forms of the LIMIT command (that is, the syntax of the
LIMIT command after the limit-type argument such as "TO"). For the syntax of these
arguments, see LIMIT (using values) command, LIMIT using LEVELREL command,
LIMIT command (using parent relation), LIMIT (using related dimension) command,
LIMIT NOCONVERT command, and LIMIT command (using POSLIST).
When this optional argument is not specified, Oracle OLAP sets the status of the base
dimensions to the current status of the dimensions.
LISTBY
The LISTBY program produces a report of the names of all objects in an analytic
workspace that are dimensioned by or related to one or more specified dimensions or
composites. You can use LISTBY with a dimension or composite in any attached
workspace.
Syntax
LISTBY dimensions
Arguments
dimensions
A list of one or more dimensions or composites, separated by spaces. When you list
more than one dimension, all the dimensions must be in the same workspace. LISTBY
returns a list of objects that are dimensioned by all the dimensions you specify. When
you specify an unnamed composite, use the following format:
LISTBY SPARSE dim1 dim2 ...
Notes
Examples
LISTFILES
The LISTFILES command lists all the open files that can be referenced by the
FILEQUERY function. This includes all files opened by FILEOPEN, OUTFILE, and
LOG command.
Syntax
LISTFILES
Examples
LISTNAMES
The LISTNAMES program produces a report that lists the names of the objects in an
analytic workspace. You can limit the list to particular types of objects, and you can
have the names for each type of object listed in alphabetical order.
Syntax
LISTNAMES [AW workspace|'*'] [objtype-list|ALL] -
[SORTED|UNSORTED] [LIKE 'pattern']
Arguments
AW workspace
AW '*'
Specifies the name of an attached workspace whose objects you want to list. When you
omit the workspace name, LISTNAMES lists the objects in the current workspace.
When you use the '*' (asterisk) argument instead of an analytic workspace name,
LISTNAMES produces a separate report for each attached workspace.
objtype-list
ALL
Specifies one or more of the following types of objects whose names you want to list:
AGGMAP, COMPOSITE, DIMENSION, FORMULA, MODEL, OPTION, PROGRAM,
RELATION, VALUESET, VARIABLE, and WORKSHEET. You can include a trailing
"S" on any object type, for example, DIMENSIONS. You can list these object types in
any order. ALL (the default) specifies that the names of objects of all these types
should be listed.
SORTED
UNSORTED
SORTED (the default, abbreviated SORT) specifies that the object names should be
sorted alphabetically. UNSORTED (abbreviated UNSORT) specifies that the object
names should not be sorted alphabetically.
LIKE 'pattern'
Compares the names of the definitions in an analytic workspace to the text pattern you
specify and lists the names that match. A definition name is like a text pattern when
corresponding characters match. Besides literal matching, LIKE lets you use wildcard
characters to match more than one character in a string. An underscore (_) character in
a pattern matches any single character. A percent (%) character in a pattern matches
zero or more characters.
Notes
NAME Dimension
NAME is a special dimension that is used by Oracle OLAP to organize the list of
objects in an analytic workspace. Its values are the names of the objects defined in the
current workspace. (
You cannot explicitly change the values of the NAME dimension. Instead the values
are changed as DEFINE, DELETE, MOVE, or RENAME statements execute. Also, you
cannot use a qualified object name to specify the NAME dimension of an analytic
workspace that is not the current workspace.
Examples
MONTH FCST
PRODUCT INDUSTRY.SALES
QUARTER NAME.LINE
REGION NAME.PRODUCT
YEAR NATIONAL.SALES
PRICE
PRODUCT.MEMO
SALES
SALES.FORECAST
SALES.PLAN
SHARE
UNITS
UNITS.M
LOAD
The LOAD command loads the definition of a program, formula, or model into
memory. It is usually used in startup programs, to save time when a program is first
used in a session.
Syntax
LOAD object. . .
Arguments
object. . .
The name of a program, formula, or model.
Notes
Examples
LOG command
The LOG command starts or stops the recording of a session to a disk file. All lines of
input and output are recorded.
Note: Do not confuse the LOG command with the function of the
same name which is a mathematical function.
Syntax
LOG EOF | TRACEFILE | SAVE | {[APPEND] file-name}
Arguments
EOF
Stops recording of the session and closes any opened log record file.
TRACEFILE
Specifies that the session information should be directed the Oracle trace file, which is
identified by the TRACEFILEUNIT option.
SAVE
Forces Oracle OLAP to update the log file. Lines of input and output are not always
written to disk as they are generated. Instead, the lines are stored temporarily then
written to disk periodically. LOG SAVE effectively issues the LOG EOF and
LOG APPEND file-name commands. This ensures that all appropriate lines are
written to disk by closing the log file and reopening it. Additional lines of input and
output are appended to the file.
APPEND
Specifies that the record of your session should be added to the end of an existing disk
file. When you omit this argument, the new output replaces the current contents of the
file.
file-name
A text expression that is the name of the file to which session information should be
written. Unless the file is in the current directory, you must include the name of the
directory object in the name of the file.
Note: Directory objects are defined in the database, and they control
access to directories and file in those directories. You can use a CDA
statement to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
Notes
Examples
MAINTAIN
Syntax
MAINTAIN object {ADD|DELETE|RENAME|MOVE|MERGE} args
The keywords that you can use with the MAINTAIN command varies by object:
■ MAINTAIN dimension {ADD|DELETE|RENAME|MOVE|MERGE} args
The keyword that you can use varies by the type of dimension that you want to
maintain:
■ With a non-concat dimension, you can use the ADD, DELETE, RENAME,
MOVE, or MERGE keywords to add, delete, rename, move, or merge
non-concat dimension values. You can also use the ADD keyword to add
temporary calculated members to a dimension.
■ With a concat dimension, you can only use the MOVE keyword to move
concat dimension values.
■ MAINTAIN composite {ADD|DELETE|MERGE} args
■ MAINTAIN partition-template {ADD|DELETE|MOVE} args
The specific syntax varies by keyword. Consequently, there are separate topics for
each keyword of the MAINTAIN command:
MAINTAIN ADD
MAINTAIN DELETE
MAINTAIN MERGE
MAINTAIN MOVE
MAINTAIN RENAME
For information that applies to the MAINTAIN command in general, see the Notes in
this topic.
Notes
Maintain Permission
You cannot perform maintenance on a dimension when a PERMIT MAINTAIN
statement denies maintain permission for the dimension. Maintain permission is
implicitly denied whenever read permission is restricted for a dimension, even when
you specify maintain permission for the dimension. (See the PERMIT command.)
MAINTAIN ADD
The MAINTAIN command with the ADD keyword adds new TEXT, ID, and
INTEGER values to a non-concat dimension, composite, or partition; or adds a new
temporary calculated member to a dimension.
Note: You can also issue a MAINTAIN ADD for TEXT, ID, and
INTEGER Values statement for a surrogate dimension that has a
Maintain trigger. In this case, Oracle OALP only executes the Maintain
trigger program one time for each value; no other action occurs. See
"Trigger Programs" on page 4-16 for more information for more
information. Issuing a MAINTAIN statement for a surrogate
dimension that does not have a Maintain trigger, returns an error.
Syntax
The syntax for using the MAINTAIN command with the ADD keyword depends on
the type of the object being maintained and whether you are adding a permanent or
temporary member.
For this reason, the following separate entries are provided for MAINTAIN ADD:
■ MAINTAIN ADD for TEXT, ID, and INTEGER Values
■ MAINTAIN ADD for DAY, WEEK, MONTH, QUARTER, and YEAR Values
■ MAINTAIN ADD SESSION
■ MAINTAIN ADD TO PARTITION
Note: You can also issue this MAINTAIN ADD statement for a
surrogate dimension that has a Maintain trigger. In this case, Oracle
OALP only executes the Maintain trigger program one time for each
value in valuelist; no other action occurs. See "Trigger Programs" on
page 4-16 for more information for more information. Issuing a
MAINTAIN statement for a surrogate dimension that does not have a
Maintain trigger, returns an error.
Syntax
MAINTAIN composite|dimension ADD valuelist [FIRST|LAST|BEFORE position|AFTER position]
Arguments
dimension
A non-concat dimension, already defined in an attached analytic workspace.
composite
A composite. When the composite is a named composite, it must be defined in an
attached analytic workspace. When the composite is unnamed, it must have been used
ADD valuelist
Specifies that the values in valuelist are to be added to the dimension or composite:
■ When you use this argument to add values to a composite or a dimension of type
TEXT or ID, the valuelist can be text literals or a TEXT or ID expression. When it is
a multiline text expression, each element (line) is treated as a separate value.Do
not add null dimension values (empty single quotes) or values that consists of
spaces only, because there is no way you can refer to such values in the future.
■ When dimension is INTEGER, valuelist can be an INTEGER quantity, such as 5 or
100.
FIRST
LAST
Specify the logical position at which dimension values will be added. FIRST indicates
that the new values will be inserted before any existing values. LAST indicates that
new values will be added at the end of the current values. LAST is the default. When
you are adding a certain quantity of INTEGER values to an INTEGER dimension, that
quantity of INTEGER values will be added before or at the end of any existing
INTEGER values (depending on your specification), and all the INTEGER values in the
resulting series will be automatically adjusted into simple numerical order.
All values specified before the keyword FIRST or LAST are placed in that position, not
just the one value immediately preceding the keyword in your statement.
BEFORE position
AFTER position
Specify a position before or after which the dimension values are to be added. For
position you can specify an existing dimension value, a character expression whose
value is an existing dimension value, or an INTEGER expression whose value
represents the position of a dimension value. When you are adding a certain quantity
of INTEGER values to an INTEGER dimension, that quantity of INTEGER values will
be added before or after the INTEGER position you specify, and the INTEGER values in
the whole of the resulting series will be automatically adjusted into simple numerical
order.
All values specified before the keywords BEFORE or AFTER are placed in that
position, not just the one value immediately preceding the keyword in your statement.
Notes
does not exist, Oracle OLAP will automatically add the value to the appropriate
composite.
Examples
This statement adds Atlanta at the beginning of the list of cities and inserts Peoria
after Omaha.
MAINTAIN city ADD 'Atlanta' FIRST, 'Peoria' AFTER 'Omaha'
Here the value of the TEXT variable textvar is inserted before the fifth dimension
value of city. When you assign the value Columbus to textvar, you must make
sure it is in mixed case, because you want the dimension value to be in mixed case.
textvar = 'Columbus'
MAINTAIN city ADD textvar BEFORE 5
You can also assign a value of a base dimension to a text variable and use the name of
the variable inside the angle brackets.
prodname = 'Canoes'
distname = 'Seattle'
MAINTAIN proddist ADD <prodname, distname>
MAINTAIN ADD for DAY, WEEK, MONTH, QUARTER, and YEAR Values
The MAINTAIN command with the ADD keyword adds new values to a dimension of
type DAY, WEEK, MONTH, QUARTER, and YEAR.
Syntax
MAINTAIN dimension ADD {valuelist|{n PERIODS FIRST}|{n PERIODS LAST}}
Arguments
dimension
A non-concat dimension, already defined in an attached analytic workspace.
ADD valuelist
Specifies that the values in valuelist are to be added to the dimension. When dimension
is of type DAY, WEEK, MONTH, QUARTER, or YEAR, then valuelist can be text
constants or a TEXT, ID, or DATE expression. When the values are TEXT, they can be
in the format specified by the VNF (value name format) for the dimension (or in the
default format for the type of dimension you are maintaining when the dimension
does not have a VNF) or in a valid input style for date values. When the values are
specified as a TEXT expression, each element or line is treated as a separate value.
When the values are in the format specified by the VNF or in the default format for
this type of dimension, each value explicitly indicates the time period you want to
add. For example, assume that the VNF for a month dimension is '<MTXT><YY>'. In
this case, the value JAN99 represents the month January 1999.
When you specify a value for a DAY, WEEK, MONTH, QUARTER, or YEAR
dimension as a date, you must provide only the date components that are relevant for
the type of dimension you are maintaining. For a DAY or WEEK dimension, you must
supply the day, month, and year components. For a MONTH or QUARTER
dimension, you must supply only the month and year (for example, 'JUN98' or
'0698' for June 1998). For a YEAR dimension, you must specify only the year (for
example, '98' for 1998). For information about the valid input styles for dates, see the
DATEORDER option.
When you add a dimension value by specifying a DATE expression or a TEXT value
that represents a complete date, you can specify any date that falls within the time
period you want to add. For example, to add the month January 1999, you can specify
any date from '01JAN99' through '31JAN99'. Oracle OLAP uses the DATEORDER
option to resolve any ambiguities.
When adding values to a DAY, WEEK, MONTH, QUARTER, or YEAR dimension that
does not yet have values, you must specify only the first and last values you want to
add for the dimension. Oracle OLAP automatically fills in the gaps with appropriate
values for the intervening time periods.
When a DAY, WEEK, MONTH, QUARTER, or YEAR dimension already has values,
you can add values only at the beginning or the end of the existing list. To add values,
you must specify only the first or last value you want to add. Oracle OLAP
automatically fills in the gap between the existing list and the value you specify.
n PERIODS FIRST
n PERIODS LAST
Specifies a number of periods to add at the beginning or end of an existing list of
dimension values.
Examples
Syntax
MAINTAIN dimension ADD SESSION member_name [= calculation] -
■ apply-to specifies the basis on which the custom aggregation is added using one of
the following phrases:
APPLY TO AGGMAP aggmaps
APPLY FOR VARIABLE variables
APPLY WITH RELATION relations
Arguments
dimension
A dimension that is already defined in an attached analytic workspace. You can
specify any type of dimension for dimension except a non-unique concat dimension or
a base dimension of either a unique or non-unique concat dimension.
ADD SESSION
ADD SESSION indicates maintenance of a temporary calculated member.
member-name
Specifies the name of the temporary calculated member.
=
Indicates that you are defining a new calculated member.
model-equation
A text expression that specifies the calculation used as a dynamic model to calculate
custom member values. (See the SET command for more information about model
equations.)
AGGREGATION
Indicates that the temporary calculated member is added as a custom aggregation
using the specified dimension members. This clause effectively modifies the
RELATION statement of aggmap objects that are the aggregation specification for
variables dimensioned by dimension. Consequently, a MAINTAIN ADD SESSION
statement that contains an AGGREGATION clause must also contain an APPLY WITH
RELATION clause.
dimension-members
A text expression that specifies one or more dimension values to be used by the
custom aggregation. When using a literal to specify more than one dimension
member, separate the values with commas
STEP DIMENSIONS
Indicates that the calculation is a time-series function.
stepdim
A text expression that specifies the dimension along which the time-series function is
calculated. When using a literal to specify more than one dimension name, separate
the names with commas.
APPLY TO AGGMAP
Indicates that the calculated temporary member is added only to dimensions used by
the specified aggmap objects.
aggmaps
A text expression that specifies the name of one or more aggmap objects to which the
temporary calculated member is added. When using a literal to specify more than one
aggmap object, separate the names with commas. The temporary calculated member is
added to each of the specified aggmap objects.
variables
A text expression that specifies the one or more variable names for which the
temporary calculated member is added to. When using a literal to specify more than
one variable name, separate the names with commas. The temporary calculated
member is added to the default aggmap object of each specified variable.
relation
A text expression that specifies the name of the relation for which there must be a
RELATION statement in the AGGMAP statement.
Notes
Examples
LETTER MY_QUANTITY
-------------- ------------------------------
A 10.00
B 100.00
You can define temporary dimension members for the letter dimension and
aggregate data in my_quantity for those members following these steps:
1. Determine the aggregation that you want to perform and define and populate the
necessary supporting objects.
a. Create an empty child-parent relation for the letter dimension
DEFINE letter.parentrel RELATION letter <letter>
LETTER LETTER.PARENTREL
-------------- ------------------------------
A NA
B NA
COMPILE my_aggmap
d. Define a variable to contain the definition for the custom aggregation, This
new variable will be the same as my_quantity except that has my_aggmap as
its default aggmap.
DEFINE my_quantity_definition VARIABLE DECIMAL <letter>
CONSIDER my_quantity_definition
PROPERTY '$AGGMAP' 'my_aggmap'
REPORT my_quantity_definition
LETTER MY_QUANTITY_DEFINITION
-------------- ------------------------------
A NA
B NA
2. Add temporary members to the letter dimension and specify how variable
values for those members are to be calculated.
MAINTAIN letter ADD SESSION 'C' = 'A' * 'B'
MAINTAIN letter ADD SESSION 'D' = AGGREGATION('A', 'B') -
APPLY TO AGGMAP my_aggmap
MAINTAIN letter ADD SESSION 'E' = 'C' + 'D' -
APPLY WITH RELATION letter.parentrel
MAINTAIN letter ADD SESSION 'F' = 10 * 'E' -
APPLY FOR VARIABLE my_quantity_definition
AGGREGATE(MY_QUANTITY USING
LETTER MY_AGGMAP)
-------------- ------------------------------
A 10.00
B 100.00
C 1,000.00
D 110.00
E 1,110.00
F 11,100.00
Assume now that you issue the UPDATE and COMMIT statements to update and
commit your analytic workspace. Then you detach the analytic workspace and end
your session.
Later you start a new session and attach the same analytic workspace. When you ask
for a description of the analytic workspace you can see that all of the objects that were
in the analytic workspace when the UPDATE was issued still exist.
DEFINE LETTER DIMENSION TEXT
However, when you report on the letter dimension and the my_quantity variable,
the temporary dimension members that you added in the previous session and their
related values in the my_quantity variable do not exist.
LETTER
--------------
A
B
REPORT letter.parentrel
LETTER LETTER.PARENTREL
-------------- ------------------------------
A NA
B NA
REPORT my_quantity
LETTER MY_QUANTITY
-------------- ------------------------------
A 10.00
B 100.00
LETTER MY_QUANTITY_DEFINITION
-------------- ------------------------------
A NA
B NA
AGGREGATE(MY_QUANTITY USING
LETTER MY_AGGMAP)
-------------- ------------------------------
A 10.00
B 100.00
Syntax
MAINTAIN partition-template ADD TO PARTITION partition valuelist
Arguments
partition-template
A text expression that is the name of a previously-defined partition template object.
ADD TO PARTITION
Specifies that values are to be added to the partition.
partition
A text expression that is the name of a previously-defined partition in the partition
template specified by partition-template.
valuelist
Text literals or a TEXT or ID expression specifying the values to be added. When it is a
TEXT expression, each element (line) is treated as a separate value. The values in the
expression are added exactly as they are typed.
For a concat dimension, you can specify a value of the concat dimension, or the name
of a component dimension and a value or position of that dimension. You can use the
values of a dimension surrogate as the values of value.
TO
Indicates a range of values.
Examples
For an example of adding values to a partition, see Example 10–48, "Adding and
Deleting Partition Values" on page 10-91.
MAINTAIN DELETE
The MAINTAIN command with the DELETE keyword deletes members from
non-concat dimensions and composites; or deletes the data of previously-partitioned
variables from one partition to another as it changes the dimension or composite
values defined for a partition in the partition template which the variables are
dimensioned.
Syntax
The syntax for using the DELETE keyword of the MAINTAIN command to delete
members varies depending on the type of object from which you are deleting the
members. For this reason, the following separate entries are provided for MAINTAIN
DELETE:
■ MAINTAIN DELETE dimension
■ MAINTAIN DELETE composite
■ MAINTAIN DELETE FROM PARTITION
Syntax
MAINTAIN dimension DELETE limit-clause
Arguments
dimension
A non-concat dimension, already defined in an attached analytic workspace, whose
values are to be deleted.
limit-clause
Specifies the values to delete from the dimension.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
Notes
Examples
Syntax
MAINTAIN composite DELETE comp-arg
where comp-arg is one of the following constructs:
valuelist
ALL
base-dim [valuelist]
boolean-expression
{TOP | BOTTOM} n BASEDON exp
{TOP | BOTTOM} n-percent PERCENTOF expression
LONGLIST
Arguments
composite
A composite whose values are to be deleted. When the composite is a named
composite, it must be defined in an attached analytic workspace. When the composite
is unnamed, it must have been used in defining an object in an attached analytic
workspace.
Use the SPARSE keyword to refer to an unnamed composite (for example,
SPARSE <market product>).
valuelist
Specifies one or more values to be deleted from the composite. The valuelist can be text
constants or a text expression.
ALL
Deletes all composite values. This does not delete the definition of the composite itself.
base-dim [valuelist]
Deletes the values that include the listed values of a base dimension of the composite.
The argument valuelist can be one value, a list of values, or a range of values (using TO
to specify an inclusive range). You cannot use position numbers to specify a range of
values. When you omit valuelist, Oracle OLAP deletes all values that include base-dim
values currently in status.
boolean-expression
Deletes all composite values for which the Boolean expression is TRUE. The
boolean-expression must be dimensioned by the dimension or the composite from which
you the values deleted. When it has additional dimensions, their status must each be
limited to one value.
LONGLIST
Indicates a long list (up to 2,000 values) of individual values to delete. When there are
fewer than 300 values, LONGLIST is not needed.
Syntax
MAINTAIN partition-template DELETE FROM PARTITION partition { dim-arg| comp-arg}
Arguments
partition-template
A text expression that is the name of a previously-defined partition template object.
partition
A text expression that is the name of a previously-defined partition in the partition
template specified by partition-template.
dim-args
Specifies the values of a dimension that to use when deleting partitioned variable
values and when redefining the values that are in the partition You can use any of the
constructs specified for the dim-arg argument in MAINTAIN DELETE dimension.
comp--args
Specifies the values of a composite to use when deleting partitioned variable values
and when redefining the values that are in the partition You can use any of the
constructs specified for the comp-arg argument in MAINTAIN DELETE composite.
Examples
Assume that instead of having all sales values dimensioned levels by all time values of
a year in a partition, you want to have partitions by days and by summary time values
(month and year). To change partition_sales_by_year to reflect this new
partitioning scheme, you issue the following statements.
"Create the new partition
CHGDFN partition_sales_by_year DEFINE -
(PARTITION partition_month_years VALUES () <time product>)
"Delete the values for months and years from the partitions for years
MAINTAIN partition_sales_by_year DELETE FROM PARTITION time_2004 '2004'-
'Dec2004' 'Jan2004'
MAINTAIN partition_sales_by_year DELETE FROM PARTITION time_2003 '2003'-
'Dec2003''Jan2003'
MAINTAIN partition_sales_by_year DELETE FROM PARTITION time_2002 '2002'-
'Dec2002' 'Jan2002'
"Add the month and year values to the new partition for summary values
MAINTAIN partition_sales_by_year ADD TO PARTITION partition_month_years '2004'-
'Dec2004' 'Jan2004' '2003' 'Dec2003''Jan2003' '2002' 'Dec2002' 'Jan2002'
MAINTAIN MERGE
The MAINTAIN command with the MERGE keyword provides a quick way to make
sure all dimension or composite values on a separate list are included in a non-concat
dimension or composite. Using the MERGE keyword with the MAINTAIN command
automatically adds the new values from the list and ignores the duplicates. This
method of entering dimension values can save a significant amount of time when you
have a large number of values to enter.
You can use MERGE with dimensions of any data type, including DAY, WEEK,
MONTH, QUARTER, and YEAR dimensions. However, since Oracle OLAP provides a
quick way of adding values of DAY, WEEK, MONTH, QUARTER, and YEAR
dimensions through the ADD keyword, the MERGE keyword may not be as useful
with DAY, WEEK, MONTH, QUARTER, and YEAR dimensions as it is with TEXT or
ID dimensions.
At the same time as you are merging values into a dimension, you can also update a
relation that involves that dimension.
Note: You can also issue this MAINTAIN MERGE statement for a
surrogate dimension that has a Maintain trigger. In this case, Oracle
OALP only executes the Maintain trigger program one time for each
value in exp; no other action occurs. See "Trigger Programs" on
page 4-16 for more information for more information. Issuing a
MAINTAIN statement for a surrogate dimension that does not have a
Maintain trigger, returns an error.
Syntax
MAINTAIN dimension|composite MERGE exp [RELATE relation]
dimension
A non-concat dimension, already defined in an attached analytic workspace, whose
values are to be entered or changed.
composite
A composite whose values are to be added, deleted, or merged. When the composite is
a named composite, it must be defined in an attached analytic workspace. When the
composite is unnamed, it must have been used in defining an object in an attached
analytic workspace. Use the SPARSE keyword to refer to an unnamed composite (for
example, SPARSE <market product>).
exp
Specifies an expression whose values are to be merged with dimension; for example,
the name of a dimensioned text variable that contains dimension values, or a
single-cell text variable whose value is a multiline list of dimension values.
MAINTAIN MERGE ignores any NAs in exp. When dimension is an INTEGER
dimension, then exp specifies the number of values that you want in the dimension.
When the actual total is less, MAINTAIN MERGE adds enough values to reach the
specified total. For example, when an INTEGER dimension has 10 positions, MERGE 5
has no effect; but MERGE 15 would add 5 values.
RELATE relation
Specifies a relation to be updated as new values from exp are merged into dimension.
At least one of the dimensions of exp must also appear in the definition of relation.
When exp is a single-cell value, you cannot use the RELATE phrase.
Examples
MAINTAIN MOVE
A MAINTAIN command with the MOVE keyword has different effects depending on
the object on which it operates:
■ When maintaining a dimension, MAINTAIN MOVE changes the position of one
or more values in a non-concat dimension or a dimension of type TEXT, ID, or
INTEGER or adds previously-populated dimension or composite values to a
partition
■ When maintaining a partition, MAINTAIN MOVE moves the data of a
previously-partitioned variables from one partition to another as it changes the
dimension or composite values defined for a partition in the partition template
which the variables are dimensioned.
Syntax
The syntax for using the MAINTAIN command with the MOVE keyword depends on
the type of the object being maintained.
For this reason, the following separate entries are provided for MAINTAIN MOVE:
■ MAINTAIN MOVE dimension value
■ MAINTAIN MOVE TO PARTITION
Syntax
MAINTAIN dimension MOVE limit-clause
Arguments
dimension
A non-concat dimension, already defined in an attached analytic workspace, whose
values are to be entered or changed. The dimension must be of type TEXT, ID, or
INTEGER. You cannot specify a dimension of type DAY, WEEK, MONTH,
QUARTER, or YEAR.
limit-clause
Specifies the values you want to move.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
Notes
Sorting Values
You can sort the values of a dimension with the following statements.
LIMIT dimension TO ALL
SORT dimension A sort-criterion
MAINTAIN dimension MOVE VALUES(dimension) FIRST
The sorting criterion can be any expression you choose (see the SORT command). To
sort the dimension alphabetically, use the dimension itself as the criterion (see
Example 10–52, "Moving Dimension Values into Sorted Order" on page 10-96. After
using the SORT command to sort the dimension values, you use the MAINTAIN
command to make the sorted order permanent.
You can use the SORT command for a temporary sort of the values of a dimension
with a type of DAY, WEEK, MONTH, QUARTER, or YEAR. For example, you might
want to use the sorted order in a report. However, you cannot use the MAINTAIN
command to save the sorted order as the permanent order of a dimension with the
type of DAY, WEEK, MONTH, QUARTER, or YEAR. The values of these types of
dimensions must be stored in increasing chronological order.
Examples
Example 10–51 Moving a Dimension Value to the End of the Status List
In this example, you use the TEXT variable textvar to move Seattle to the end of
the list of cities.
textvar = 'Seattle'
MAINTAIN city MOVE textvar LAST
Syntax
MAINTAIN partition-template MOVE TO PARTITION partition value [TO value]
Arguments
partition-template
A text expression that is the name of a previously-defined partition template object.
MOVE TO PARTITION
Specifies that values are to be added to the partition or moved from one partition to
another.
partition
A text expression that is the name of a previously-defined partition in the partition
template specified by partition-template.
value
Specifies one or more values of a previously-populated dimension or composite. You
can specify these values as:
■ A literal value.
TO
Indicates a range of values.
Examples
To specify the values of each partition using valuesets, you take the following steps:
1. Define a valueset for each year's values.
DEFINE vs_2004 VALUESET time
LIMIT vs_2004 to '01Dec2004' '31Dec2004' '01Jan2004''31Jan2004' -
'Jan2004' 'Dec2004' '2004'
DEFINE vs_2003 VALUESET time
LIMIT vs_2003 to '01Dec2003' '31Dec2003' '01Jan2003''31Jan2003' -
'Jan2003' 'Dec2003' '2003'
DEFINE vs_2002 VALUESET time
LIMIT vs_2002 to '01Dec2002' '31Dec2002' '01Jan2002''31Jan2002' -
'Jan2002' 'Dec2002' '2002'
2. Using MAINTAIN MOVE statements, specify values for the partitions of the
partition template.
MAINTAIN partition_sales_by_year MOVE TO PARTITION time_2004 vs_2004
MAINTAIN partition_sales_by_year MOVE TO PARTITION time_2003 vs_2003
MAINTAIN partition_sales_by_year MOVE TO PARTITION time_2002 vs_2002
When you issue a DESCRIBE statement, you can see that the description of the
partition_sales_by_year partition template now includes the appropriate
values of time in each partition definition.
DEFINE PARTITION_SALES_BY_YEAR PARTITION TEMPLATE <TIME PRODUCT> -
PARTITION BY LIST (TIME) -
(PARTITION TIME_2004 VALUES -
('2004','Dec2004','Jan2004', 31Dec2004',01Dec2004','31Jan2004','01Jan2004')-
PARTITION TIME_2003 VALUES -
('2003','Dec2003','Jan2003', 31Dec2003',01Dec2003','31Jan2003','01Jan2003')-
PARTITION TIME_2002 VALUES -
('2002','Dec2002','Jan2002', 31Dec2002',01Dec2002','31Jan2002','01Jan2002'))
MAINTAIN RENAME
The MAINTAIN command with the RENAME keyword changes the spelling of one or
more dimension values. You cannot use RENAME keyword with a composite or with
dimensions of type INTEGER, DAY, WEEK, MONTH, QUARTER, or YEAR.
Syntax
MAINTAIN dimension RENAME {value new-value}...
Arguments
dimension
A non-concat dimension of type TEXT or ID that is already defined in an attached
analytic workspace and whose values are to be renamed. You cannot specify a
dimension of type INTEGER, DAY, WEEK, MONTH, QUARTER, or YEAR.
value
Specifies an existing dimension value to be renamed. You can specify a dimension
value, a character expression whose value is a dimension value, or an INTEGER
expression whose value represents the position of a dimension value.
new-value
A text constant or a TEXT or ID expression that is the new spelling for the dimension
value.
Examples
In this example you use the TEXT variable textvar to change the second city to
Atlanta.
textvar = 'Atlanta'
MAINTAIN city RENAME 2 textvar
MODEL
The MODEL command enters a completely new specification into a new or existing
model object. When the model already has a specification, Oracle OLAP overwrites it.
In order to use MODEL to assign an model specification to a model object, the
definition must be the one most recently defined or considered during the current
session. When it is not, you must first use a CONSIDER statement to make it the
current definition.
An alternative to a MODEL statement is an EDIT MODEL statement, which is
available only in OLAP Worksheet. An EDIT MODEL statement opens an Edit
window in which you can add, delete, or change the specification for a model object.
Adding a specification to a model object is just one step in modeling data. For more
information on models, see "OLAP DML Model Objects" on page 3-3.
Syntax
MODEL specification
Arguments
specification
A multiline text expression that contains one or more of the following OLAP DML
statements:
SET (=) command
DIMENSION (in models) statement
INCLUDE statement
The maximum number of lines you can have in a model is 4,000. Each statement is a
line of the multiline text expression. When coding an ALLOCMAP statement at the
command line level, separate statements with newline delimiters (\n), or use
JOINLINES.
For a discussion of designing a model specification, see "Model Specification" on
page 10-99.
Notes
Model Specification
The model specification consists of the following OLAP DML statements:
1. One of the following:
■ Exactly one INCLUDE statement that specifies the name of another model to
include. See "Nesting Models" on page 3-4 for more information.
■ One or more DIMENSION (in models) statements coded following the
"Guidelines for Writing DIMENSION Statements in a Model" on page 10-106.
2. One or more SET commands or equations written following the "Rules for
Equations in Models" on page 10-195.
See also: "Dimension Status and Model Equations" on page 3-4 for
information on how Oracle OLAP processes equations in a model.
3. A final END statement that indicates the end of the model specification. (Omit
when coding the specification in an Edit window of the OLAP Worksheet.)
The maximum number of lines you can have in a model is 4,000.
Examples
END
After defining the model, you can use a MODEL statement or the OLAP Worksheet
editor to enter the specification for the model. A model specification can contain
DIMENSION commands, assignment statements and comments. All the DIMENSION
commands must come before the first equation. For the current example, you can
specify the lines shown in the following model.
DEFINE INCOME.CALC MODEL
LD Calculate line items in income statement
MODEL
DIMENSION line
net.income = opr.income - taxes
opr.income = gross.margin - (marketing + selling + r.d)
gross.margin = revenue - cogs
END
When you write the equations in a model, you can place them in any order. When you
compile the model, either by issuing a COMPILE statement or by running the model,
the order in which the model equations are solved is determined. When the calculated
results of one equation are used as input to another equation, then the equations are
solved in the order in which they are needed.
To run the income.calc model and use actual as the solution variable, you execute
the following statement.
income.calc actual
When the solution variable has dimensions other than the dimensions on which model
equations are based, then a loop is performed automatically over the current status list
of each of those dimensions. For example, actual is dimensioned by month and
division, as well as by line. When division is limited to ALL, and month is
limited to OCT96 to DEC96, then the income.calc model is solved for the three
months in the status for each of the divisions.
For this example, you need to enter input data, such as revenue and cost of goods sold,
into the plan variable.
For the best-guess data, you can use the data in the budget variable. Limit the line
dimension to the input line items, and then copy the budget data into the plan
variable.
LIMIT scenario TO 'BESTGUESS'
LIMIT line TO 'REVENUE' 'COGS' 'MARKETING' 'SELLING' 'R.D'
plan = budget
You might want to base the optimistic and pessimistic data on the best-guess data. For
example, optimistic data might be fifteen percent higher than best-guess data, and
pessimistic data might be twelve percent less than best-guess data. With line still
limited to the input line items, execute the following commands.
plan(scenario 'OPTIMISTIC') = 1.15 * plan(scenario 'BESTGUESS')
plan(scenario 'PESSIMISTIC') = .88 * plan(scenario 'BESTGUESS')
The final step in building a scenario model is to write a model that calculates results
based on input data. The model might contain calculations very similar to those in the
budget.calc model shown earlier in this chapter.
You can use the same equations for each scenario or you can use different equations.
For example, you might want to calculate the cost of goods sold and use a different
constant factor in the calculation for each scenario. To use a different constant factor
for each scenario, you can define a variable dimensioned by scenario and place the
appropriate values in the variable. When the name of your variable is cogsval, then
your model might include the following equation for calculating the cogs line item.
cogs = cogsval * revenue
example, when labor costs vary from division to division, then you might dimension
cogsval by division as well as by scenario.
When you run your model, you specify plan as the solution variable. For example,
when your model is called scenario.calc, then you solve the model with this
statement.
scenario.calc plan
A loop is performed automatically over the current status list of each of the
dimensions of plan. Therefore, when the scenario dimension is limited to ALL
when you run the scenario.calc model, then the model is solved for all three
scenarios: optimistic, pessimistic, and bestguess.
The DIMENSION statement at the beginning of a model tells Oracle OLAP the names
of one or more dimensions to which the model assigns data or to which it refers in
dimension-based equations. A dimension-based equation assigns the results of a
calculation to a target that is represented by one or more values of a dimension.
Syntax
DIMENSION dimension1 [, dimensionN]
Arguments
dimension
One or more dimensions, including base dimensions of composites, on which model
equations are based. You can specify the name of a dimension surrogate instead of the
dimension for which is a surrogate. You can then use the values of the surrogate
instead of the values of the dimension.
Notes
The writer of the preceding model expects to use a solution variable that is
dimensioned by line and month. Therefore, when the model is run, the LAG
function will operate on a solution variable that has the specified time dimension
(month) as one of its dimensions. However, since the model compiler cannot
anticipate the time dimension of the solution variable, you must specify it in a
DIMENSION statement. When you fail to include month in a DIMENSION statement,
an error occurs when you attempt to compile the model.
In a function that operates on time-series data (such as MOVINGTOTAL or LAG), the
dimension argument is optional when the dimension of type DAY, WEEK, MONTH,
QUARTER, or YEAR. For example, you can omit month from the LAG function in the
preceding example. However, you must still specify the appropriate time dimension
in a DIMENSION statement.
Solution Variable
When you run a model that contains dimension-based equations, you specify a
solution variable, which is both the source and the target of data for the model. The
solution variable is generally dimensioned by all the dimensions that are listed in the
DIMENSION commands used in the model. Or, when a solution variable is
dimensioned by a composite, the DIMENSION commands can list base dimensions of
the composite. The DIMENSION commands can be explicit in the model or inherited
through an included model. See "Incompatibility with INCLUDE" on page 10-105.
Location of Commands
You must place all the DIMENSION commands at the beginning of the model, before
any equations.
Inherited DIMENSION commands must satisfy all the requirements specified for
explicit DIMENSION commands. See "Guidelines for Writing DIMENSION
Statements in a Model" on page 10-106.
Dimension Order
When more than one dimension is specified by the DIMENSION commands in a
model, the order in which the dimensions are listed is important:
■ When a model equation contains a name that might be a dimension value, Oracle
OLAP searches through the dimensions that appear in the model's explicit or
inherited DIMENSION commands, in the order you list the dimensions, to
determine whether the name matches a dimension value of a listed dimension.
The search concludes as soon as a match is found. Therefore, when two or more
listed dimensions have a dimension value with the same name, Oracle OLAP
assumes that the value belongs to the dimension specified earliest in a
DIMENSION statement. When the name does not match a value of a listed
dimension, Oracle OLAP then searches through the variables in the attached
workspaces to find a match.
■ When model equations assign results to values of a target dimension, Oracle
OLAP constructs code that will loop over the values of the other, non-target,
dimensions listed in the DIMENSION commands. The non-target dimension listed
first in the DIMENSION commands is treated as the slowest-varying dimension.
For example, when MONTH is the first non-target dimension listed in a
DIMENSION statement and DIVISION is the second, Oracle OLAP loops through
all the divisions for the first month, then all the divisions for the second month,
and so on.
See Also: "OLAP DML Model Objects" on page 3-3, SET, and
MODEL for information on:
■ Entering statements in a model
■ How to refer to values of dimensions
■ Explanation of how Oracle OLAP constructs code from the
statements
■ Explanation of how Oracle OLAP handles the situation in which
the solution variable has more dimensions or fewer dimensions
than are listed in DIMENSION commands
Examples
The model equations are based on the line dimension, so line is specified in the
DIMENSION statement. The dimension month is the time dimension in the LAG
function that operates on REVENUE values, so month is also specified in the
DIMENSION statement.
When you run the model, Oracle OLAP loops over the values in the current status of
the month dimension.
INCLUDE
The INCLUDE statement includes one model within another model. You can use the
INCLUDE statement only within models.
Use INCLUDE to create modular models by placing equations that are common to
several models, in a separate model for inclusion on other models as needed. The
INCLUDE statement also facilitates what-if analyses. An experimental model can
draw equations from a base model and selectively replace them with new equations
Syntax
INCLUDE model
Arguments
model
The name of a model to include in the current model. The current model is referred to
as the parent model. The model that you include is referred to as the base model.
Notes
Masking Equations
To support what-if analyses, Oracle OLAP allows equations in a model to mask
previous equations. The previous equations can come from the same model or from
included models. A masked equation is not executed. When you run the
MODEL.COMPRPT program after compiling the model, you will see that the masked
equation is not shown in the report on the compiled model.
Masking can take place when an equation assigns a value to a variable or dimension
value that is also the target of a previous equation. The masking rules are as follows:
■ When the target in the earlier equation is qualified exactly the same as the target
in the later equation, the earlier equation is masked and the later equation is
executed. The following example illustrates two equations with targets that are
identically qualified.
Equation from a base model: BUDGET(LINE REVENUE) = 5000
Equation from the parent model: BUDGET(LINE REVENUE) = 3500
In this example, the equation from the base model is masked and the equation
from the parent model is executed.
■ When the target in the earlier equation is more qualified than the target in the later
equation, the earlier equation is masked. The later equation is executed.
The target that is more qualified is the one that will affect the fewest dimension
values. Consider the following equations from a base model and a parent model.
Equation from a base model: BUDGET(LINE REVENUE) = 2500
Equation from the parent model: BUDGET = 4000
The equation from the base model is more qualified because it assigns data only
for the REVENUE value of the LINE dimension. The equation from the parent
model assigns data to all the values of the LINE dimension. In this example, the
equation from the base model is masked and the equation from the parent model
is executed.
■ When the target in the earlier equation is less qualified than the target in the later
equation, no masking takes place. Both equations are executed.
Consider the following equations from a base model and a parent model.
Equation from a base model: BUDGET = LAG(ACTUAL, 1, MONTH)
Equation from the parent model: BUDGET(LINE REVENUE) = 6500
Equation from the parent model: BUDGET(LINE COGS) = 4000
The equation from the base model assigns data to all the values of the LINE
dimension. The equations from the parent model are more qualified because each
assigns data only for a single value of the LINE dimension. In this example, the
equation from the base model is executed first, and then the equations from the
parent model are executed.
This functionality enables you to assign a large number of values with one
equation and use subsequent equations to replace or test individual values.
■ When the target in the earlier equation is qualified differently from the target in
the later equation, no masking takes place. Both equations are executed. In the
following example, both equations are executed.
Equation from a base model: BUDGET(LINE REVENUE) = 5000
Equation from the parent model: BUDGET(LINE COGS) = 4500
Examples
MODEL.COMPRPT
The MODEL.COMPRPT program produces a report that shows how model equations
are grouped into blocks. For step blocks and for simultaneous blocks with a
cross-dimensional dependence, the report lists the dimensions involved in the
dependence.
Syntax
MODEL.COMPRPT
Examples
MODEL.DEPRT
The MODEL.DEPRPT program produces a report that lists the variables and
dimension values on which each model equation depends. When a dependence is
dimensional, the report gives the name of the dimension.
Syntax
MODEL.DEPRT
Examples
The data sources in statements 4, 5, and 6 have a LAG dependence on the month
dimension.
MODEL.XEQRPT
The MODEL.XEQRPT program produces a report about the execution of the model.
The report specifies the block where the solution failed and shows the values of the
model options that were used in solving simultaneous blocks.
Syntax
MODEL.XEQRPT
Notes
Running MODEL.XEQRPT
Before you can run the MODEL.XEQRPT program, you must
1. Set the MODERROR option to STOP or CONTINUE.
2. Execute the model.
When the model halts because of an error, run the MODEL.XEQRPT program.
Examples
MODEL.XEQRPT income.est
The report shows the values of the model options that were used in solving the
simultaneous blocks and indicates whether each block was solved.
MONITOR
The MONITOR command records data on the performance cost of each line in a
specified program. To get meaningful information from MONITOR, your session must
be the only one running in Oracle OLAP. Furthermore, the accuracy of the results of
MONITOR decreases as more processes are started on the host computer.
You first use a MONITOR statement to specify a program for monitoring; then you
run the program and use MONITOR again to obtain the results. When the program
executes a given line repeatedly, MONITOR records the cumulative cost of all the
executions on the single line of its monitor list that is devoted to that program line.
A line of code is considered to have a high performance cost when it takes a long time
to execute. Use a TRACKPRG statement to identify programs that have relatively high
costs and then use MONITOR to identify the time-consuming lines within those
programs. When you wish, you can use both TRACKPRG and MONITOR
simultaneously.
Syntax
MONITOR ON [programs] | OFF | INIT | FILE [[APPEND] file-name] | RESET
where programs is one of the following:
ALL [awlist]
program-name
Arguments
ON
Starts looking for the specified programs to be run so that Oracle OLAP can gather
line-by-line timing data in a monitor list. (It continues the current monitoring process
without interruption when monitoring is already on, or resumes with a gap when
monitoring was off.)
When you do not specify a value for programs, the default is the program or programs
specified in the last executed MONITOR ON statement. When there was no such
statement in your current session, no data is collected and no error is produced.
ALL
Specifies that all of the programs in one or more analytic workspaces are monitored.
awlist
The name of one or more analytic workspaces (optionally separated by commas)
whose programs you want monitored. When you omit this argument, Oracle OLAP
monitors all of the programs in all of the attached analytic workspaces
program-name
The name of a specific program that you want monitored.
OFF
Stops monitoring programs and freezes any timing data currently in the monitor list.
This lets you immediately, or later in your session, send the list to the current outfile or
to a text file.
RESET
(Useful only when monitoring is on.) Retains information about the programs that ares
currently specified for monitoring and the Oracle OLAP memory that is allocated for
the current monitor list, but discards any timing data currently in the list. In addition,
RESET causes MONITOR to again begin waiting for you to run the same programs.
When you do, MONITOR automatically gathers new timing data into a new monitor
list for the same programs in the same memory allocation as before.
INIT
(Useful only when monitoring is on.) Initializes the monitoring environment.
Initialization consists of discarding the program names and the timing data associated
with the current monitor list, and releasing the Oracle OLAP memory previously used
for that list so it can be used for other purposes or for collecting new data in a new
monitor list.
FILE
Specifies that the timing data that is currently in the monitor list is sent to a file.
APPEND
Specifies that the timing data is appended to an existing file. When you omit this
argument, the new output replaces the current contents of the file.
file-name
A text expression that is the name of the file to receive the output. Unless the file is in
the current directory, you must include the name of the directory object in the name of
the file. When file-name is specified, the data is sent to the named text file. FILE has no
effect on the monitor list, so you can send the same list repeatedly to different
destinations. When file-name is omitted, Oracle OLAP sends the timing data that is
currently in the monitor list to the current outfile.
Note: Directory objects are defined in the database, and they control
access to directories and file in those directories. You can use a CDA
statement to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
Notes
Monitor List
Each entry (that is, line) in the monitor list focuses on the execution of a single
program line, regardless of how many times it is executed. Each entry is divided into
the following four sections:
■ Cumulative total time of all executions in milliseconds rounded to the nearest 10
millisecond, in columns 1 through 11
■ Number of times executed, in columns 12 through 18
■ Line number, in columns 19 through 23
■ Text of the line, in column 24 and subsequent columns
Here is a sample of MONITOR output with column numbers included for reference.
12345678901234567890123456789012345678901234567890
60 1 1 push name
The following is the full description of the program used for the preceding output.
Note that in the output, the line with the LIMIT command is truncated because it is too
long to fit.
DEFINE allstat PROGRAM
LD Program to set the status of all dimensions in the analytic workspace to ALL
PROGRAM
PUSH NAME
TRAP ON getout NOPRINT
LIMIT NAME TO OBJ(TYPE) EQ 'Dimension' IFNONE getout
FOR NAME
DO
LIMIT &NAME TO ALL IFNONE bypass
bypass:
DOEND
getout:
POP NAME
END
Producing a Report
When you want to produce an Oracle OLAP report from the timing data in the
MONITOR file, you can write a program that uses a FILEREAD statement to read the
data into an Oracle OLAP variable, and then use Oracle OLAP reporting capabilities to
produce a report. You can use the TRACKREPORT program as a model. However, keep
in mind that the TRACKREPORT program was written to produce a report on
TRACKPRG output, not MONITOR output.
Bracketing Lines
When you just want to time a particular line or group of lines in a program, you can
insert MONITOR ON and MONITOR OFF statements in the program to bracket just the
line or lines in which you are interested.
seconds taken by all the times the line was run and provide the number of times it was
run.
When you just want to time a particular execution of a nested program that is called
more than once, you can insert MONITOR ON and MONITOR OFF statements in the
calling program to bracket the single call in which you are interested.
Examples
MOVE
The MOVE command moves an object name to a new position in the NAME
dimension of an analytic workspace. The reorganizing effect of the MOVE command
on the workspace is cosmetic. That is, no physical changes take place in workspace
storage. Users often reorganize workspace objects so the output from DESCRIBE is
easier to read.
Syntax
MOVE name... {FIRST|LAST|{BEFORE|AFTER} name2} [AW workspace]
Arguments
name...
The names of one or more objects to move. You can specify the names individually, or
use one of the following forms to specify a group of names:
name TO name
FIRST n
LAST n
boolean-expression (dimensioned by NAME)
You can specify a qualified object name to indicate the attached workspace in which
the object resides. As an alternative, you can use the AW argument to specify the
workspace. Do not use both.
When you do not use a qualified object name or the AW argument to specify an
analytic workspace, Oracle OLAP looks for the object in the current workspace.
FIRST
LAST
The logical position in the NAME dimension to which Oracle OLAP moves the objects
specified by the name argument. Specifying FIRST moves the objects to the beginning
of the NAME dimension. Specifying LAST (the default) moves the names to the end of
the NAME dimension.
BEFORE name2
AFTER name2
The position before or after a particular object (name2) to which Oracle OLAP moves
the objects specified by the name argument.
AW workspace
The name of an attached workspace in which you wish to move the object. When you
do not use a qualified object name or the AW argument to specify an analytic
workspace, objects are moved in the current workspace.
Notes
Examples
change the workspace order and produce the following list (annotation has been
added).
product <--- Position of product
desc.product <--- New position of desc.product
district
division
line
region
marketlevel
market
month
year
quarter
region.district
division.product
...
OUTFILE
The OUTFILE command lets you redirect the text output of statements to a file.
Syntax
OUTFILE {EOF | TRACEFILE | [APPEND] file-name [NOCACHE] [NLS_CHARSET charset-exp]}
Arguments
EOF
The current outfile is closed and output is redirected to the default outfile.
TRACEFILE
Specifies that the output should be directed the Oracle trace file, which is identified by
the TRACEFILEUNIT option.
APPEND
Specifies that the output should be added to the end of an existing disk file. When you
omit this argument, the new output replaces the current contents of the file.
file-name
A text expression that is the name of the file to which output should be written. Unless
the file is in the current directory, you must include the name of the directory object in
the name of the file.
Note: Directory objects are defined in the database, and they control
access to directories and file in those directories. You can use a CDA
statement to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
NOCACHE
Specifies that Oracle OLAP should write lines to the outfile as they are generated.
Without this keyword, Oracle OLAP reduces file I/O activity by saving text and
writing it periodically to the file. The NOCACHE keyword slows performance
significantly, but it ensures that every line is immediately recorded in the outfile. This
argument must be specified after file-name
NLS_CHARSET charset-exp
Specifies the character set that Oracle OLAP will use when writing data to the file
specified by file-name. This allows Oracle OLAP to convert the data accurately into that
character set. This argument must be specified after file-name. When this argument is
omitted, then Oracle OLAP writes the data to the file in the database character set,
which is recorded in the NLS_LANG option.
Notes
workspaces, rename them before using OUTFILE; and then, after using INFILE to
copy them into an analytic workspace, name them back to PERMIT_READ or
PERMIT_WRITE.
Appending to an Outfile
When you send output to a file and then send output to a second file, the first file does
not remain open. To resume sending output to the first file, you must execute another
OUTFILE statement and include the APPEND file-name phrase.
Examples
year.end.sales
OUTFILE EOF
Now the file contains the year.end.sales report. You can add more reports to the
same file with the APPEND keyword for OUTFILE. Suppose you have another program
called year.end.expenses. Add its report to the file with the following commands.
Remember that without APPEND, an OUTFILE statement overwrites the expense
report.
OUTFILE APPEND 'userfiles/yearend.txt'
year.end.expenses
OUTFILE EOF
PAGE
The PAGE program forces a page break in output when PAGING is set to YES. An
optional argument to PAGE specifies a conditional page break based on how many
lines are left on the page.
The PAGE program is commonly used in report programs. It is meaningful only when
PAGING is set to YES and only for output from statements such as REPORT and
LISTNAMES.
Syntax
PAGE [n]
Arguments
n
A positive INTEGER expression that indicates that a page break should occur only
when there are fewer than n lines left on the current page. When the number of lines
left equals or exceeds n, no page break occurs. See Example 10–71, "Keeping Lines
Together" on page 10-124.
Notes
Top of Page
No page break occurs when you are already at the top of a page when a PAGE
statement is executed.
Examples
PAGEPRG = 'report.head'
FOR district
DO
PAGE
ROW district
BLANK
FOR month
ROW WIDTH 8 month sales sales.plan
DOEND
PAGE
POP PAGING PAGEPRG
PARSE
Use the PARSE command to parse a specified group of expressions. When the
argument can be parsed, PARSE determines the number of expressions in it and their
text, object type, data type, and the number and names of their dimensions. This
information is stored internally by Oracle OLAP, but can be obtained with the INFO
function.
A PARSE statement is especially useful when you want to accept expressions as
arguments to a program.
Syntax
PARSE text-expression
Arguments
text-expression
A text expression that contains one or more smaller expressions to be parsed. When
you are processing program arguments, you can specify an ARGS function as the text
expression that contains all the arguments for the program.
Notes
Examples
When you run the program, you can supply either the names of variables (such as
sales) or expressions (such as sales-expense) or one of each as arguments. The
following REPORT statement produces the illustrated report.
report1 sales sales-expense
DISTRICT: CHICAGO
--------------------MONTH--------------------
--------JAN95--------- --------FEB95---------
PRODUCT SALES SALES-EXPENSE SALES SALES-EXPENSE
------------ -------- ------------- -------- -------------
Tents 29,099 1,595 29,010 1,505
Canoes 45,278 292 50,596 477
Racquets 54,270 1,400 58,158 1,863
Sportswear 72,123 7,719 80,072 9,333
Footwear 90,288 8,117 96,539 13,847
PERMIT
The PERMIT command lets you grant or deny read-only and read/write access
permission for workspace objects and for specific values of dimensions and
dimensioned objects. You can also use PERMIT to grant or deny permission to
maintain dimensions and to change permission for workspace objects.
In general, access permissions that you set for a dimension are meaningful not only for
that dimension, but also for the objects dimensioned by that dimension as explained
more fully in "How Dimension Permission Interacts with Permissions for Other
Objects" on page 10-131. Access permissions that you set for other objects are limited
in scope to that particular object. Various conditions determine when permission
changes take effect as discussed in "When Permission Changes Take Effect" on
page 10-130
Syntax
PERMIT {READ|WRITE|MNT|PERMIT} [WHEN permission-condition...]
Arguments
READ
Depending on the permission conditions, grants or restricts permission to read all of
the values of an object or only certain values in a dimension or dimensioned object.
Note that restricting read permission for a dimension also restricts maintain
permission for that dimension. Also, when you grant read permission for an object,
write permission is also allowed for the values you can read, unless you deny it with
an explicit PERMIT WRITE statement.
WRITE
Depending on the permission conditions, grants or restricts permission to modify any
of the values of an object or only certain values of a dimensioned object.
Restricting write permission for an object does not necessarily mean that the object is
totally unavailable. For example, when you have restricted write access to a
calculation specification (that is, an aggmap object, program, model, or formula, you
can still execute the object— you just cannot edit the contents of the calculation
specification.
Oracle OLAP does not prevent you from granting write permission for values that you
cannot read within a dimensioned object. When you have both a PERMIT READ and a
PERMIT WRITE statement for a dimensioned object, and some of the values which
satisfy the permission conditions for write do not fall within the subset of values
which satisfy the permission conditions for read, then those values may be modified
but not seen.
MNT
Depending on the permission conditions, grants or restricts permission to maintain a
dimension.
Note that you cannot grant maintain permission to a dimension for which you have
restricted read permission. Oracle OLAP automatically denies maintain permission for
a dimension when there is restricted read permission for that dimension.
PERMIT
Depending on the permission conditions, grants or restricts permission to use the
PERMIT command to change the read, write, maintain, or permit permission for the
object.
Note that unless explicitly you explicitly deny permit permission for an object, permit
permission is allowed for an object no matter what other permissions are set for that
object.
WHEN permission-condition...
When you omit the WHEN clause and execute a PERMIT READ, PERMIT WRITE, or
PERMIT MNT statement, Oracle OLAP restores full read, write, or maintain
permission to the object.
When you include the WHEN clause, the conditions for granting read, write, maintain,
or permit permission consist of one or more Boolean expressions depending on
whether or not the object has dimensionality, the type of permission you are setting
and, for read and write permissions, whether or not the object has dimensionality:
■ When you are specifying permit permission, maintain permission, or read or write
permission that applies to an object without dimensionality or when you want the
read or write permissions to apply to all the values of a dimensioned object,
specify the permission condition as a Boolean expression that evaluates to a single
value. (Not that if you do specify a dimensioned Boolean expression to specify
permissions for an object without dimensionality or when you are specifying
permit or maintain permission, then PERMIT uses the first value in status.)
■ If you are specifying read or write permission that applies to individual dimension
values or to slices of a dimensioned object, specify one permission condition for
each dimension of interest. In this case, the WHEN clause has the following syntax
Use the UNION phrase to efficiently access the union of several symmetric
subcubes of a multidimensional variable.
Note that if a Boolean expression for a dimensioned permission condition has any
extra dimensions in addition to one of the object dimensions, PERMIT takes the
first value in status to determine which column of Boolean values to use. The
intersection of the YES values for each dimension (a logical AND of the conditions)
is the subset of values within the object to which the permission applies. When
any of the object dimensions are not represented by a dimensioned permission
condition, then Oracle OLAP assumes YES for all those dimension values.
Notes
Note: The OBJ function is an exception to this rule. Because OBJ does
not load the object into memory, it does not reflect any changes to the
object's permission since the last time it was loaded. When you want
OBJ to provide information based on new permission criteria, execute
a LOAD statement before the OBJ statement.
When the only PERMIT Statement for an Object is a PERMIT WRITE Statement
When the only PERMIT statement for an object is a PERMIT WRITE, then read
permission is provided by default for the object. The default read permission is
provided independent of the value of the permission condition(s) for the PERMIT
WRITE statement. This means that a PERMIT WRITE with a single-cell permission
condition which evaluates to NO provides read-only access to an nondimensional
object or to all the values of a dimensioned object.
When the only PERMIT statement for an object is a PERMIT WRITE with dimensioned
permission conditions, it designates some values for read/write access and the
remaining values for read-only access. See Example 10–74, "Variable Permission" on
page 10-132.
■ When there is read permission associated with both the dimension and the
dimensioned object, Oracle OLAP determines the values with read permission in
the object by taking the intersection of the values with read permission in the
dimension and the values with read permission in the object.
■ When there is write permission associated with both the dimension and the
dimensioned object, Oracle OLAP determines the values with write permission in
the object by taking the intersection of the values with read permission in the
dimension, the values with write permission in the dimension, and the values
with write permission in the object.
However, this is not the case for relations and valuesets. When there is restricted write
permission for a dimension of a relation or a valueset, it does not affect relations and
valuesets dimensioned by that dimension.
Determining Permission
The permission associated with an object is provided, like an LD, when you describe it
using a DESCRIBE statement. The only exception is when you are denied permit
permission for the object. In this case, no permission is provided when you describe it.
Examples
When the YES values shown in the preceding example are the only YES values in the
permission conditions, the following PERMIT statement provides read/write access to
sales data for tents and canoes sold in Chicago in Feb95. In the absence of a
PERMIT READ statement for sales, Oracle OLAP provides read-only permission for
all the other values of sales.
PERMIT WRITE WHEN district.bool BY prod.bool BY month.bool
You can restore full write permission with the following PERMIT statement.
PERMIT WRITE
When there is no restricted write permission for sales, the following PERMIT
statement provides read/write access to sales data for tents and canoes sold in
Chicago in Feb95, and it causes all other values of sales to be invisible.
PERMIT READ WHEN district.bool BY prod.bool BY month.bool
-----------------PROD_AUTHORITY------------------
--------------------PRODUCT----------------------
AUTHORITY Tents Canoes Racquets Sportswear Footwear
--------- ----- ------ -------- ---------- --------
Other NO NO YES YES YES
Dba YES YES YES YES YES
CONSIDER product
PERMIT READ WHEN prod_authority
PERMITERROR = NO
RPEPORT product
PRODUCT
-------------
Racquets
Sportswear
Footwear
CONSIDER authority
PERMIT READ WHEN AUTHORITY EQ 'dba'
PERMITRESET
Report product
PRODUCT
-------------
Tents
Canoes
Racquets
Sportswear
Footwear
The following PERMIT statement, applied to the variable price, provides full access
to all values of price when usercheck returns YES. When it returns NO, it denies all
access to the price variable.
PERMIT READ WHEN usercheck(thisuser)
PERMITRESET
Syntax
PERMITRESET [object_name] [READ|WRITE]
Arguments
object_name
Specifies the name of an object for which permission conditions should be reevaluated.
When you do not specify an object name, the permission conditions for all objects are
reevaluated.
READ
Causes reevaluation of the permission conditions for PERMIT READ commands only,
or for a PERMIT READ statement for the specified object.
WRITE
Causes reevaluation of the permission conditions for PERMIT WRITE commands only,
or for a PERMIT WRITE statement for the specified object.
Examples
The statement
SHOW uservar
The statement
DESCRIBE usercheck
The statement
DESCRIBE thisuser
The statement
SHOW thisuser
The statements
thisuser = 100
SHOW uservar
The statements
PERMITRESET luservar READ
SHOW uservar
POP
The POP command restores the status of a dimension (including the NAME
dimension), the status of a valueset, or the value of an option or single-cell variable
that was saved with a previous PUSH statement.
PUSH and POP are commonly used within a program to make changes to options and
dimension status that apply only during the program's execution. Afterward, the
options and status are the same as they were before the execution of the program.
Syntax
POP name1 [nameN]
Arguments
name
The name of a dimension, valueset, variable, or option that was specified in a previous
PUSH statement, whose saved value you want to restore.
Examples
For an example of using POP, see Example 10–85, "Saving and Restoring Values" on
page 10-144.
POPLEVEL
The POPLEVEL command (abbreviated PPL) restores all values saved with PUSH
commands that were executed since the last POPLEVEL statement specifying the same
marker.
You must use PUSHLEVEL to mark a starting point for a series of PUSH commands
before you can use POPLEVEL to restore the saved values. POPLEVEL itself marks the
end of the series. You can use POPLEVEL only within programs.
Syntax
POPLEVEL marker-expression [DISCARD]
Arguments
marker-expression
A text value used as a marker. This must be exactly the same as the value used in the
corresponding PUSHLEVEL statement to mark the start of a series of saved values
being popped.
DISCARD
Specifies that the pushed values for that level are discarded when you issue a
POPLEVEL statement. When you do not specify DISCARD, the values that were
pushed are used to reset the pushed objects.
Notes
Examples
To see a sample program using POPLEVEL, see the example for the PUSHLEVEL
command.
PROGRAM
The PROGRAM command enters completely new contents into a new or existing
program. When the program already has lines of code, Oracle OLAP overwrites them.
In order to use PROGRAM to enter the contents of a program object, the program
object definition must be the one most recently defined or considered during the
current session. When it is not, you must first use a CONSIDER statement to make it
the current definition.
An alternative to a PROGRAM statement is an EDIT PROGRAM statement, which is
available only in OLAP Worksheet. An EDIT PROGRAM statement opens an Edit
window in which you can add, delete, or change the specification for a program
object.
Syntax
PROGRAM [contents]
Arguments
contents
A text expression that is the OLAP DML statements that are the lines of the program.
You can use most OLAP DML statements within a program. For a discussion of
writing, compiling, and debugging OLAP DML programs, see Chapter 4, "OLAP DML
Programs".
The maximum number of lines you can have in a program is 4,000.When coding a
PROGRAM statement at the command line level, separate program lines with newline
delimiters (\n), or use the JOINLINES function as shown in "Program On the Fly" on
page 10-140.
Examples
To execute the units_goal_met program and store the return value in a variable
called success, you can use an assignment statement (SET).
success = units_goal_met('TENTS' 'BOSTON' 'JUN96' 2000)
TRAP ON haderror
LIMIT month TO FIRST 3
LIMIT product TO FIRST 3
LIMIT district TO ALL
REPORT grandtotals sales
haderror:
POP month product district
END
To include the salesrep program in your analytic workspace, you can execute the
following statement.
INFILE 'salesrep.inf'
You can create an input file from an existing program using an OUTFILE statement
PROPERTY
The PROPERTY command adds or deletes properties to the most recently defined or
considered object (see the DEFINE PROGRAM and CONSIDER commands). A
property is a named value that is associated with a given definition. You can assign
one or more properties to any type of definition. For example, you can assign a
property to an object so you know how many decimal places to use when preparing a
report on the object.
Syntax
PROPERTY { name value | DELETE {ALL | name} }
Arguments
name
A text expression that contains the name of the property. The property name can be
from 1 to 256 bytes long.
Important: Do not create your own properties with names that begin
with a $ (dollar sign). Properties with names beginning with a $
(dollar sign) are reserved for Oracle OLAP to use as "system"
properties that Oracle OLAP interprets in predetermined ways.
Property names have the TEXT data type, unless you include a Unicode escape
sequence in the value you specify for the name, or unless you explicitly convert the
value you specify to NTEXT (using the CONVERT or TO_NCHAR functions).
value
An expression that contains the value of the property. The property value can have
one of the following data types: NUMBER, INTEGER, LONGINTEGER, DECIMAL,
SHORTDECIMAL, TEXT, NTEXT, ID, BOOLEAN, DATE, or DATETIME. Oracle OLAP
determines the data type based on the value that you specify. For example, when you
specify YES, then Oracle OLAP assumes a type of BOOLEAN. When you specify a date
value that is stored in a variable of type DATE, then Oracle OLAP assumes a type of
DATE for the property.
DELETE ALL
DELETE name
Deletes either all of the properties of the object or only the property you specify for
name. You can specify only one name at a time.
Notes
Examples
PUSH
The PUSH command saves the current status of a dimension (including the NAME
dimension), the status of a valueset, or the value of an option or single-cell variable.
You can then restore these saved values and status at a later time with a POP
statement.
PUSH and POP are commonly used within a program to make changes to options and
dimension status that apply only during the program's execution. Afterward, the
options and status are the same as they were before the execution of the program.
Syntax
PUSH name1 [name]
Arguments
name
The name of a dimension, valueset, option, or variable whose status or value you want
to save.
Notes
Examples
DECIMALS = 0
LIMIT product TO 'Sportswear' 'Footwear'
LIMIT district TO 'Atlanta' 'Dallas'
LIMIT month TO 'Jan96' TO 'Jun96'
REPORT sales
cleanup:
POP DECIMALS product district month
END
PUSHLEVEL
The PUSHLEVEL command marks the start of a series of PUSH commands. You can
then use a corresponding POPLEVEL statement to restore all the values saved by
PUSH commands that are executed after PUSHLEVEL. POPLEVEL must specify the
same marker as the PUSHLEVEL statement that starts the series. You can use
PUSHLEVEL only within programs.
Syntax
PUSHLEVEL marker-expression
Arguments
marker-expression
A text value to mark the start of a series of PUSH commands all of whose saved values
are to be popped at once. A POPLEVEL statement that specifies the exact same
marker-expression restores the whole series of saved values.
Notes
You do not normally need more than one level in a single program. However,
Oracle OLAP automatically creates nested levels when one program calls another
program and each program contains a set of PUSHLEVEL and POPLEVEL
commands.
■ When you specify the same marker for two or more PUSHLEVEL commands, a
POPLEVEL statement specifying that same marker will restore values that were
saved only since the most recent PUSHLEVEL statement.
■ When you specify a different marker for two or more PUSHLEVEL commands, a
POPLEVEL statement that specifies the marker of any PUSHLEVEL statement
restores all the values that were saved since that statement, including values that
were saved after later PUSHLEVEL commands.
Examples
The level marker can be any text that is enclosed in single quotation marks. It can also
be the name of a single-cell ID or TEXT variable, whose value becomes the name of the
level marker. In the exit sections of the program, you can then use a POPLEVEL
statement to restore all the values you saved since establishing the firstlevel
marker.
POPLEVEL 'firstlevel'
Normally, you do not use more than one set of PUSHLEVEL and POPLEVEL
commands in a single program. However, the nesting feature comes into play
automatically when one program calls another program, and each program contains a
set of PUSHLEVEL and POPLEVEL commands.
PUSHLEVEL 'rpt1'
PUSH DECIMALS month
DECIMALS = 0
LIMIT month TO 'Jan96'
REPORT WIDTH 8 DOWN district WIDTH 9 ACROSS product: expense
PUSH product
LIMIT product TO 'Racquets' 'Sportswear'
PUSHLEVEL 'rpt2'
PUSH district
LIMIT district TO 'Atlanta' 'Dallas' 'Chicago'
REPORT DOWN district ACROSS product: sales
BLANK
STATUS month product district
BLANK
POPLEVEL 'rpt2'
STATUS month product district
BLANK
POPLEVEL 'rpt1'
RECAP
The RECAP command sends statements that were previously entered during the
current session to the current outfile or to a file that you specify. The statements are
copied from the command log, which is a list of up to 256 statements that you have
entered most recently during the current session.
Syntax
RECAP [number|ALL] [ 'search-text' ] [ FILE file-name ]
Arguments
number
A positive INTEGER that indicates the number of statements to be provided. When
you specify search-text, RECAP provides this number of statements from the subset
that contains the search-text string. When you do not specify search-text, RECAP
provides this number of statements from the most recently executed portion of the
command log. The default number is 10.
ALL
When you specify search-text, ALL requests every statement that meets the search
requirements. When you do not specify search-text, ALL requests every statement in
the command log.
search-text
A quoted text literal. When you specify this argument, RECAP searches the statements
in the command log for the ones that contain search-text. The search is not
case-sensitive. These statements will then compose the subset from which RECAP
provides number or ALL statements.
FILE file-name
Writes the output of a RECAP statement to the specified file For file-name specify a text
expression that is the name of the file to which output should be written. Unless the
file is in the current directory, you must include the name of the directory object in the
name of the file.
Note: Directory objects are defined in the database, and they control
access to directories and file in those directories. You can use a CDA
statement to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
Notes
Re-Executing Statements
You can use the output of RECAP to edit a previously executed statement with
REEDIT, or reexecute a previously executed statement with REDO.
Examples
REDO
The REDO command re-executes a statement that you entered earlier in your session.
The statement is retrieved from the command log, which is a list of up to 256
statements that you have entered most recently during the current session. REDO
enables you to changes in the statement before it is re-executed.
Syntax
REDO [number|index] 'original' 'replacement' [specifier]
Arguments
number
A positive INTEGER that indicates the number of the statement to be re-executed. You
can display the statements, with their numbers, using a RECAP statement.
index
A negative INTEGER or 0 (zero) that indicates the position of the statement to be
re-executed relative to the end of the command log. The most recent statement is 0, the
one before that is -1, and so on. The default is 0.
original
A text literal that is part of the statement to be re-executed.
replacement
A text literal that should replace original when the statement is re-executed.
specifier
One of the specifiers listed in Table 10–2, "Valid Values for REDO specifier". Each
specifier indicates where text replacement should occur in the re-executed statement.
The default is ALL. When you do not provide a specifier, all occurrences of original
will be changed to replacement.
Notes
Case-Sensitivity
When matching original with the text of the statement to be re-executed, REDO ignores
case differences. For example, assume you specify AT as original, REDO will match it
with at, At, aT, or AT in the statement.
When replacing original with replacement, REDO retains the case of all characters in
replacement. For example, assume you specify ShOw as replacement, that is exactly how
it will appear in the re-executed statement.
Examples
The following REDO statement re-executes the FETCH statement with a different
variable.
REDO 6 'actual' 'budget'
REEDIT
The REEDIT command edits a statement that you entered earlier in your session. The
statement is retrieved from the command log, which is a list of up to 256 statements
that you have entered most recently during the current session. REEDIT enables you
to change the statement without executing it, so you can edit it sequentially.
The REDO command is similar to REEDIT, except that the statement is executed after
you edit it.
Syntax
REEDIT [number|index] 'original' 'replacement' [specifier]
Arguments
number
A positive INTEGER that indicates the number of the statement to be edited. You can
display the statements, with their numbers, using a RECAP statement.
index
A negative INTEGER or 0 (zero) that indicates the position of the statement to be
edited relative to the end of the command log. The most recent statement is 0, the one
before that is -1, and so on. The default is 0.
original
A text literal that is part of the statement to be edited.
replacement
A text literal that should replace original when the statement is edited.
specifier
One of the specifiers listed in Table 10–3, " Valid Values for REEDIT specifier". Each
specifier indicates where text replacement should occur in the edited statement.
The default is ALL. When you do not provide a specifier, all occurrences of original
will be changed to replacement.
Notes
Case-Sensitivity
When matching original with the text of the statement to be edited, REEDIT ignores
case differences. For example, assume you specify AT as original, REEDIT will match it
with at, At, aT, or AT in the statement.
When replacing original with replacement, REEDIT retains the case of all characters in
replacement. For example, assume you specify ShOw as replacement, that is exactly how
it will appear in the edited statement.
Examples
The statement
REEDIT 6 '1' '2' FIRST
The statement
REEDIT 7 '15' '18'
The statement
REDO 8 '40' '41'
makes one more change and re-executes the LIMIT command with the new values. It
also produces the following output.
9: limit mydim to 2 to 10 , 18 to 20, 24 to 28, 33 to 41
REGRESS
The REGRESS command calculates a simple multiple linear regression. The optional
WEIGHTBY keyword lets you calculate a weighted regression when some of the data
points are more reliable than others.
You can then execute REGRESS.REPORT to produce a standard report of the
regression. You can also use the INFO function to obtain portions of the results for use
in your own customized reports or for further analysis.
Syntax
REGRESS [NOINTERCEPT] dependent independent... [WEIGHTBY weight]
Arguments
NOINTERCEPT
Directs Oracle OLAP to suppress the constant term (intercept) in the regression
equation. The default is to calculate a constant term.
dependent
An expression to be used as the dependent variable in the regression.
In calculating the results, REGRESS loops over all the dimensions of the dependent
and independent variables.
independent
One or more expressions to be used as the independent variables (regressors) in the
regression.
WEIGHTBY weight
Specifies a weighted regression. The numeric expression weight supplies the weights
for each data point (observation). Giving higher weights to more reliable observations
results in a higher quality regression. WEIGHTBY must come last in the REGRESS
command.
When weight is less than zero for any observation, an error occurs. When weight is
equal to zero for any observation, that observation is ignored in the calculation. When
WEIGHTBY is omitted, an unweighted regression is calculated.
Notes
Ignoring NA Values
In performing its calculations, the REGRESS command ignores any observation that
has an NA value.
REGRESS.REPORT
Obtaining Results
For information on how to obtain portions of the results of REGRESS for your own
reports or further analysis, use an INFO statement.
Examples
You can now execute REGRESS.REPORT as illustrated in Example 10–94, "Report for a
Simple Regression" on page 10-158 to see the results of the regression.
DISTRICT RELIABILITY
-------------- -----------
Boston 1.00
Atlanta 0.90
Chicago 1.00
Dallas 0.80
Denver 0.90
Seattle 0.60
You can now execute REGRESS.REPORT as illustrated in Example 10–94, "Report for a
Simple Regression" on page 10-158 to see the results of the regression.
REGRESS.REPORT
Syntax
REGRESS.REPORT
Examples
RELATION command
The RELATION command identifies a relation as the default relation for a specified
dimension of the current object; or removes the default relation information from the
current object. For more information on default relations, see "Using Related
Dimensions in Expressions" on page 2-27.
Syntax
RELATION {dimension-name relation-name }| DELETE { ALL | dimension-name}
Arguments
dimension-name
The name of a previously-defined dimension. The dimension specified by the
dimension-name argument must be a dimension of the currently considered object for
which you want to specify or delete a default relation.
relation-name
The name of a previously-defined relation that Oracle OLAP uses as the default
relation for the dimension specified by dimension-name.
DELETE
Specifies removal of previously-specified default relation information.
ALL
Removes all previously-defined default relation information.
Notes
b. When you have not specified a default relation using the RELATION
command, Oracle OLAP recognizes the first relation that you defined as the
default relation.
Examples
REPORT city_district
CITY CITY_DISTRICT
-------------------- --------------------
Annapolis Southern
Bethesda Southern
Charlotte Southern
Gettysburg Southern
Greensboro Southern
Raleigh Southern
Reston Southern
Rochester Southern
Virginia Beach Southern
Washington Capital
REPORT city_redistrict_1
CITY CITY_REDISTRICT_1
-------------------- --------------------
Annapolis Capital
Bethesda Capital
Charlotte Southern
Gettysburg Southern
Greensboro Southern
Raleigh Southern
Reston Southern
Rochester Southern
Virginia Beach Capital
Washington Capital
As the following OBJ statements illustrate, at this time the city_district relation
is the default relation between city and district since the city_district
relation was the first relation defined between city and districtt and a default
relation has not been specified using a RELATION statement.
SHOW OBJ (RELATION ACTUAL 'city' 'district')
CITY_DISTRICT
Assume that you now issue the following statements to limit district to Washington
and make the city_redistrict_1 relation the default relation.
Also, as the following statements illustrate, when you limit city to district, you get the
same results as limiting city to the city_redistrict_1 relation
LIMIT city TO district
REPORT city
CITY
--------------------
Annapolis
Bethesda
Virginia Beach
Washington
REPORT city
CITY
--------------------
Annapolis
Bethesda
Virginia Beach
Washington
RELEASE
Syntax
RELEASE objects
Arguments
objects
One or more variables, relations, valuesets, dimension names, or analytic workspace
names, separated by commas, that you want to release. Precede each analytic
workspace names with AW using the following syntax:
AW analytic workspace name
When you specify an analytic workspace in this list, all acquired objects in that
analytic workspace are released after all pending changes are made to them. All
changes made to the variables, relations, valuesets, or dimensions before a RELEASE
statement executes are preserved as private changes after the release statement.
Notes
... report
ACQUIRE RESYNC actuals, time WAIT
MAINTAIN time ADD 'Y2002'
actuals (time 'Y2002', ...) = 37
REPORT time --> ..., 'Y2002'
SHOW actuals (time 'Y2002', ...) --> 37
... report
REVERT time
REPORT time --> ... (no 'Y2002')
MAINTAIN time ADD 'Y2002'
... report
REPORT time --> ..., 'Y2002'
SHOW actuals (time 'Y2002', ...) --> NA
... report
Examples
Example 10–97 Two Users Modifying Different Objects in the Same Analytic Workspace
A classic use of multiwriter attachment mode is to allow two users to modify two
different objects in the same analytic workspace. For example, assume that an analytic
workspace has two variables: actuals and budget. Assume also that one user (user
A) wants to modify actuals, while another user (user B) wants to modify budget. In
this case, after attaching the analytic workspace in the multiwriter mode, each user
acquires the desired variable, performs the desired modification, updates, commits the
changes, and then, either detaches the workspace or releases the acquired variable.
User A executes the following statements.
AW ATTACH myworkspace MULTI
ACQUIRE actuals
... make modifications
UPDATE MULTI actuals
COMMIT
RELEASE actuals
AW DETACH myworkspace
User B2 gets budget and sees no changes and issues the following statements.
...
AW ATTACH myworkspace MULTI
ACQUIRE RESYNC budget WAIT
make changes C1
UPDATE
RELEASE budget
make changes C2
UPDATE
COMMIT
...
AW ATTACH myworkspace MULTI
ACQUIRE RESYNC budget WAIT
Alternatively, User B2 gets budget and sees changes C1 and issues the following
statements.
AW ATTACH myworkspace MULTI
ACQUIRE RESYNC budget WAIT
make changes C1
UPDATE
make changes C2
RELEASE budget
UPDATE
COMMIT
...
AW ATTACH myworkspace MULTI
ACQUIRE RESYNC budget WAIT
Or, as another alternative, User B2 gets budget and sees changes C1 and issues the
following statements.
AW ATTACH myworkspace MULTI
ACQUIRE RESYNC budget WAIT
make changes C1
UPDATE
make changes C2
UPDATE
COMMIT
RELEASE budget
...
AW ATTACH myworkspace MULTI
ACQUIRE RESYNC budget WAIT
RENAME
Syntax
RENAME oldname newname [AW workspace]
Arguments
oldname
The name of an existing object in an analytic workspace. You can specify a qualified
object name to indicate the attached workspace in which the object resides. As an
alternative, you can use the AW keyword to specify the workspace. Do not use both.
When you do not use a qualified object name or the AW keyword to specify an
analytic workspace, the object is renamed in the current workspace.
For an unnamed composite, use the same syntax that was used to create it. See
"Naming an Unnamed Composite" on page 10-165.
newname
The new name. The new name of an analytic workspace object cannot duplicate any
other name in the workspace in which the object exists. Choose a name according to
the rules for naming analytic workspace objects (see the main entry for the DEFINE
command. To change a named composite to an unnamed composite, use the SPARSE
keyword as the newname argument. See "Unnaming a Named Composite" on
page 10-166.
AW workspace
The name of an attached workspace in which you wish to rename the object. When
you do not use a qualified object name or the AW keyword to specify an analytic
workspace, the object is renamed in the current workspace.
Notes
Examples
REPORT
The REPORT command produces a formatted report for one or more data expressions.
REPORT automatically loops over the dimensions of the expression. REPORT sends
the output to the current outfile.
Syntax
REPORT [NOHEAD] [GRANDTOTALS] [[SUBTOTALS] {GROUP group-dimension}...] -
[[SUBTOTALS] [attributes] DOWN down-dimension] -
[[ROWTOTALS] { ACROSS across-dimension [limit-clause]: }... ] -
[SUBTOTALS] [attributes] expression(s)
Arguments
When you specify only the expression argument, REPORT produces a report with the
layout described in "Default Layout" on page 10-172. When you specify some but not
all of the dimensions of an expression in GROUP, DOWN, or ACROSS phrases,
REPORT follows the default layout as closely as possible with the unspecified
dimensions.
NOHEAD
Specifies that the report should contain no initial blank line and no headings.
NOHEAD overrides any HEADING arguments you specify for the attributes
argument, as well as suppressing all headings that the REPORT command normally
generates automatically.
GRANDTOTALS
Includes a grand total for each numeric column at the end of your report.
SUBTOTALS
Includes subtotals for numeric columns. A row of dashes precedes each row of
subtotals. When you specify SUBTOTALS for an expression or DOWN phrase, you get
subtotals for each GROUP dimension (or composite). When you specify SUBTOTALS
for a GROUP phrase, you get subtotals for the specified dimension and for any
slower-varying GROUP dimensions. The subtotals for a group appear at the bottom of
the last slice in the group.
GROUP
Produces a separate group, or two-dimensional slice, of the data for each value of
group-dimension. You can use the GROUP phrase more than once to specify more than
one GROUP dimension (or composite). In this case, you produce a separate slice for
each combination of the values of the GROUP dimensions.
group-dimension
The name of a dimension or composite from which to retrieve the values to use as
group labels, or one or more TEXT expressions that are the actual values you want to
use as group labels:
■ When group-dimension is the name of a composite or a conjoint dimension, Oracle
OLAP creates a separate group for each base dimension.
■ When group-dimension is a TEXT expression, the expression must be dimensioned
only by the desired GROUP dimension, and each value of the expression should
be descriptive text that corresponds to its associated dimension value.
The dimensions that you specify in a GROUP phrase are not required to be relevant to
the data they loop over. See "Specifying Extra Dimensions" on page 10-173.
DOWN
Specifies that the report includes row labels (that is, one or more columns on the left
side of your report that label the other values). You can have only one DOWN phrase.
down-dimension
The name of a dimension or composite from which to retrieve the values to use as row
labels, or one or more TEXT expressions that are the actual values you want to use as
row labels.
■ When down-dimension is the name of a non-conjoint dimension, REPORT produces
only one column of row labels.
■ When down-dimension is the name of a composite or a conjoint dimension, Oracle
OLAP creates a separate column for each base dimension.
■ When down-dimension is a TEXT expression, the expression must be dimensioned
only by the desired DOWN dimension, and each value of the expression must be
descriptive text that corresponds to its associated dimension value.
The dimensions that you specify in a DOWN phrase are not required to be relevant to
the data they loop over. See "Specifying Extra Dimensions" on page 10-173.
ROWTOTALS
Includes a column headed "TOTAL" at the right side of the report with a total for each
numeric row. Including a row total in your report does not imply either column
subtotals or a grand total.
ACROSS
Produces a row of column headings across the top of your report, one for each value in
dimension. Under each heading, REPORT produces a column of data for the data
expression you specify. You can have more than one ACROSS phrase (or composite)
in the report.
across-dimension
The name of a dimension or composite from which to retrieve the values to use as
column headings, or one or more TEXT expressions that are the actual values you
want to use as column headings.
■ When across-dimension is the name of a composite or a conjoint dimension, Oracle
OLAP creates a separate heading column for each base dimension.
■ When across-dimension is a TEXT expression, the expression must be dimensioned
only by the desired across-dimension, and each value of the expression should be
descriptive text that corresponds to its associated dimension value. For
information on providing formatted labels for a dimension of type DAY, WEEK,
MONTH, QUARTER, or YEAR, see "Formatting DAY, WEEK, MONTH,
QUARTER, and YEAR Dimension Values" on page 10-173.
The dimensions that you specify in an ACROSS phrase are not required to be relevant
to the data they loop over. See "Specifying Extra Dimensions" on page 10-173.
limit-clause
When you specify a dimension in the ACROSS phrase, the temporary status of that
dimension during the execution of the execution of the REPORT statement. (You
cannot include a limit-clause argument when you specify a composite in the ACROSS
phrase.)
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
When the limits you specify result in an empty status for the dimension, an error
occurs (regardless of the setting of the OKNULLSTATUS option). However, when you
include the phrase IFNONE label, the error is suppressed and execution of your
program branches to the specified label, where you can handle the error.
attributes
One or more format attributes from Table 10–4, " Formal Attributes for Data Values in
a Report" on page 10-169 that specify how to format the data. For information on
providing formatted labels for a dimension of type DAY, WEEK, MONTH, QUARTER,
or YEAR, see "Formatting DAY, WEEK, MONTH, QUARTER, and YEAR Dimension
Values" on page 10-173.
When you do not specify any attributes, Oracle OLAP formats the data values using
the default format described in "Default Layout" on page 10-172. In this case, Oracle
OLAP automatically determines the width of the columns, the number of decimal
places, whether commas are used to mark thousands in numeric values, and so on.
expression . . .
The data to be shown in the report. The way the data looks depends on its data type
and the attributes you specify.
You can specify more than one expression; the expressions do not have to have the
same dimensions:
■ When you have several data expressions in your REPORT statement, you can
specify different format attributes before each. When you want attributes to apply
to two or more data expressions, enclose the expressions in angle brackets (< >).
attributes <expression1, expression2>
■ Attributes outside the brackets apply to all the expressions within the brackets.
However, you can also specify attributes for only one of the expressions (even an
attribute that contradicts one that applies to the group) within the brackets by
including them immediately before the expression.
attributes0 <attributes1 expression1, expression2>
In this case, attributes0 applies to both expression1 and expression2; while attributes1
only applies to expression1.
Notes
Report Options
A number of options effect reports created using the OLAP DML. These options are
listed in "Report Options" on page 6-6.
Default Layout
When you do not specify any of the layout phrases (GROUP, DOWN, or ACROSS),
REPORT tries to format its output compactly. Normally, this means a two-dimensional
report of the data with one of the dimensions down the side and the other across the
top, much like a spreadsheet. Any additional dimensions of the data form "slices" or
separate two-dimensional segments, like a series of spreadsheets. By default, REPORT
uses the following rules to determine the layout:
■ The fastest-varying dimension in an expression (the one that appears first in the
definition of that expression) goes across, the next fastest goes down, and any
remaining dimensions become GROUP slices.
■ The order of dimensions in a list of two or more expressions is a simple
combination of the dimensions that appear in the definitions of the component
expressions. The original order is preserved as far as possible, subject to the rule
that repeated mentions of the same dimension are dropped. For example, the
dimensions of the combined variables price and industry.sales, where
price has the dimensions <month product> and industry.sales has the
dimensions <quarter product region>, are
<month product quarter region>.
When you produce a report of data for a variable dimensioned by a composite,
REPORT automatically breaks out the data by the base dimensions of the composite
that is used in the definition of the variable. When a particular combination of base
dimension values does not exist in the composite, the report shows NA for the
corresponding data cell. See Example 10–104, "Reporting Data Dimensioned by
Composites" on page 10-175.
When you use the default line width of 80 characters (determined by the LSIZE
option) and the default column width settings (with a single label column of 14
characters) a line of output can accommodate the labels column and six data columns.
The combined width of all the columns of a report cannot be greater than 4000
characters.
When a numeric value is too large to fit into a data column, REPORT rounds it off to
the nearest million with the symbol M at the right side of the cell. When a value is still
too large, REPORT replaces the value with a series of asterisks.
Examples
DISTRICT: Chicago
------------D.SALES-------------
-------------MONTH--------------
PRODUCT Jan96 Feb96 Mar96
RESYNC
Syntax
RESYNC objects
Arguments
objects
A list of one or more variables, relations, valuesets, or dimension names, separated by
commas, that you want to resynchronize. Oracle OLAP ignores any acquired objects in
this list.
Use Name as a value in objects to specify that you want to resynchronize the newest
objects defined by other users.
Notes
Examples
At the same time, user R could execute the following OLAP DML statements.
AW ATTACH myworkspace MULTI
...
RESYNC actuals
...
RESYNC actuals
...
RESYNC actuals
...
RETURN
Syntax
RETURN [expression]
Arguments
expression
The expression to be returned to the calling program when the called program
terminates.
Notes
Dimension Location
When the program returns values of a dimension, the dimension must be declared in
the same analytic workspace as the program. The program will be in the output of the
LISTBY program, and OBJ(ISBY) will be TRUE for the dimension.
No Return Value
When a program has been invoked as a function, but it does not provide a return
value, the value that is returned to the calling program is NA.
Examples
cleanup:
POP month
END
Now when you run the program without newfigures in the analytic workspace, the
program produces a message and the RETURN statement terminates execution of the
program at that point.
REVERT
The REVERT command drops all changes made to the specified objects since they
were last updated, resynchronized (using a RESYNC statement), acquired using
ACQUIRE with the RESYNC phrase, or since the analytic workspace was attached.
Syntax
REVERT objects
Arguments
objects
A list of the names, separated by commas, of acquired variables, valuesets, relations,
or dimensions in an analytic workspace attached in multiwriter mode or a list of
variables, valuesets, relations, or dimensions in an analytic workspace attached in
read-only mode.
Notes
Examples
ROW command
The ROW command produces a single line of data in cells, one after another in a single
row. A series of ROW commands that produce corresponding cells are often used to
build up columns of data. For this reason, we normally speak of the ROW command
as producing a line of columns. Output from the ROW command is sent to the current
outfile.
The ROW command is typically used in conjunction with other commands, functions,
and options that you can think of collectively as report-writing statements
The ROW command itself consists of a series of column descriptions that specify the
data to be produced and, optionally, the output format of the data.
In addition, ROW has a versatile capability for doing row and column arithmetic. It
can perform calculations and include the calculation results in the output. It can use
any kind of calculated expression in the column descriptions; and it can take
advantage of row and column totaling functions (see Table 10–6, " Row and Column
Arithmetic" on page 10-187).
ROW is primarily used in report programs to produce the lines of the report. The
maximum width of any row in a report is 4000 characters.
Tip: When you know ahead of time that you will not need the
subtotaling capability of the ROW command, using a HEADING
statement instead of ROW to produce the lines of your report can
provide a time savings, since Oracle OLAP will not be keeping track
of subtotals.
Syntax
ROW [attributes] [ACROSS dimension [limit-clause]:] {exp1|SKIP } -
[[attributes] [ACROSS dimension [limit-clause]:] {expn|SKIP }]
Arguments
ROW with no arguments produces a blank line.
attributes
One or more attributes for a column. Attributes are format specifications that
determine how the data value is formatted within the column. There is no limit to the
number of attributes that you can use to describe a column format. (See Table 10–5,
"Column Attributes for ROW" on page 10-185for an explanation of each of the
available attributes.) The default for some format attributes is determined by the
current setting of Oracle OLAP options (see Table 10–7, " Report-Related Options" on
page 10-187 for a list of these options).
ACROSS
An ACROSS phrase lets you include more than one value of a dimensioned expression
in a single row by looping over one of the dimensions (or composites) of the
expression. Normally ROW just shows the value that corresponds to the first
dimension value within the current limits. With an ACROSS phrase, ROW produces
one data column for each dimension value currently in the status.
You can apply a single ACROSS phrase to multiple data expressions, or you can use
separate ACROSS phrases for different data expressions. See "Multiple Expressions"
on page 10-189 and "Separate ACROSS Phrases" on page 10-189.
dimension
The name of a dimension or composite over which the statement loops.
When you show data for a variable dimensioned by a composite and you do not
include an ACROSS phrase, ROW shows output for all data cells that correspond to
the base dimension values of the composite. When a particular combination of base
dimension values does not exist in the composite, ROW shows NA for the
corresponding data cell. Likewise, when you specify one of the composite's base
dimensions in an ACROSS phrase, ROW shows NA for a data cell for which the
composite contains no value. However, when you specify a composite in the ACROSS
phrase, ROW shows output only for data cells for which combinations of base
dimension values exist in the composite. This provides a more concise report that
better reflects your data.
When the dimension specified in an ACROSS phrase has null status, ROW does not
produce any data columns for that ACROSS phrase.
limit-clause
When you specify a dimension in the ACROSS phrase, a clause that enables you to
temporarily change the status of that dimension during the execution of the ROW
statement.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the
various forms of the LIMIT command (that is, the syntax of the LIMIT command after
the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT
(using values) command, LIMIT using LEVELREL command, LIMIT command (using
parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT
command, and LIMIT command (using POSLIST).
The following example temporarily limits month to the last six values, no matter what
the current status of month is.
ACROSS month LAST 6: units
When the limits you specify result in empty status for the dimension, an error occurs.
However, when you include the phrase IFNONE label, the error is suppressed and
execution of your program branches to the specified label where you can handle the
error.
SKIP
Used in place of an expression to indicate that the column is to be left blank.
Use the functions that are listed in Table 10–6, " Row and Column Arithmetic" to
perform calculations on the values generated so far in a report.
RUNTOTAL(n) DECIMAL Total of all numbers generated in the current column since
the last SUBTOTAL or ZEROTOTAL for n. Does not reset
where:
total for n to 0.
n = 1,2, ...32
SUBTOTAL(n) DECIMAL Total of all numbers generated in the current column since
the last SUBTOTAL or ZEROTOTAL for n. Resets total for
where:
n to 0.
n = 1,2, ...32
The options that are listed in Table 10–7, " Report-Related Options" on page 10-187
affect the default format for a ROW command.
Use the statements that are listed in Table 10–8, " OLAP DML Statements That Are
Compatible with the ROW Command" with the ROW command.
Table 10–8 OLAP DML Statements That Are Compatible with the ROW Command
Command Action
BLANK n Produces n blank lines. The default is one line.
HEADING column- Produces titles and column headings for a report. Numeric
values in headings are not added to column totals.
description(s)
PAGE Forces a page break in output when PAGING is set to YES.
ZEROTOTAL Resets all 32 totals to 0 for all columns.
ZEROTOTAL ALL col(s) Resets all 32 totals to 0 for the specified columns, or for all
columns when there are no column arguments.
ZEROTOTAL n col(s) Resets the indicated total (n) to 0 for the specified columns, or for
all columns when there are no column arguments.
Notes
Report-Writing Commands
The ROW command and its associated options and commands are referred to
collectively as report-writing statements. Table 10–6, " Row and Column Arithmetic" on
page 10-187 lists functions you can use for performing row and column arithmetic in
reports. Table 10–7, " Report-Related Options" on page 10-187 lists report-related
options that determine the default format for ROW output. Table 10–8, " OLAP DML
Statements That Are Compatible with the ROW Command" on page 10-188 lists
additional statements that are used in combination with ROW to create reports.You
can use the PAGING option and associated paging-related options to produce your
report program in a page-oriented format.
Multiple Expressions
When you want the same format attribute or ACROSS phrase to apply to more than
one data expression, you can enclose the expressions in angle brackets (< >) and place
the common attributes or ACROSS phrase immediately before the bracketed
expressions.
attributes <expression1, expression2, ...>
or
ACROSS dimension: <expression1, expression2, ...>
When you have attributes that apply to only one of the expressions within the
brackets, place the specific attributes immediately before the expression.
attributes1 <expression1, attributes2 expression2>
When an attribute inside angle brackets (specific to a column) conflicts with an
attribute outside the brackets (common to several columns), the specific attribute
overrides the common attribute.
You can nest brackets to any depth, as long as you have an equal number of right and
left brackets.
Examples
SET
The SET command, also called an assignment statement or the = command, assigns
one or more values to a variable, option, relation, or dimension surrogate. When an
object has one or more dimensions, the SET command loops over the values in status
for each dimension of the target object and assigns a data value to the corresponding
cell of the target object.
When the target is an object defined with a composite in its dimension list, Oracle
OLAP automatically creates any missing target cells that are being assigned non-NA
values. This step also adds to the composite all the dimension value combinations that
correspond to those new cells. Thus, both the target object and the composite might be
larger after an assignment. When you want to assign values only to cells that already
exist in the target, use the ACROSS keyword.
Syntax
[SET] target-name [=] expression [ACROSS composite]
Arguments
SET
SET is optional. It is an older command form of this functionality, and is included for
compatibility.
target-name
The name of the target object where the data will be assigned and stored. For a list of
analytic workspace objects that can be a target object, see Table 10–9, " Using Objects in
Assignment Statements".
=
The = (assignment or equal) operator assigns one or more values to a variable, option,
or relation. See also "Assignment Operator" on page 2-20.
expression
The source of the data values to be assigned to the object, see Table 10–9, " Using
Objects in Assignment Statements"
ACROSS composite
When you are assigning data to a variable dimensioned by a composite the default
behavior is to loop over all the values in status for each of the base dimensions of the
object. Oracle OLAP automatically creates any missing target cells that are being
assigned non-NA values, and it automatically adds the required dimension value
combinations to the composite.
When you want to assign values only to existing cells of a variable defined with a
composite, use the ACROSS keyword, which causes = to change the way it loops for
those dimensions of the target that are part of the composite. Instead of looping over
all possible combinations of the values in the status of those dimensions, = loops only
over those combinations of the values in the status that already exist in the composite.
The ACROSS keyword is intended for specifying a composite. However, when you
specify a base dimension of the composite instead, be aware that the assignment
statement could add many values to your composite.
Notes
produces the following output, in which each line of the value in textvar is shown as
a separate line.
This is a variable
that has a multiline
text value.
To assign this value to a variable called fixedtext with a fixed width of 60 bytes and
show the value, you would use the following statements.
fixedtext = JOINCHARS(textvar)
SHOW fixedtext
These statements produce the following output, in which the value of textvar is
shown as a single line.
This is a variable that has a multiline text value.
When the actual number of bytes in the textvar variable's value exceeds the width of
the fixedtext variable, then the value of textvar will be truncated when it is
stored in fixedtext.
assignment statement, a loop is performed over the values in status for each
dimension of the target relation and assigns a data value to the corresponding cell of
the target relation.
You can assign values to a relation with a text dimension by assigning one of the
following:
■ A text value of the dimension.
■ An INTEGER that represents the position of the dimension value in the default
status list of the dimension.
STORENAME(STORE_ID 100)
-------------------------
Molly's Emporium
For example, when you define the INTEGER dimension surrogate intsurr for a
NUMBER dimension numdim that has five values, then a report of intsurr produces
the following.
INTSURR
-------
1
2
3
4
5
not already have a value in the cell associated with Boston, Tents, and Jan99, then
the value is assigned to the cell and thus it is added to the variable. When a value
already exists in the cell, the value 10200 overwrites the previous value.
sales(market 'Boston' product 'Tents' month 'Jan99')= 1020
For example, assume that item.org is a conjoint dimension with base dimensions
item and org. In this case, you use the following format to refer to values of
item.org.
'<Expenses, Direct Sales>'
Specifying DAY, WEEK, MONTH, QUARTER, YEAR Values for a Model Equation
When a model equation is based on a dimension of type DAY, WEEK, MONTH,
QUARTER, or YEAR, you must use the dimension's VNF (value name format), rather
than a date format, to specify the dimension's values. In addition, the VNF must
format dimension values as follows:
■ The value must start with a letter.
■ The value can only contain letters, digits, underscores, and periods.
When the WEEK, MONTH, QUARTER, YEAR dimension of type does not have a VNF
assigned to it, you can use the default VNF for the dimension. The entry for the VNF
command lists the default VNF for each of these dimension types, and it explains how
to assign a VNF to a dimension.
The default VNF for DAY dimensions is not acceptable because it specifies a digit as
the first character of each dimension value. For a DAY dimension, specify the
dimension name and enclose the value in parentheses and single quotes.
For example, for a DAY dimension named daydim, you can use the following format.
daydim('01jul97')
When the model is based on more than one dimension, the model compiler might not
be able to correctly identify the dimension to which a literal INTEGER value belongs.
In this case, specify the name of the dimension and enclose the value in parentheses
and single quotes as described in "Formatting Ambiguous Dimension Values" on
page 10-196.
Formatting Ambiguous Dimension Values In some cases the model compiler might
be unable to correctly identify the dimension to which a dimension value belongs. For
instance, this can happen under the following circumstances:
■ Two or more dimensions have a dimension value with the same name.
■ A DAY dimension uses the default VNF (which starts with a digit).
■ An INTEGER value could be interpreted either as a position within a dimension or
as a literal INTEGER value of a dimension.
Examples
Suppose you initialize the choicedesc variable using the following statement.
choicedesc = JOINCHARS ('Description for ' choice)
Now all of the choicedesc cells of the variable contain the appropriate values.
CHOICE CHOICEDESC
-------------- -------------------------
Report Description for Report
Graph Description for Graph
Analyze Description for Analyze
Data Description for Data
Quit Description for Quit
The next example shows an expression that is dimensioned by time, product, and
district and is assigned to a new variable. The expression calculates a 2002 sales
plan based on unit sales in 2001.
DEFINE units.plan INTEGER <month product district>
LIMIT month TO 'DEC02'
units.plan = LAG(units 12 month) * 1.15
parentrel that contains values that represent the child-parent relationships in the
Geography hierarchy.
DEFINE geog DIMENSION TEXT
DEFINE geog_parentrel RELATION geog <geog>
You can use the following MAINTAIN ADD statements to populate the hierarchical
dimension.
" Populate the geog dimension with values for all levels
MAINTAIN geog ADD 'North America' 'Europe' 'United States' 'Canada' 'France'
'Germany'
MAINTAIN geog ADD 'Massachusetts' 'California' 'Quebec' 'Ontario'
MAINTAIN geog ADD 'Boston''Springfield' 'San Francisco''Los Angeles' 'Toronto'
'Ottawa'
MAINTAIN geog ADD 'Montreal''Quebec City' 'Paris' 'Marseilles' 'Bonn' 'Berlin'
" Limit geog (and therefore geog_parentrel) to states or provinces and assign
" parent value (country name) to those states or provinces in geog_parentrel
LIMIT geog to ALL
LIMIT geog to 'Massachusetts' 'California'
geog_parentrel = 'United States'
LIMIT geog to ALL
LIMIT geog to 'Quebec' 'Ontario'
geog_Chapter 9, "OLAP DML Commands: A-G" = 'Canada'
COLWIDTH = 20
REPORT geog_parentrel
REPORT geog_parentrel
GEOG GEOG_PARENTREL
---------------- --------------------
North America NA
Europe NA
United States North America
Canada North America
France Europe
Germany Europe
Massachusetts United States
California United States
Quebec Canada
Ontario Canada
Boston Massachusetts
Springfield Massachusetts
San Francisco California
Los Angeles California
Toronto Ontario
Ottawa Ontario
Montreal Quebec
Quebec City Quebec
Paris France
Marseilles France
Bonn Germany
Berlin Germany
The ACROSS keyword is particularly helpful when the source expression is a single
value. When there are no limits on the dimensions of sparse_sales, then an
assignment statement like the following creates cells for every combination of
dimension values because there are no cases where the source expression is NA.
sparse_sales = 0
Oracle OLAP automatically creates the unnamed composite when you define
sales.compact, and it automatically adds dimension value combinations to the
composite when you use an assignment statement. Oracle OLAP creates dimension
value combinations only for the non-NA values of sales.
SET1
The SET1 command assigns a single value to a variable, option, relation, or dimension
surrogate. When an object has one or more dimensions, the SET1 command assigns
the value to the object cell that is in current status.
Since the SET1 command does not loop through a dimensioned object, you can use it
in Assign trigger programs to assign a value to an object.
Syntax
SET1 target-name = expression
Arguments
target-name
The name of the target object where the data will be assigned and stored. For a list of
analytic workspace objects that can be a target object, see Table 10–9, " Using Objects in
Assignment Statements".
expression
The source of the data values to be assigned to the object, see Table 10–9, " Using
Objects in Assignment Statements"
Examples
For an example of using SET1, see Example 10–163, "Setting Values in an ASSIGN
Trigger Program" on page 10-268.
SHOW
The SHOW command shows a single value of an expression. Normally, you would
use SHOW to show the value of a single-cell variable or to show a message. SHOW is
useful in programs when you want to generate an error-like message without creating
an error condition. The output from SHOW is sent to the current outfile.
Syntax
SHOW expression [NONL]
Arguments
expression
The value you want to show. When expression is dimensioned, only the first value of
the expression is shown, based on the current status of its dimensions. When you are
showing a text literal, you must enclose the value in single quotes.
NONL
Indicates that a new line sequence should not be appended to the end of the value. By
default, SHOW appends a new line sequence.
Notes
will produce an NA value when the combination of the current values of market and
product does not exist in the composite.
Examples
When you want to produce a warning message without branching to an error label,
then you can use a SHOW statement.
select:
LIMIT month TO nummonths
IF STATLEN(month) GT 9
THEN DO
SHOW 'You can select no more than 9 months.'
GOTO finish
DOEND
REPORT DOWN district W 6 units
finish:
POP month
RETURN
SIGNAL
Syntax
SIGNAL {errname [message]|STOP}
Arguments
errname
A TEXT expression that indicates the name of the error message to be produced. When
Oracle OLAP executes a SIGNAL statement, it stores the errname in the ERRORNAME
option. Normally, the name of the error does not appear in the error message.
However, when you omit message, the error name (errname) will appear along with a
stock message as described in the message argument.
You can use the special name PRGERR to communicate to a calling program that an
error has occurred. The statement SIGNAL PRGERR sets ERRORNAME to a blank
value and passes an error condition to the calling program without causing another
error message to be displayed. For a complete explanation of how to use SIGNAL to
pass an error up a chain of nested programs, see the TRAP command.
message
A TEXT expression that specifies the error message to be produced. When you supply
a long line as your error message, you must add your own line breaks to format the
text. Type the newline escape sequence (\n) where you want each line to end. You can
type up to a limit of 6 lines or 4000 characters, whichever you reach first. An error
occurs when you try to supply a single line longer than 4000 characters.
When you omit this argument, SIGNAL produces the following message.
ERROR: (errname) Please contact the administrator of your
Oracle Oracle OLAP application.
STOP
Immediately stops execution of all currently running programs. No error message is
produced. The error condition is not trapped by an active TRAP label.
Examples
The following program lines check for the argument and signal an error when it is not
found.
IF ARGS EQ ''
THEN SIGNAL msg1 'You must supply an argument.'
SLEEP
Within an OLAP DML program, the SLEEP command suspends the program
execution for at least the specified number of seconds.
Syntax
SLEEP n
Arguments
n
A numeric expression that specifies the number of seconds for Oracle OLAP to "sleep."
Program execution will be suspended for at least this number of seconds.
Examples
SORT command
The SORT command arranges the order of values in the current status list of a
dimension or a dimension surrogate, or in a valueset.
Syntax
SORT dimension [byhierarchy] [bycriterion...]
where:
■ byhierarchy is an optional phrase that uses a parent relation to arrange the order of
values in the current status list of a hierarchical dimension or its dimension
surrogate, or to assign values to a valueset, based on family relationships within
the hierarchy. You can include only one byhierarchy phrase in a SORT statement. It
must be the first phrase in a SORT statement.
HIERARCHY parent-relation [INVERT] [DEPTH n] [SORTORPHANS]
■ bycriterion uses an explicit criterion to arrange the order of values in the current
status list of a dimension or its dimension surrogate, or to assign values to a
valueset. You can include as many bycriterion phrases as you want in a SORT
statement.
{A|D} [NAFIRST] criterion
Arguments
dimension
A text expression whose value is the name of a dimension, a dimension surrogate, or a
valueset.
HIERARCHY
Specifies that Oracle OLAP is to sort dimension values based on the values position in
parentrel.
parent-relation
Specifies the name of a child-parent self-relation for dimension. For each dimension
value, the relation holds another value of the dimension which is its parent dimension
value (the one immediately above it in a given hierarchy). This parent relation can
have more than one dimension.
INVERT
Indicates that Oracle OLAP places the children in the hierarchy before their parents.
(By default, children are placed after their parents.)
DEPTH n
Specifies the number of generations down from the top of the hierarchy that Oracle
OLAP should place into status and. there, for the values that are included in the result.
The default value of n is 99. When you do not want any values in the result (that is,
when you want a NULL status), specify -1 for n. When you only want the top of the
hierarchy in status (that is, those dimension values that do not have parents), specify
0 (zero).
SORTORPHANS
Specifies that all first cousins whose parents are not in status are sorted together. By
default, Oracle OLAP preserves the hierarchical structure when sorting children even
when their parents are not in status.
A
D
The order in which the values are to be sorted. A means ascending order (alphabetical
when the sorting criterion is TEXT, ID, or a relation), and D means descending order
(reverse alphabetical when the sorting criterion is TEXT, ID or a relation).
NAFIRST
Specifies that NA values are to placed first in the sort rather than last.
criterion
The expression to be used as a sorting criterion. Each criterion must be dimensioned by
dimension. The first expression is the major sorting criterion. When the expression is
multidimensional, SORT uses the first value in status for all dimensions other than the
dimension being sorted. You cannot use a valueset as the sorting criterion.
Notes
Sorting Alphabetically
To sort a TEXT or ID dimension or its valueset in alphabetical order, use the
dimension itself as the sorting criterion.
SORT district A district
Sorting a Worksheet
You cannot use a worksheet as a sort criterion. You must first use CONVERT to
specify the data type to which values of the worksheet should be converted.
Examples
The preceding statement produces the following report that reflects the work of the
SORT statement.
PRODUCT: Tents
--------MONTH--------
--------JUL96--------
DISTRICT Region SALES
-------------- ---------- ----------
Dallas Central 154,914.23
Chicago Central 79,934.42
Atlanta East 140,711.00
Boston East 93,972.49
Seattle West 123,700.17
Denver West 100,413.49
In the following SORT statement, CONVERT is used to keep the regions in their
original order.
SORT district A CONVERT(region.district INTEGER) D sales
The preceding statement produces the following report that reflects the work of the
last SORT statement.
PRODUCT: Tents
--------MONTH--------
--------JUL96--------
DISTRICT Region SALES
-------------- ---------- ----------
Atlanta East 140,711.00
Boston East 93,972.49
Dallas Central 154,914.23
Chicago Central 79,934.42
Seattle West 123,700.17
Denver West 100,413.49
When you want the dimension to keep the sorted order of its values permanently, use
a MAINTAIN statement after you sort the dimension.
SORT district A district
MAINTAIN district MOVE VALUES(district) FIRST
<District: Boston>
<District: Chicago>
<District: Dallas>
<District: Denver>
<District: Seattle>
<Region: Central>
<Region: East>
<Region: West>
If you issue a REPORT statement for sales when all of the values of geog are in
status, Oracle OLAP produces the following report. This report displays the values for
geog in the order in which they were added to the analytic workspace.
REPORT sales
--------SALES--------
--------TIME---------
GEOG 2004 2005
-------------- ---------- ----------
USA 1,300 NA
Massachusetts 3,881 NA
Florida 3,479 NA
Boston 2,644 NA
Orlando 4,398 NA
Miami 3,294 NA
Pembroke 4,268 NA
California 1,899 NA
Texas 2,115 NA
Los Angeles 2,394 NA
San Francisco 1,334 NA
Dallas 839 NA
Houston 997 NA
However, assume that you issue a SORT statement to sort the values of geog by (1)
geogparent and (2) descending by sales. After this sort if you issue a REPORT
statement for sales, Oracle OLAP produces the following report. This report displays
the values for geog with the states in descending order by sales, but with the cities
of each state under the appropriate state.
SORT geog HIERARCHY geogparent D sales
REPORT SALES
--------SALES--------
--------TIME---------
GEOG 2004 2005
-------------- ---------- ----------
USA 1,300 NA
Massachusetts 3,881 NA
Pembroke 4,268 NA
Boston 2,644 NA
Florida 3,479 NA
Orlando 4,398 NA
Miami 3,294 NA
Texas 2,115 NA
Houston 997 NA
Dallas 839 NA
California 1,899 NA
Los Angeles 2,394 NA
San Francisco 1,334 NA
--------SALES--------
--------TIME---------
GEOG 2004 2005
-------------- ---------- ----------
USA 1,300 NA
Pembroke 4,268 NA
Boston 2,644 NA
Orlando 4,398 NA
Miami 3,294 NA
Texas 2,115 NA
Houston 997 NA
Dallas 839 NA
California 1,899 NA
Los Angeles 2,394 NA
San Francisco 1,334 NA
SQL
The SQL command passes instructions written in Structured Query Language (SQL) to
the relational manager from Oracle OLAP. Using the SQL command, you can insert
and update data in relational tables, retrieve data from relational tables into analytic
workspace objects, and execute stored procedures.
To use the SQL command, you must be familiar with SQL syntax and with the data
structures in your relational database, and have the appropriate access rights to the
relational tables that you want to use.
This entry describes the OLAP DML SQL command in general, and subsequent entries
discuss the use of the OLAP DML SQL command for specific SQL statements:
■ SQL CLEANUP
■ SQL CLOSE
■ SQL DECLARE CURSOR
■ SQL EXECUTE
■ SQL FETCH
■ SQL IMPORT
■ SQL OPEN
■ SQL PREPARE
■ SQL PROCEDURE
■ SQL SELECT
Syntax
SQL sql-statement
Arguments
sql-statement
For sql-statement you can specify most SQL statements that can be executed
dynamically, as well as several associated non-dynamic statements. You can also
specify PROCEDURE for a stored procedure as described in SQL PROCEDURE. A
SQL statement cannot exceed 128K bytes including the values of all non-textual OLAP
DML input expressions.
You cannot specify the following SQL statements for sql-statement:
■ COMMIT -- To commit your changes, issue the OLAP DML COMMIT statement.
■ ROLLBACK -- You cannot rollback using the OLAP DML. When you specify SQL
ROLLBACK, you receive an error message stating that ROLLBACK is not supported
as an argument to an OLAP DML SQL statement.
Oracle OLAP evaluates some SQL statements before sending them to the relational
manager. For example, Oracle OLAP evaluates SQL PREPARE and SQL EXECUTE,
and SQL statements that copy data from relational tables into analytic workspace
objects (See "Copying Relational Data into Analytic Workspace Objects" on
page 10-215 for a list of these statements).
Notes
Tip: SQL FETCH offers the most functionality; while SQL IMPORT
offers improved performance when copying large amounts of data
from relational tables into analytic workspace object.
Error Checking
Oracle OLAP can detect some syntax errors in the arguments to the SQL statement,
but most errors are detected by the Oracle RDBMS. Error codes and messages are
returned to Oracle OLAP. You should check the value of SQLCODE after each SQL
statement to determine when it resulted in an error. When it does cause an error (that
is when SQLCODE EQ -1), check the value of SQLERRM for information about the
cause of the error.
Converting Oracle RDBMS Data Types into Oracle OLAP DML Data Types
Table 10–10, " RDBMS Data Type Conversion to OLAP DML Data Types" on
page 10-216 shows which Oracle RDBMS data types can be automatically converted
into Oracle OLAP DML data types. You must explicitly convert or cast other data
types in the SELECT statement within a SQL DECLARE CURSOR statement.
Table 10–10 RDBMS Data Type Conversion to OLAP DML Data Types
Oracle RDBMS Data Type OLAP DML Dimension Type OLAP DML Variable Data Type
CHAR, NCHAR, NVARCHAR2, TEXT [WIDTH n], ID, TEXT, NTEXT
VARCHAR2 NTEXT
NUMBER NUMBER, INTEGER, NUMBER, INTEGER, BOOLEAN,
SHORTINTEGER, SHORTINTEGER,
LONGINTEGER LONGINTEGER, DECIMAL,
SHORTDECIMAL
CLOB (only within SQL TEXT TEXT
FETCH and SQL SELECT
statements)
Table 10–10 (Cont.) RDBMS Data Type Conversion to OLAP DML Data Types
Oracle RDBMS Data Type OLAP DML Dimension Type OLAP DML Variable Data Type
NCLOB (only within SQL NTEXT NTEXT
FETCH and SQL SELECT
statements)
DATE - DATE, DATETIME
Examples
SQL CLEANUP
The SQL CLEANUP command cancels all SQL cursor declarations and frees the
memory resources for all SQL cursors. You use the SQL CLEANUP command in
combination with other SQL commands to copy data from relational tables into
analytic workspace objects as outlined in "Copying Relational Data into Analytic
Workspace Objects" on page 10-215
Syntax
SQL CLEANUP
Examples
For an example of the use of SQL CLEANUP, see Example 10–140, "Fetching Data into
a Concat Dimension" on page 10-231.
SQL CLOSE
The SQL CLOSE command closes a SQL cursor. You use the SQL OPEN command in
combination with other SQL commands to copy data from relational tables into
analytic workspace objects as outlined in "Copying Relational Data into Analytic
Workspace Objects" on page 10-215.
Syntax
SQL CLOSE cursor
Arguments
cursor
The name of a cursor previously opened with a SQL OPEN statement.
Notes
The SQL DECLARE CURSOR command defines an explicit SQL cursor by associating
it with a SELECT statement or procedure. The SELECT statement specifies the scope of
the data (the rows and columns) selected by the cursor. You use the SQL DECLARE
CURSOR command in combination with other SQL commands to use an explicit
cursor to copy data from relational tables into analytic workspace objects as outlined
in "Copying Relational Data into Analytic Workspace Objects" on page 10-215.
Two pseudo procedures, SQLTABLES and SQLCOLUMNS, allow you to obtain
information about tables and columns.
Syntax
SQL DECLARE cursor CURSOR FOR {select-statement [FOR UPDATE]|table-info}
where table-info is one of the following:
PROCEDURE SQLTABLES [owner, table]
PROCEDURE SQLCOLUMNS [owner, table, column]
Arguments
cursor
The name of the cursor you are defining. Cursor names can consist of 1 to 18
alphanumeric characters or the symbols @, _, $, or #. A name that contains symbols @,
$, or # must be enclosed in single quotes. The first character cannot be a number or an
underscore. Cursor names are internal to Oracle OLAP. Unless you have issued a SQL
CLEANUP statement, when you try to declare a cursor with the same name as a
previously declared cursor, but with a different SQL SELECT statement, an error is
signaled.
select-statement
A SQL SELECT statement that identifies the data you want to associate with the
cursor. For the syntax of an SQL SELECT statement, refer to Oracle Database SQL
Language Reference.
Tip: Since both OLAP DML syntax and SQL syntax allow you to use
AND and OR, you should construct the clause clearly so that Oracle
OLAP can identify the end of an OLAP DML input expression. Use
parenthesis to clarify the syntax in these situations and when using a
SQL operator that is unknown in Oracle OLAP.
FOR UPDATE
Indicates that SQL FETCH will be used to write data to the table. This clause is
required when the cursor will be used in an UPDATE statement with a WHERE
CURRENT OF cursor clause. The names of the columns to be updated can be listed in
an OF clause (for example, FOR UPDATE OF COL1, COL2, COL3).
PROCEDURE SQLTABLES
When declaring a cursor for use by SQL FETCH, calls the pseudo procedure
SQLTABLES, which returns the following values for each table that matches the search
criterion as illustrated in Example 10–132, "Discovering Information About Relational
Tables" on page 10-223:
■ tableowner -- A text value identifying the owner of the table.
■ tablename -- A text value identifying the name of the table.
■ tabletype -- A text value identifying the type of table using one of the following:
TABLE, VIEW, SYSTEM TABLE, ALIAS, SYNONYM, LOCAL TEMPORARY,
GLOBAL TEMPORARY, or NA (indicating an unrecognized type).
When declaring a cursor for use by SQL IMPORT, you cannot use this clause.
PROCEDURE SQLCOLUMNS
When declaring a cursor for use by SQL FETCH, calls the pseudo procedure
SQLCOLUMNS, which returns the following values for each column that matches the
search criterion as illustrated in Example 10–133, "Discovering Information About the
Columns of a Relational Table" on page 10-223:
■ tableowner -- A text value identifying the owner of the table.
■ tablename -- A text value identifying the name of the table.
■ colname -- A text value identifying the name of the column.
■ coltype -- A text value identifying the data type of the column.
■ olaptype -- A text value identifying the data type that most closely matches coltype.
■ length -- An INTEGER value identifying the length of column values.
■ precision -- An INTEGER value identifying the precision of numeric column values.
■ scale -- An INTEGER value identifying the scale of column values.
■ nullable -- A text value of Y or N indicating whether the column can contain null
values.
When declaring a cursor for use by SQL IMPORT, you cannot use the PROCEDURE
SQLCOLUMNS clause.
owner
Literal text or the name of an OLAP DML variable whose value specifies one or more
owners. This expression acts as a filter to limit the results to only tables belonging to
the specified owners. The keyword NULL or an OLAP DML variable with an NA value
causes all table owners to be included in the results.
The expression can be specific, such as 'SCOTT', or it can contain wildcard characters
such as 'S%T' (all owners whose name begins with S and ends with T). The value
retains its case when it is passed to the database, so be sure to enter the value with the
appropriate use of upper- and lowercase letters. For example, Oracle relational
databases by default store all values in uppercase and will not match 'scott' or
'Scott' with 'SCOTT'.
table
Literal text or the name of an OLAP DML variable whose value specifies one or more
tables. This expression acts as a filter to limit the results to only tables with the
specified names. The keyword NULL or an OLAP DML variable with an NA value
causes all tables to be included in the results.
column
Literal text or the name of an OLAP DML variable whose value specifies one or more
columns. This expression acts as a filter to limit the results to only columns with the
specified names. The keyword NULL or an OLAP DML variable with an NA value
causes all tables to be included in the results.
The expression can be specific, such as 'SALARY', or it can contain wildcard
characters such as 'SAL%' (all columns whose name begins with SAL). The value
retains its case when it is passed to the database, so be sure to enter the value with the
appropriate use of upper- and lowercase letters. For example, Oracle relational
databases by default store all values in uppercase and will not match 'salary' or
'Salary' with 'SALARY'.
Notes
Optimizing Fetches
When fetching values into a multidimensional input variable, list the columns that
correspond to the dimensions in an ORDER BY clause in the select-statement argument
of a SQL DECLARE CURSOR statement, with the slowest-varying dimension first.
This will optimize performance.
Examples
SQL EXECUTE
The SQL EXECUTE command executes SQL statements that have been compiled using
SQL PREPARE. Typically, the SQL statements that you precompile are statements that
will be executed repeatedly, particularly those involving OLAP DML input
expressions, such as INSERT, UPDATE, and DELETE.
Note: The SQL PREPARE and SQL EXECUTE commands can only
be used within the same DML program.
Syntax
SQL EXECUTE statement-name
Arguments
statement-name
The name that you assigned to the executable code when you prepared it using SQL
PREPARE.
Examples
SQL FETCH
The SQL FETCH command retrieves and processes data specified by a named SQL
cursor. SQL FETCH assigns the retrieved data to OLAP objects. You use the SQL
FETCH command in combination with other SQL commands to copy data from
relational tables into analytic workspace objects as outlined in "Copying Relational
Data into Analytic Workspace Objects" on page 10-215.
Syntax
SQL FETCH cursor [LOOP [loopcount]] -
INTO :targets... [THEN action-statements...]
where:
■ targets is one or more of the following:
[MATCH] dimension|surrogate
APPEND [position] dimension
ASSIGN surrogate
variable | qualified data reference | relation | composite
Arguments
cursor
The name of a declared and opened cursor.
LOOP
Specifies that Oracle OLAP should implicitly loop over the rows obtained from a
relational table. For each row, Oracle OLAP copies the data in individual fields to
objects specified as target analytic workspace objects. When you include a LOOP
clause, SQL FETCH will continue processing rows until it reaches the end of the active
set specified by the cursor, or an error occurs, or loopcount is satisfied. In most cases,
you should use the LOOP clause to improve the performance of SQL FETCH.
When you do not specify a LOOP clause and the cursor contains more than one row in
its active set, you must code the SQL FETCH statement within a WHILE loop. This
loop must be based on the value of the SQLCODE option, which returns a nonzero
value to indicate the end of the data or an error.
loopcount
Optional INTEGER argument to the LOOP keyword. Loopcount controls how
SQL FETCH will loop over the rows from a relational table. Loopcount can be a literal
value, an OLAP DML variable, or NA. When loopcount is less than or equal to zero, no
looping occurs and no data is fetched.
When you specify a LOOP clause without a value for loopcount, SQL FETCH will
continue reading rows and copying their contents to target analytic workspace objects
until there are no more rows or an error occurs. Internally, each row is processed until
SQLCODE is nonzero.
When you specify a literal value for loopcount, SQL FETCH will process the number of
rows specified by loopcount or until SQLCODE is nonzero.
When you specify a variable for loopcount, it must be in the form of an OLAP DML
variable (preceded by a colon). This variable acts as both an input and an output
variable. The initial value of loopcount specifies the number of rows that SQL FETCH
will attempt to process. Upon completion of the SQL FETCH, loopcount contains the
number of rows actually processed.
When you specify NA for loopcount, SQL FETCH will process rows until SQLCODE is
nonzero. However, upon completion of the SQL FETCH, loopcount will contain the
number of rows actually processed.
targets
Identifies the analytic workspace objects in which you want to store data that is
retrieved from a relational table. This list of target analytic workspace objects must
correspond in number and data type with the list of table columns specified in the
select-statement argument of the SQL DECLARE CURSOR command that declared
cursor. A target can be a variable, a qualified data reference, a relation, a dimension, a
composite, or a conjoint.
A target must be preceded by a colon. When the target is a dimension, it can include
the MATCH and APPEND keywords to specify dimension handling; in this case, the
colon precedes the keywords.
[MATCH] {dimension|surrogate}
(Default) Oracle OLAP does not perform dimension maintenance on the target
dimension or surrogate. It uses the incoming values to align data that is being fetched
into dimensioned objects. When a value from the relational database does not match
any value in the dimension or surrogate, an error is signaled.
■ LAST
Any new values are added to the end of the status list.
The position can also be used to control how dimension values are processed in action
statements.
ASSIGN surrogate
Assigns the values to the specified surrogate.
THEN action-statements...
Specifies any number of action-statements to be performed each time a row of data is
fetched and assigned to target analytic workspace objects. An action-statement can be
one of the following:
assignment-statement
IF statement
SELECT-statement
ACROSS statement: action-statement
<action-statement-group>
Refer to the SQL IMPORT command for a complete description of the syntax of
action-statements.
Notes
To fetch data into a variable var2 dimensioned by a composite whose dimensions are
dim1 and dim2, you would specify the following list of target analytic workspace
objects.
:dim1 :dim2 :var2
Null Values
A null value in SQL is equivalent to an NA value in Oracle OLAP, so null values
fetched into target analytic workspace objects are given NA values. Since Oracle OLAP
handles null values in this way, the SQL command does not support INDICATOR
variables in the INTO clause of a SQL FETCH statement. When fetching null values
into a dimension, however, Oracle OLAP discards the values for the entire row.
Examples
Example 10–135 Fetching Data From Relational Tables -- A Simple SQL FETCH
he following program fragment shows the basic steps of declaring and opening a
cursor, and fetching the data. Relational data from the Prod_ID and Prod_Name
columns of the Products table are fetched into the prod dimension and prod_
label variable. The variable prod_label is dimensioned by prod. Notice that the
SQL FETCH statement in this example does not include a LOOP clause; it therefore
retrieves a single row of data each time it is called.
VARIABLE set_price SHORT
set_price = 20
...
SQL DECLARE highprice CURSOR FOR SELECT Prod_ID, Prod_Name -
FROM Products WHERE suggested_price > :set_price
SQL OPEN highprice
WHILE SQLCODE EQ 0
SQL FETCH highprice INTO :prod, :prod_label
Example 10–136 Fetching Data From Relational Tables with a THEN Clause
The following program fragment shows the SQL FETCH statement from the previous
example with the addition of the LOOP keyword and a THEN clause. Because of the
LOOP keyword, this SQL FETCH statement does not need to run within a WHILE
loop. The action statement following the THEN keyword copies any product names
stored in prod_label that start with the letter A into a multiline text variable called
a_product.
SQL FETCH highprice LOOP INTO :prod, :prod_label -
THEN IF UPCASE(EXTCHARS(prod_label, 1, 1)) EQ 'a' -
THEN a_product = JOINLINES(a_product prod_label)
Example 10–138 Populating Data While Maintaining Base and Conjoint Dimensions
To retrieve current values for the base and conjoint dimensions, or to retrieve the
values for the first time, you can fetch the values for the base dimensions immediately
before you fetch the values for the conjoint dimension. In the following example, the
SQL DECLARE CURSOR and SQL FETCH commands have been edited to fetch both
base and conjoint dimension values. Notice that the number of columns selected from
the relational table must match the number of base dimensions fetched. There are six
column specifications in the SELECT statement. The first three match the three base
dimensions, and the last three match the conjoint dimension itself.
SQL DECLARE c1 CURSOR FOR -
SELECT Mktcode, Prdcode, Percode, Mktcode, -
Prdcode, Percode FROM Sqldba.Data
...
SQL FETCH c1 LOOP INTO :APPEND market, :APPEND product, -
:APPEND time, :APPEND mpt
Example 10–139 Populating Variables with Relational Table Data while Maintaining
Dimensions
In the next example, variable dollars.mpt is dimensioned by the conjoint mpt, and
its values are populated in the same SQL FETCH statement with the dimension values.
The SQL DECLARE CURSOR and SQL FETCH commands have been edited again
with the new column and target analytic workspace object added.
DEFINE dollars.mpt DECIMAL <mpt>
SQL DECLARE c1 CURSOR FOR -
SELECT Mktcode, Prdcode, Percode, Mktcode, Prdcode, -
Percode, Dollars FROM Sqldba.Data
...
SQL FETCH c1 LOOP INTO :APPEND market, :APPEND product, -
:APPEND time, :APPEND mpt, :DOLLARS.mpt
Assume that you write a program named get_products_hier that consists of the
following code.
' get_products_hier Program
ALLSTAT
" Fetch values into the products hierarchy
SQL DECLARE grabprods CURSOR FOR SELECT prod_total, -
prod_category, -
prod_subcategory, -
prod_id -
FROM sh.products
SQL OPEN grabprods
SQL IMPORT grabprods INTO :APPEND aw_products_all -
:APPEND aw_prod_category -
:APPEND aw_prod_subcategory -
:APPEND aw_prod_id
The get_products_hier program copies the data from the dimension tables into
the base dimensions of the aw_products concat dimension using SQL FETCH
commands with the APPEND keyword. As the base dimensions of aw_products are
populated, Oracle OLAP automatically populates aw_products, itself. As the THEN
clause of the SQL FETCH statement executes, Oracle OLAP fetches data into the
child-parent self-relation for aw_products. This program also populates the aw_
supplier_id dimension and its relation.
SQL IMPORT
The SQL IMPORT command retrieves and processes data specified by an explicit SQL
cursor. SQL IMPORT assigns the retrieved data to OLAP objects. You use the SQL
IMPORT command in combination with other SQL commands to copy data from
relational tables into analytic workspace objects as outlined in "Copying Relational
Data into Analytic Workspace Objects" on page 10-215. SQL IMPORT is particularly
effective in copying fact data from relational tables into analytic workspace variables.
Note: You cannot transfer data with the following data types:
LONG, BLOB, and BFILE.
Syntax
SQL IMPORT cursor [:var-num-of-rows |num-of-rows[:var-num-of-processed-rows]]-
INTO :targets... [THEN action-statements...]
where:
■ targets is one or more of the following:
MATCH | MATCHSKIPERR [position] {dimension | surrogate | valueset | relation}
APPEND dimension
ASSIGN surrogate
variable | relation | qualified data reference
Arguments
cursor
The name of a declared cursor.
var-num-of-rows
The name of a variable that specifies the number of rows that you want SQL IMPORT
to attempt to import.
num-of-rows
A numerical constant that specifies the number of rows that you want SQL IMPORT to
attempt to import.
var-num-of-processed-rows
When you include the MATCHSKIPERR keyword in the targets parameter, the name
of a variable that specifies the actual number of rows that you want SQL IMPORT to
import into analytic workspace objects.
targets
Identifies the analytic workspace objects in which you want to store data that is
retrieved from a relational table. This list of target analytic workspace objects must
correspond in number and data type with the list of table columns specified in the
select-statement argument of the SQL DECLARE CURSOR command that declared
cursor. A target can be a variable, a qualified data reference, a relation, a dimension, or
a composite.
MATCH
(Default) Oracle OLAP does not copy values from the corresponding relational table
column into the target dimension or surrogate. It merely uses the values to align data
that is being fetched into dimensioned objects. When a value from the relational
database does not match any value in the dimension, an error is signaled.
MATCHSKIPERR
Oracle OLAP does not copy values from the corresponding relational table column
into the target dimension or surrogate. It merely uses the values to align data that is
being fetched into dimensioned objects. When a value from the relational database
does not match any value in the dimension, the value is ignored and processing
continues without signaling an error.
position
The one-based logical position of the value.
APPEND
Oracle OLAP performs dimension maintenance on the target dimension, adding new
values from the corresponding relational table column to the dimension. It uses both
old and new dimension values to align data being fetched into dimensioned objects.
New values are added to the end of a dimension.
ASSIGN
Oracle OLAP assigns the corresponding relational value to the specified surrogate.
dimension
The name of the analytic workspace dimension.
surrogate
The name of an analytic workspace surrogate.
valueset
The name of the analytic valueset.
relation
The name of the analytic workspace relation.
variable
The name of a variable.
qualified_data_reference
A QDR is a qualifier that limits one or more of the dimensions of a variable or a
relation to a single value. Oracle OLAP evaluates QDRs in a SQL IMPORT statement,
as follows:
■ When the QDR includes an expression, the expression is evaluated only once
before the data is retrieved. In other words, the expression is, in essence, a
constant.
■ When the QDR is specified as a relation name, the values of the QDR vary
depending on the status of the dimensions of that relation.
THEN action-statements...
Specifies any number of action-statements to be performed each time a row of data is
imported and assigned to analytic workspace objects. Action statements may contain
simple assignment statements, conditional assignment statements, and assignments
across dimensions.
Action statements allow you to examine and manipulate the fetched data on a
row-by-row basis. For example, you may want to specify temporary objects as analytic
workspace objects and only update your permanent objects once you have performed
certain actions on the row of fetched data. However, action statements do not have to
reference the imported data. For example, one of your action statements might be an
assignment statement that executes a user-defined function (that is, a program) that
performs complex processing and then simply increments a counter.
A THEN clause can improve SQL loading performance by eliminating the need for
postprocessing upon completion of a SQL IMPORT.
In your list of action statements, be sure to process dimensions before variables. Oracle
OLAP processes each action statement from left to right for each row in the relational
table. When an action statement performs dimension processing, the resulting status
remains in effect for subsequent action statements. When you do not first specify
action statements that limit a variable's dimensions, Oracle OLAP uses the first value
in status to target a cell in the variable. Unless you specify an ACROSS phrase, Oracle
OLAP assigns a single value from a row to a single cell in an Oracle OLAP variable. By
default, Oracle OLAP does not loop over a variable's dimensions when assigning data
to the variable.
assignment-statement
An assignment statement (SET) that assigns a value that is the result of an expression
to an Oracle OLAP object.
IF-statement
An IF...THEN...ELSE command that performs some action depending on whether a
Boolean expression is TRUE or FALSE.
SELECT-statement
A SQL SELECT statement lets you perform some action based on the value of an
expression. A SELECT statement has the following form.
SELECT select-expression
[WHEN expression1 action]
[WHEN expression2 action . . .]
[ELSE action]
SELECT evaluates the SELECT expression and then sequentially compares the result
with the WHEN expressions. When the first match is found, the associated action
occurs. When no match is found, the ELSE action (if specified) occurs.
ACROSS-statement: action-statement
An ACROSS statement causes the following action statement to execute once for every
value in status of the ACROSS dimension. When you want the looping to apply to
more than one action statement, enclose the action statements in angle brackets. An
ACROSS statement has the following form.
ACROSS dimension [limit]:
action-statement
In an ACROSS statement, limit temporarily change the status of dimension, as long as
you are not in a FOR loop over dimension. The new status is in effect only for the
duration of the SQL FETCH statement. The format of limit is as follows.
[ADD|COMPLEMENT|KEEP|REMOVE|TO] limit-clause
To specify the temporary status, insert any of the LIMIT command keywords (the
default is TO) along with an appropriate list of dimension values or related
dimensions. You can use any valid limit clause (see the LIMIT command for further
information). The following example limits month to the last six values, no matter
what the current status of month is.
ACROSS month last 6: units
<action-statement-group>
You can group several action statements together by enclosing them in angle brackets.
An action-statement-group has the following form.
<action-statement1 -
[action-statement2 . . .]>
A typical use for action statement groups is after an ACROSS statement. With the
angle bracket syntax, you can cause more than one action statement to execute for
every value in status of the ACROSS dimension.
Notes
Examples
SQL OPEN
The SQL OPEN command activates an explicitly-declared SQL cursor. When the
cursor is opened, SQL examines any OLAP DML input expressions used in the
definition of the specified cursor, determines the cursor's result set, and leaves the
cursor in the open state for use by SQL FETCH or SQL IMPORT. The cursor is
positioned before the first row of the result set.
You use the SQL OPEN command in combination with other SQL commands to copy
data from relational tables into analytic workspace objects as outlined in "Copying
Relational Data into Analytic Workspace Objects" on page 10-215.
Syntax
SQL OPEN cursor
Arguments
cursor
The name of a cursor previously declared in the same program. You cannot use
ampersand substitution.
Examples
SQL PREPARE
Within a program, the SQL PREPARE command precompiles a SQL statement for
later execution, in the same program using SQL EXECUTE. Typically, you use SQL
PREPARE in programs to optimize the processing of SQL statements that will be
executed repeatedly, particularly those involving OLAP DML input expressions, such
as INSERT, UPDATE, and DELETE.
Syntax
SQL PREPARE statement-name FROM sql-statement [insert-options]
Arguments
statement-name
A name that you assign to the executable code produced from sql-statement. You can
redefine statement-name just by issuing another SQL PREPARE statement.
sql-statement
The SQL statement that you want to precompile for more efficient execution. It cannot
contain ampersand substitution or variables that are undefined when the program is
compiled.
insert-options
The following options are optional when sql-statement is an INSERT statement:
DIRECT=YES|NO specifies if the insert is a direct-path INSERT. This option must be the
first option specified right aver the values phrase of the INSERT statement.
Setting this option to YES specifies that the insert will be a direct-path INSERT.
Direct-path INSERT enhances performance during INSERT operations and is similar
to the functionality of Oracle's direct-path loader utility, SQL*Loader.
The default value is NO which specifies a normal INSERT.
NOLOG=YES|NO specifies if logging occurs. Setting this option to YES specifies that the
redo information is not recorded in the redo log files which makes load-time faster.
The default value is NO which specifies logging mode.
PARTITION=(sub)partition-name specifies that only the segments related to the named
partition or subpartition are locked. When you specify this option, another session can
insert data to unrelated segments in the same table. When you do not specify this
option (the default), other sessions cannot insert data into the same table.
Notes
Additionally, the general restrictions that apply to using direct-path INSERT in SQL
apply to preparing a direct-pathINSERT using OLAP DML PREPARE statements:
■ The target table cannot be index organized or clustered.
■ The target table cannot contain object type or LOB columns.
■ The target table cannot have any triggers or referential integrity constraints
defined on it.
For more information on restrictions when using a direct-path INSERT, see the
discussion of the INSERT statement in Oracle Database SQL Language Reference.
Data Type Conversions During Direct-Path Insertion Table 10–11, " Automatic Data
Type Conversion During Direct-Path Insertion" on page 10-240 shows the automatic
data type conversion performed during direct-path insertion.
Inserting OLAP Text Data into a Column with a DATE Data Type When inserting text
data from Oracle OLAP into a column with a DATE data type, you must use the
default date format of DD MMM YY. You can use slashes (/) or hyphens (-) as separators,
as well as spaces. When the data is in a different format, you can use the Oracle TO_
DATE function in a SQL INSERT statement.
Inserting Large Text Values into a CLOB or NCLOB Column To insert more than 2K
bytes of text data from an analytic workspace into a CLOB or NCLOB column, use the
WIDE keyword before the name of the OLAP DML input expression. When the data
type of the OLAP DML input expression is TEXT, then the target data type is CLOB.
When the data type of the input expression is NTEXT, then the target data type is
NCLOB.
The following is the syntax of an OLAP DML input expression with the WIDE
keyword. See Example 10–145, "Using the WIDE Keyword" on page 10-241 for an
example.
:WIDE input-expression
See Example 10–145, "Using the WIDE Keyword" on page 10-241 for an example.
Note that the target table must conform to these guidelines:
■ Any number and combination of CLOB and NCLOB columns
■ No LONG columns
The RDBMS imposes some restrictions on large data types. Oracle OLAP will not
signal an error when you violate these restrictions. However, you might get
unexpected results. Refer to the Oracle Application Developer's Guide for restrictions on
large data types.
This formula counts the extra carriage return and line feed characters that Oracle
OLAP inserts between lines when passing the text to the database.
Examples
When a statement includes OLAP DML input expressions and will be executed
repeatedly, such as in a FOR loop, you can make the statements more efficient by
"preparing" the SQL statement first. The INSERT statement becomes part of a
PREPARE statement.
SQL PREPARE s1 FROM INSERT INTO Sales VALUES -
(:Salesperson, :Dollars) DIRECT=YES
FOR Salesperson
DO
SQL EXECUTE s1
IF SQLCODE NE 0
THEN BREAK
DOEND
Like the INSERT statement in the previous example, an UPDATE statement should be
used in a PREPARE statement and executed in an ACROSS statement or FOR loop.
SQL PREPARE s2 FROM UPDATE mkt -
SET Sales=:mkt.sales WHERE s.market=:market
ACROSS market DO 'SQL EXECUTE s1'
SQL PROCEDURE
Note: You can also create SQL stored procedures using the OLAP
DML. See:
■ "Creating SQL Procedures using the OLAP DML" on page 10-242
■ Example 10–146, "Creating a Stored Procedure" on page 10-242
Syntax
SQL PROCEDURE procedure-name (parameters)
where parameters is one or more of the following, separated by commas:
sql-parameter
:dml-parameter
Arguments
procedure-name
The name of the SQL stored procedure.
sql-parameter
The name of a variable in the RDBMS.
:dml-parameter
An OLAP DML expressions such as a OLAP DML variable. See "Using OLAP DML
Expressions in OLAP DML SQL Statements" on page 10-216 for more information on
using OLAP DML expressions in OLAP DML SQL statements.
Notes
Examples
SQL SELECT
The SQL SELECT command uses an implicit cursor to copy data from relational tables
into analytic workspace objects. You use the SQL SELECT command to copy data from
relational tables into analytic workspace objects using an implicit cursor. You can also
use copy the data using an explicit cursor using the OLAP DML commands outlined
in "Copying Relational Data into Analytic Workspace Objects" on page 10-215.
Syntax
SQL SELECT expressions FROM tables -
[WHERE predicates] [GROUP BY expressions] -
[ORDER BY expressions] [HAVING predicates] -
INTO :targets... [THEN action-statements...]
where targets is one or more of the following:
[MATCH] dimension|surrogate
APPEND [position] dimension
ASSIGN surrogate
variable|qualified data reference|relation|composite
Arguments
SELECT expressions FROM tables-
[WHERE predicates] [GROUP BY expressions] -
[ORDER BY expressions] [HAVING predicates]
A SQL SELECT statement that identifies the data you want to associate with the
cursor. For the syntax of an SQL SELECT statement, refer to Oracle Database SQL
Language Reference.
targets
Identifies the analytic workspace objects in which you want to store data that is
retrieved from a relational table. This list of target analytic workspace objects must
correspond in number and data type with the list of table columns specified in the
SELECT statement. A target can be a variable, a qualified data reference, a relation, a
dimension, or a composite.
A target must be preceded by a colon. When the target is a dimension, it can include
the MATCH and APPEND keywords to specify dimension handling; in this case, the
colon precedes the keywords.
Tip: Since both OLAP DML syntax and SQL WHERE clauses allow
you to use AND and OR, you should construct the targets clause
clearly so that Oracle OLAP can identify the end of an OLAP DML
input expression.
[MATCH] {dimension|surrogate}
(Default) Oracle OLAP does not perform dimension maintenance on the target
dimension or surrogate. It uses the incoming values to align data that is being fetched
into dimensioned objects. When a value from the relational database does not match
any value in the dimension or surrogate, an error is signaled.
ASSIGN surrogate
Assigns the values to the specified surrogate.
THEN action-statements
You may optionally include a THEN clause to specify any number of action-statements
to be performed each time a row of data is fetched and assigned to analytic workspace
objects. An action-statement can be one of the following:
assignment-statement
IF-statement
SELECT-statement
ACROSS-statementaction-statement
<action-statement-group>
Refer to the SQL IMPORT command for a complete description of the syntax of
action-statement.
Notes
Optimizing Copies
When copying values from relational tables into a multidimensional input variable,
list the columns that correspond to the dimensions in an ORDER BY clause in the
select-statement argument of the SQL SELECT statement, with the slowest-varying
dimension first. This will optimize performance.
Examples
Assume also that your analytic workspace contains the following definitions for
corresponding analytic workspace objects.
DEFINE aw_prod_id DIMENSION NUMBER (6)
DEFINE aw_cust_id DIMENSION NUMBER (6)
DEFINE aw_date DIMENSION TEXT
DEFINE aw_channel_id DIMENSION TEXT
DEFINE aw_promo_id DIMENSION NUMBER (6)
DEFINE aw_sales_dims COMPOSITE <aw_prod_id aw_cust_id -
aw_channel_id aw_promo_id>
DEFINE aw_sales_quantity_sold VARIABLE NUMBER (3) <aw_date aw_sales_dims -
<aw_prod_id aw_cust_id aw_date aw_channel_id aw_promo_id>>
DEFINE aw_sales_amount_sold VARIABLE NUMBER (10,2) <aw_date aw_sales_dims -
<aw_prod_id aw_cust_id aw_date aw_channel_id aw_promo_id>>
To copy the data for product 415 from the sales table into the analytic workspace
objects, you execute the following statement in the OLAP worksheet.
SQL SELECT prod_id cust_id time_id channel_id promo_id quantity_sold -
amount_sold WHERE prod_id = 415 -
INTO :aw_prod_id, :aw_cust_id, :aw_date, -
:aw_channel_id, :aw_promo_id, :aw_sales_quantity_sold, :aw_sales_amount_sold
STATUS
The STATUS program sends to the current outfile the status of one or more
dimensions, dimension surrogates, or valuesets, or the status of all dimensions in an
analytic workspace.
When you specify one or more dimension, dimension surrogate, or valueset names,
Oracle OLAP produces the status of only those objects. When you use the AW
keyword and specify the name of an attached analytic workspace, Oracle OLAP
produces the status of every dimension in that analytic workspace. When you do not
specify any argument, STATUS produces the current status of all the dimensions (not
dimension surrogates or valuesets) in the current analytic workspace. However,
STATUS does not display the status of the NAME dimension unless you specify
STATUS NAME.
Tip: Use STATLIST rather than STATUS when you want to control
the width or placement of the display.
Return Value
TEXT
Syntax
STATUS name... | AW [workspace-name]
Arguments
name
The name of a dimension or valueset in the analytic workspace. You can also specify
the name of a dimensioned analytic workspace object, such as a variable, formula,
relation, or named composite. In this case, the status of each dimension of name is
produced, unless the dimension is included in an unnamed composite.
AW [workspace-name]
Specifies that STATUS should produce the status of every dimension in
workspace-name; workspace-name is the name of an analytic workspace.
Notes
STATUS Output
When all values of a dimension are in the current status or in a valueset, in the original
order, STATUS displays ALL. STATUS shortens any series of three or more values in
their original order to value-1 TO value-n. In the case of the dimension NAME, however,
STATUS does not shorten a series of three or more values.
Examples
STDHDR
The STDHDR program generates the standard Oracle OLAP heading at the top of
every page of report output.
The standard running page heading consists of two lines. The first line includes the
date and time on the left and the page number on the right. The second line is blank.
The heading output is sent to the current outfile.
Syntax
STDHDR
Notes
Setting LSIZE
LSIZE must be set to a value of at least 29 before you use STDHDR. Otherwise the
heading will not look right. A value less than 26 produces an error. The default for
LSIZE is 80.
Examples
BLANK
END
In your report program, set PAGING to YES, and specify the preceding program to
execute after every page break by setting the PAGEPRG option to 'REPORT.HEAD'
(see the PAGEPRG option for further information). When you run the report, each
page will contain the following combination of the standard heading and your custom
heading.
18Jan97 15:05:16 PAGE 1
SWITCH command
The SWITCH command provides a multipath branch in a program. The specific path
taken during program execution depends on the value of the control expression that is
specified with SWITCH. You can use a SWITCH statement only within programs.
Note: Do not confuse the use of a single SWITCH command with the
use of SWTICH as a conditional operator in an expression. See
"SWITCH Expressions" on page 2-44.
Syntax
SWITCH control-expression
DO
CASE case-expression1:
statement 1.1
...
statement 1.n
BREAK
CASE case-expression2:
statement 2.1
...
statement 2.n
BREAK
[DEFAULT:
statement n.1
...
statement n.n
BREAK]
DOEND
Arguments
control-expression
The control-expression argument determines the case label to which program control is
transferred by the SWITCH statement. When the SWITCH statement is executed,
control-expression is evaluated and compared with each of the CASE label expressions
in the program. When a match is found, control is transferred to that case label. When
no match is found, control transfers to the DEFAULT label (if present) or to the
statement following the DOEND for SWITCH.
program control is transferred to that CASE label. The CASE label expressions are
evaluated at the time the program is run, in the order they appear, until a match is
found.
The DEFAULT label is optional. It identifies a special case to which control should be
transferred when none of the case-expressions matches the control-expression. When you
omit DEFAULT, and no match is found, control is transferred to the statement that
follows the DOEND for SWITCH.
All the CASE labels (including DEFAULT) for a SWITCH statement must be included
within a DO/DOEND bracket immediately following the SWITCH statement. Because
case-expression is a label, it must be followed by a colon (:). The statements to be
executed in a given case must follow the label. Normally, the last statement in a case
should be BREAK, which transfers control from SWITCH to the statement that follows
the DOEND for SWITCH.
When you omit BREAK (or RETURN, SIGNAL, and so on) at the end of a case, the
program will go on to execute the statements for the next case as well. Normally, you
do not want this to happen. However, when you plan to execute the same statements
for two cases, you can use this to your advantage by placing both CASE labels before
the statements.
Notes
Transferring Control
While BREAK is commonly used to transfer program control within a SWITCH
statement, it is not the only such statement you can use. You can also use statements
such as CONTINUE, GOTO, RETURN, and SIGNAL. Keep in mind that you can use
CONTINUE only when the SWITCH statement is within a FOR or WHILE loop. See
also the entries for these statements and for DO ... DOEND.
Examples
TEMPSTAT
The TEMPSTAT command limits the dimension you are looping over, inside a FOR
loop or inside a loop that is generated by a REPORT statement. Status is restored after
the statement following TEMPSTAT. When a DO ... DOEND phrase follows
TEMPSTAT, status is restored when the matched DOEND or a BREAK or GOTO
statement is encountered. You can use TEMPSTAT only within programs.
Syntax
TEMPSTAT dimension...
statement block
Arguments
dimension(s)
One or more dimensions whose status you would like to temporarily change inside a
FOR loop or an automatic loop that is generated by the REPORT statement.
statement block
One or more statements that change the status of the dimension. To execute more than
one statement under the temporary status, enclose them between DO ... DOEND
brackets.
Notes
Placement of TEMPSTAT
When you want to be able to change the status of a dimension while REPORT is
looping over it, you must place a TEMPSTAT statement inside that REPORT loop
rather than before the REPORT statement. For example, suppose you have written a
user-defined function called monthly_sales, which changes the status of month,
and monthly_sales is part of a REPORT statement that is looping over month. In
this case a TEMPSTAT statement must be inside the monthly_sales function in
order for a status change to take place. This is true even when the REPORT statement
is given within TEMPSTAT DO/DOEND brackets within a FOR loop over MONTH.
Examples
TRACKPRG
The TRACKPRG command tracks the performance cost of every program that runs
while you have tracking turned on. To get meaningful information from TRACKPRG,
your session must be the only one running in Oracle OLAP. Furthermore, the accuracy
of the results of TRACKPRG decreases as more processes are started on the host
computer.
You turn TRACKPRG on, run the programs you want to track, and use TRACKPRG
again to obtain the results. Each time each program is executed, TRACKPRG stores its
cost data as one entry in its tracking list. When you execute another program, a new
entry is added to the list, which is maintained in Oracle OLAP memory (free storage).
A program or line of code is considered to have a high performance cost when it takes
a long time to execute. Use TRACKPRG to identify programs that have relatively high
costs and then use a MONITOR statement to identify the time-consuming lines within
those programs. When you wish, you can use both commands simultaneously.
Syntax
TRACKPRG {ON|OFF|file|INIT}
where file has the following syntax:
FILE [APPEND] [file-name]
Arguments
ON
Starts looking for programs to be run so it can gather their timing data in a tracking
list. (Continues the current tracking process without interruption when tracking is
already on, or resumes with a gap when tracking is off.)
OFF
Stops tracking programs and freezes any timing data currently in the tracking list. This
lets you immediately, or later in your session, send the list to the current outfile or to a
text file.
FILE
Specifies where to send the tracking list. TRACKPRG FILE has no effect on the
tracking list, so you can send the same list repeatedly to different destinations.
APPEND
Specifies that Oracle OLAP adds the tracking list to the contents of the file indicated by
file-name instead of replacing it.
file-name
A text expression to which Oracle OLAP sends the data. Unless the file is in the
current directory, you must include the name of the directory object in the name of the
file.
Note: Directory objects are defined in the database, and they control
access to directories and file in those directories. You can use a CDA
statement to identify and specify a current directory object. Contact
your Oracle DBA for access rights to a directory object where your
database user name can read and write files.
When you omit file-name, Oracle OLAP sends the timing data currently in the tracking
list to the current outfile
INIT
Discards the timing data in the current tracking list and releases the Oracle OLAP
memory that was used for that list (useful when you want the memory for other
purposes). Also, when tracking is on, resumes waiting for you to run programs so it
can gather their data into a completely new tracking list.
Notes
Single Execution
Each entry (that is, line) in the tracking list focuses on a single execution of a single
program.
Entry Sections
In TRACKPRG output, each entry (line) is divided into the following four sections:
■ Program name, in character columns 1 through 38
■ Exclusive time, in columns 39 through 49
■ Inclusive time, in columns 50 through 60
■ Name of calling program, in columns 61 through 77
Here is a sample of TRACKPRG output (for the MAIN program) with column
numbers included for reference.
1234567890123456789012345678901234567890123456789012345678901234567890
TRACKREPORT Program
When you want to use Oracle OLAP reporting capabilities to produce a report from
the timing data in the text file that is created by TRACKPRG, you can use the
TRACKREPORT program. It has the following syntax.
TRACKREPORT textfile-name
The textfile-name argument is the file name of the text file created by TRACKPRG from
which you want to generate a report. TRACKREPORT uses a FILEREAD statement to
read the data into an Oracle OLAP variable, and then it uses Oracle OLAP reporting
capabilities to produce a report like the following sample.
Exclusive Inclusive Number of
Program name cost cost calls
____________________ __________ __________ __________
When you want to further process the data from a TRACKPRG file, you can write
your own program using the TRACKREPORT program as a model.
Excluded Subprograms
When you do not want separate performance data on all the subprograms called by
the program you are timing, you can, within the overall program, turn tracking off
before calling any subprograms you want to exclude and then turn it back on before
calling any you want to include. You can do this repeatedly. Remember, however, that
the time taken by any excluded subprograms is assigned to the total "exclusive" time
for the overall program as well as to its "inclusive" time, since TRACKPRG has not
individually tracked the excluded subprograms.
Examples
TRAP
Within an OLAP DML program, the TRAP command causes program execution to
branch to a label when an error occurs in a program or when the user interrupts the
program. When execution branches to the trap label, that label is deactivated.
Syntax
TRAP {OFF|ON errorlabel [NOPRINT|PRINT]}
Arguments
OFF
Deactivates the trap label. Since only one trap label can be active at a time, you do not
supply errorlabel when setting TRAP OFF. When you try to include a label with OFF,
an error occurs.
ON errorlabel
Activates the trap label (errorlabel). When TRAP is active, any error in the program will
cause execution to branch to errorlabel.
errorlabel
The name of a label elsewhere in the program constructed following the "Guidelines
for Constructing a Label" on page 9-303. Execution of the program branches to the line
directly following the specified label.
NOPRINT
PRINT
Indicates whether to suppress output of the error message. NOPRINT suppresses the
message. PRINT (default) means that the error message is sent to the current outfile
before execution branches to the trap label. With the OFF keyword, NOPRINT and
PRINT are meaningless and produce an error.
Examples
haderror:
POP month DECIMALS LSIZE PAGESIZE
SIGNAL ERRORNAME ERRORTEXT
When you use the PRGERR keyword in the SIGNAL statement, no error message is
produced, and the name PRGERR is not stored in ERRORNAME. The SIGNAL
statement signals an error condition that is passed up to the program from which the
current program was run. When the calling program contains a trap label, then
execution branches to that label.
When each program in a chain of nested programs uses the TRAP and SIGNAL
commands in this way, you can pass the error condition up through the entire chain.
Each program has commands like these.
TRAP ON error
... "Body of program and normal exit commands
RETURN
error:
... "Error-handling and exit commands
SIGNAL PRGERR
Example 10–157 Producing a Program Error Message at the End of the Chain
To produce the error message at the end of a chain of nested programs, use a TRAP
statement that includes the NOPRINT keyword. When an error occurs in a nested
program, execution branches to the trap label, but the error message is suppressed.
At the trap label, perform whatever error-handling commands you want and restore
the environment. Then execute the following SIGNAL statement.
SIGNAL ERRORNAME ERRORTEXT
ERRORTEXT option contains the error message for the original error. When the calling
program contains a trap label, then execution branches to that label.Consequently, the
SIGNAL statement passes the original error name and error text to the calling
program.
When each program in a chain of nested programs uses the TRAP and SIGNAL
commands in this way, the original error message is produced at the end of the chain.
Each program has commands like the following.
TRAP ON error NOPRINT
... "Body of program and normal exit commands
RETURN
error:
... "Error-handling and exit commands
SIGNAL ERRORNAME ERRORTEXT
TRIGGER command
Syntax
TRIGGER {event-name [program-name] }... | {DELETE event-name}... | DELETE ALL
where event-name is one of the following:
MAINTAIN
DELETE
PROPERTY
ASSIGN
BEFORE_UPDATE
AFTER_UPDATE
You can use the same keyword many times in a single TRIGGER statement; however,
in this case, Oracle OLAP ignores all but the last occurrence of the keyword. See
"Multiple Occurrences of the Same Keyword" on page 10-264, for details.
Arguments
MAINTAIN
Specifies that the trigger for the program is a Maintain event. A Maintain event is the
execution of the MAINTAIN statement. As outlined in Table 8–12, " Subevents for the
MAINTAIN Event" on page 8-217, the Maintain event has several subevents that
correspond to the major keywords of the MAINTAIN command. Exactly when a
program triggered by a Maintain event is executed is dependent on the Maintain
subevent that triggered the program and the object type for which the Maintain event
is defined:.
■ Programs triggered by Maintain Add and Maintain Merge events on dimensions
and composites are executed after the entire MAINTAIN statement executes.
■ Programs triggered by Maintain Add and Maintain Merge events on dimension
surrogates are executed multiple times—once after each value is added or merged.
■ Programs triggered by other Maintain subevents are executed before the
MAINTAIN statement is executed.
DELETE
Specifies that the trigger for the program is a Delete event. A Delete event is a DELETE
statement for the object. Oracle OLAP executes the specified program immediately
before a DELETE statement deletes the object.
PROPERTY
Specifies that Oracle OLAP executes the specified program in response to a Property
event. A Property event is the execution of a PROPERTY statement to create, modify,
or delete an object property. A program that is triggered by a Property event is
executed before the statement that triggered it.
ASSIGN
Specifies that Oracle OLAP executes the specified program in response to a Assign
event. An Assign event is executed when SET assigns values to variable, relation,
worksheet object, or a formula. A program that is triggered by SET is executed each
time Oracle OLAP assigns a value to the object for which the event was defined. Thus,
a program triggered by an Assign event is often executed over and over again as the
assignment statements loops through a object assigning values.
UPDATE
When the object has been acquired using ACQUIRE in an analytic workspace that is
attached in multiwriter mode, specifies that Oracle OLAP executes the specified
program immediately after the object is updated.
program-name
The name of the trigger program. When omitted for an event, the event does not
trigger an action.
DELETE event-name
Deletes the triggers for the specified object events. Oracle OLAP disassociates the
trigger program from the specified object event.
DELETE ALL
Deletes all of the triggers for the specified object. Oracle OLAP disassociates the
trigger program from all events for object.
Notes
Examples
statement executes against city or when a property is created or deleted for city. To
create these triggers, you issue the following statements.
"Define the trigger programs
DEFINE trigger_maintain_move_city PROGRAM BOOLEAN
DEFINE trigger_property_city PROGRAM BOOLEAN
"Associate the trigger programs to events for the city dimension
CONSIDER city
TRIGGER PROPERTY trigger_property_city
TRIGGER MAINTAIN trigger_maintain_move_city
When you issue a FULLDSC statement, you confirm that the MAINTAIN trigger for
city has been deleted although the trigger_maintain_move_city program
remains.
DEFINE CITY DIMENSION TEXT
TRIGGER PROPERTY TRIGGER_PROPERTY_CITY
To create a Maintain trigger for city, you take the following steps:
1. Define the trigger program as a user-defined function. It can have any name that
you want. The following statement defines a program named trigger_
maintain_city.
DEFINE trigger_maintain_city PROGRAM BOOLEAN
3. Issue a TRIGGER statement to associate the trigger program with the city
dimension as a program to be executed when a Maintain event occurs. Remember
to use a CONSIDER statement to make the definition for city the current
definition.
CONSIDER city
TRIGGER MAINTAIN TRIGGER_MAINTAIN_CITY
When you issue a FULLDSC statement to see a full description of your analytic
workspace, you can see the definition of city (including its Maintain trigger) and the
trigger_maintain_city program.
DEFINE CITY DIMENSION TEXT
TRIGGER MAINTAIN TRIGGER_MAINTAIN_CITY
As illustrated in the following statements and output, when you issue MAINTAIN
statements for city, the trigger_maintain_city program executes.
MAINTAIN city ADD 'Boston' 'Houston' 'Dallas'
calltype = TRIGGER
triggering event = MAINTAIN
triggering subevent = ADD
REPORT city
CITY
--------------
Boston
Houston
Dallas
calltype = TRIGGER
triggering event = MAINTAIN
triggering subevent = MOVE
REPORT city
CITY
--------------
Boston
Dallas
Houston
Note: From the output you can see that Oracle OLAP called the
trigger_eq program three times—each time it assigned a value to
percent_sales.
4. When you issue REPORT commands for sales and percent_sales you can see
the result of the calculations. The percent_sales variable contains values that
are the percent of sales for each continent.
GEOG SALES
-------------- --------------------
North America 0.59
Europe 9.35
Asia NA
GEOG PERCENT_SALES
-------------- --------------------
North America 6
Europe 94
Asia NA
EQ f.sales-f.costs
Note that f.costs, f.sales, and f.margin all have the same dimensions.
Now you add an Assign trigger to f.margin that will execute a program named
t.margin. The definition of f.margin is modified to the following definition.
DEFINE F.MARGIN FORMULA DECIMAL <CHANNEL GEOGRAPHY PRODUCT TIME>
LD Margin
TRIGGER ASSIGN T.MARGIN
EQ f.sales-f.costs
Now you actually write the t.margin program. When an expression is assigned to the
f.margin formula, the program uses this value to compute new values for f.costs
and f.sales.
DEFINE T.MARGIN PROGRAM
PROGRAM
ARG newVal DECIMAL " The value passed to the program by the Assign trigger
VARIABLE t.valDiff DECIMAL " Difference between newVal and old value
VARIABLE t.costInc DECIMAL " Amount the difference makes to costs
"show the value of newVal
SHOW 'newVal = ' NONL
SHOW newVal
" Compute the difference between the current value and the new one
t.valDiff = newVal - f.margin
" Now increase costs proportional to their existing amounts
t.costInc = (newVal - f.margin) * (f.costs/f.sales)
" Adjust the values of sales and costs to get the new value
SET1 f.costs = f.costs + t.costInc
Now assume that you issue the following LIMIT statements to identify a subset of data
and issue a REPORT statement to report on the values of f.margin.
LIMIT t0.hierdim TO 'STANDARD'
LIMIT time TO t0.levelrel EQ 'L2'
LIMIT geography TO FIRST 1
LIMIT channel TO FIRST 1
LIMIT product TO FIRST 5
GEOGRAPHY: WORLD
CHANNEL: TOTALCHANNEL
-----------------------F.MARGIN-----------------------
-----------------------PRODUCT------------------------
TIME TOTALPROD AUDIODIV PORTAUDIO PORTCD PORTST
-------------- ---------- ---------- ---------- ---------- ----------
Q1.96 54,713,974 29,603,546 5,379,661 2,480,914 1,615,708
Q2.96 63,919,784 34,594,087 6,331,848 2,869,265 1,931,785
Q3.96 58,303,490 31,543,152 5,792,725 2,616,515 1,795,701
Q4.96 71,197,892 38,383,878 7,059,581 3,163,804 2,232,880
Q1.97 55,489,723 29,989,262 5,368,237 2,491,475 1,607,344
Q2.97 41,687,908 22,532,979 4,070,725 1,855,992 1,245,161
Now you issue the following assignment statement that increase the value of
f.margin by 10% and report it
f.margin = f.margin * 1.1
The execution of this assignment statement triggers the execution of the Assign trigger
program named t.margin. The output of that program follows.
newVal = 60,185,371.40
WORLD TOTALPROD TOTALCHANNEL Q1.96 f.costs = 1,298,474.00 f.sales = 61,483,840.00
newVal = 32,563,900.67
WORLD AUDIODIV TOTALCHANNEL Q1.96 f.costs = 664,226.90 f.sales = 33,228,130.00
newVal = 5,917,626.67
WORLD PORTAUDIO TOTALCHANNEL Q1.96 f.costs = 97,976.04 f.sales = 6,015,603.00
newVal = 2,729,005.43
WORLD PORTCD TOTALCHANNEL Q1.96 f.costs = 34,301.53 f.sales = 2,763,307.00
newVal = 1,777,278.95
WORLD PORTST TOTALCHANNEL Q1.96 f.costs = 25,160.72 f.sales = 1,802,440.00
newVal = 70,311,762.13
WORLD TOTALPROD TOTALCHANNEL Q2.96 f.costs = 1,504,051.00 f.sales = 71,815,820.00
newVal = 38,053,495.70
WORLD AUDIODIV TOTALCHANNEL Q2.96 f.costs = 768,788.10 f.sales = 38,822,280.00
newVal = 6,965,032.86
WORLD PORTAUDIO TOTALCHANNEL Q2.96 f.costs = 114,558.20 f.sales = 7,079,591.00
newVal = 3,156,191.20
WORLD PORTCD TOTALCHANNEL Q2.96 f.costs = 39,256.88 f.sales = 3,195,448.00
newVal = 2,124,963.02
WORLD PORTST TOTALCHANNEL Q2.96 f.costs = 29,780.54 f.sales = 2,154,744.00
newVal = 64,133,838.86
WORLD TOTALPROD TOTALCHANNEL Q3.96 f.costs = 1,350,733.00 f.sales = 65,484,570.00
newVal = 34,697,467.06
WORLD AUDIODIV TOTALCHANNEL Q3.96 f.costs = 691,887.10 f.sales = 35,389,360.00
newVal = 6,371,997.63
WORLD PORTAUDIO TOTALCHANNEL Q3.96 f.costs = 103,203.70 f.sales = 6,475,202.00
newVal = 2,878,166.40
WORLD PORTCD TOTALCHANNEL Q3.96 f.costs = 35,358.18 f.sales = 2,913,525.00
newVal = 1,975,270.68
WORLD PORTST TOTALCHANNEL Q3.96 f.costs = 27,339.77 f.sales = 2,002,611.00
newVal = 78,317,681.06
WORLD TOTALPROD TOTALCHANNEL Q4.96 f.costs = 1,618,915.00 f.sales = 79,936,590.00
newVal = 42,222,265.94
WORLD AUDIODIV TOTALCHANNEL Q4.96 f.costs = 826,923.40 f.sales = 43,049,190.00
newVal = 7,765,539.34
WORLD PORTAUDIO TOTALCHANNEL Q4.96 f.costs = 123,269.50 f.sales = 7,888,809.00
newVal = 3,480,184.35
WORLD PORTCD TOTALCHANNEL Q4.96 f.costs = 41,998.90 f.sales = 3,522,183.00
newVal = 2,456,168.00
WORLD PORTST TOTALCHANNEL Q4.96 f.costs = 33,357.19 f.sales = 2,489,525.00
newVal = 61,038,695.03
WORLD TOTALPROD TOTALCHANNEL Q1.97 f.costs = 1,423,963.00 f.sales = 62,462,660.00
newVal = 32,988,187.65
WORLD AUDIODIV TOTALCHANNEL Q1.97 f.costs = 679,477.80 f.sales = 33,667,660.00
newVal = 5,905,060.56
WORLD PORTAUDIO TOTALCHANNEL Q1.97 f.costs = 158,854.40 f.sales = 6,063,915.00
newVal = 2,740,622.56
WORLD PORTCD TOTALCHANNEL Q1.97 f.costs = 53,144.41 f.sales = 2,793,767.00
newVal = 1,768,078.14
WORLD PORTST TOTALCHANNEL Q1.97 f.costs = 40,784.62 f.sales = 1,808,863.00
newVal = 45,856,698.46
WORLD TOTALPROD TOTALCHANNEL Q2.97 f.costs = 1,070,465.00 f.sales = 46,927,160.00
newVal = 24,786,276.35
WORLD AUDIODIV TOTALCHANNEL Q2.97 f.costs = 512,435.60 f.sales = 25,298,710.00
newVal = 4,477,797.64
WORLD PORTAUDIO TOTALCHANNEL Q2.97 f.costs = 118,791.70 f.sales = 4,596,590.00
newVal = 2,041,591.56
WORLD PORTCD TOTALCHANNEL Q2.97 f.costs = 39,287.77 f.sales = 2,080,879.00
newVal = 1,369,677.57
WORLD PORTST TOTALCHANNEL Q2.97 f.costs = 30,038.08 f.sales = 1,399,716.00
The f_modified_sales formula does not presently have an Assign trigger on it.
Consequently, as illustrated in the following code, any attempt to assign values to f_
modified_sales results in an error.
f_modified_sales = 3
ORA-34142: You cannot assign values to a FORMULA.
2. Add the Assign trigger to the definition of the formula using the following
statements.
CONSIDER f_modified_sales
TRIGGER ASSIGN trigger_assign_modified_sales
3. Now when you issue the following statement to assign a value to f_modified_
sales, an error does not occur. Instead, the trigger_assign_modified_
sales trigger program executes 16 times, once for each dimension value of
sales.
f_modified_sales = 3
...
description of triggering object =
...
description of triggering object =
...
description of triggering object =
...
description of triggering object =
...
description of triggering object =
...
description of triggering object =
...
description of triggering object =
...
description of triggering object =
...
-------------F_MODIFIED_SALES--------------
------------------TIME.D-------------------
GEOG.D Jan2004 Feb2004 Mar2004 2004
-------------- ---------- ---------- ---------- ----------
Boston 24.00 24.66 25.91 NA
Medford 24.37 25.80 24.45 NA
San Diego 24.97 25.95 24.75 NA
Sunnydale 25.85 25.26 24.08 NA
TRIGGERASSIGN
Within a program triggered by an Assign event for an object, assigns a value to the
triggering object.
Data Type
The data type of the object to which Oracle OLAP assigns the value.
Syntax
TRIGGERASSIGN value
Arguments
value
The value that you want assigned.
Examples
Assume also that you have populated the sales variable with the values shown in
the following report, but that you have not yet populated the modified_sales
variable.
-----------------------SALES-----------------------
----------------------GEOG.D-----------------------
TIME.D Boston Medford San Diego Sunnydale
------------ ------------ ------------ ------------ ------------
Jan76 1,000.00 2,000.00 3,000.00 4,000.00
Feb76 2,000.00 4,000.00 6,000.00 8,000.00
Mar76 3,000.00 6,000.00 9,000.00 12,000.00
76Q1 NA NA NA NA
Now you want to assign values to the modified_sales variable using various
expressions, however, you want to ensure that the values never are less than or equal
to 1,000. You can assure this processing by taking the following steps:
1. Create the following program that checks for values less than or equal to 1000
condition.
triggering subevent =
value passed to program = 11,000.00
5. The following report of modified_sales shows that all values are at least 1,000.
------------------MODIFIED_SALES-------------------
----------------------GEOG.D-----------------------
TIME.D Boston Medford San Diego Sunnydale
------------ ------------ ------------ ------------ ------------
Jan76 1,000.00 1,000.00 2,000.00 3,000.00
Feb76 1,000.00 3,000.00 5,000.00 7,000.00
Mar76 2,000.00 5,000.00 8,000.00 11,000.00
76Q1 NA NA NA NA
UNHIDE
The UNHIDE command unhides the text of a program that has been made invisible by
a HIDE statement. To use UNHIDE, you must know the seed expression that was used
with the HIDE statement when the program was hidden.
Syntax
UNHIDE prog-name seed-exp
Arguments
prog-name
The name of a program whose text has been made invisible by using the HIDE
statement. Do not enclose the program name in quotes.
seed-exp
The single-line text expression that was used in the HIDE statement when
"prog-name" was hidden. The seed expression must be byte-for-byte the same value as
you used in the HIDE statement. Also, since the seed expression is case-sensitive,
specify uppercase and lowercase characters carefully.
Notes
Examples
UPDATE
The UPDATE command moves analytic workspace changes from a temporary area to
the database table in which the workspace is stored. Typically, you use an UPDATE
statement when you are finished making changes in an analytic workspace; however,
you can also specify UPDATE commands periodically as you go along.
Your changes are not saved until you execute a COMMIT statement, either from
Oracle OLAP or from SQL. When you do not use the UPDATE and COMMIT
commands, changes made to an analytic workspace during your session are discarded
when you end your Oracle session.
Syntax
UPDATE [MULTI [aquired_objects]] [analytic_workspaces]
Arguments
When you do not specify any parameters, the command updates all analytic
workspaces that are attached in read/write non-exclusive and read/write exclusive
modes and all acquired objects (that is, all acquired variables, relations, valuesets, and
dimensions) in all analytic workspaces that are attached in multiwriter mode.
acquired_objects
A list of the names of acquired objects, separated by commas, in analytic workspaces
attached in multiwriter mode. These objects can be any variable, relation, valueset, or
dimension that you have acquired using an ACQUIRE statement.
workspaces
A list of names, separated by commas. of one or more workspaces attached in
read/write or multiwriter mode.
Notes
Automatic COMMIT
Many users execute DML statements using SQL*Plus or OLAP Worksheet. Both of
these tools automatically execute a COMMIT statement when you end your session.
Shared Workspaces
When you have attached a shared workspace and another user has read/write access,
that user's UPDATE and COMMIT commands do not affect your view of the
workspace. Your view of the data remains the same as when you attached the
workspace. When you want access to the changes, you can detach the workspace and
reattach it.
Examples
In order to save the changes in the database, the UPDATE statement must be followed
by a COMMIT statement.
VARIABLE
Within an OLAP DML program, the VARIABLE command declares a local variable or
valueset for use within that program. A local variable cannot have any dimensions
and exists only while the program is running.
Syntax
VARIABLE name {datatype|dimension|VALUESET dim}
Arguments
name
The name for the local variable or valueset. When you use the same name as an
existing analytic workspace object, the local variable or valueset takes precedence over
the analytic workspace object. After you assign a value to the variable or valueset, its
value will be available within the program where the VARIABLE statement occurs.
You name a variable or valueset according to the rules for naming analytic workspace
objects (see the main entry for the DEFINE command).
datatype
The data type of the variable, which indicates the kind of data to be stored. You can
specify any of the data types that are listed and described in the DEFINE VARIABLE
entry. Also, when you want to the program to be able to receive an argument without
converting it to a specific data type, you can also specify WORKSHEET for the data type.
dimension
Indicates that name is a relation variable, which holds a single value of the specified
dimension. The variable can hold a value of the dimension or a position (INTEGER) of
the specified dimension. Assigning a value that does not currently exist in the
dimension causes an error.
VALUESET dim
Indicates that name is a valueset. The dim argument is the name of the dimension for
which the valueset holds values.
Notes
Examples
VNF
The VNF command assigns a value name format (VNF) to the definition of a object
with DATE -only data type, including dimensions of type DAY, WEEK, MONTH,
QUARTER, or YEAR. A VNF is a template that controls the input and display format
for DATE -only values. The template can include format specifications for any of the
components that identify a time period (day, month, calendar year, fiscal year, and
period within a fiscal year).
Important: You can only use this statement with dimensions that
have a data type of DATE (that is, dimensions of type DAY, WEEK,
MONTH, QUARTER, or YEAR).You cannot use this statement for
time dimensions that have a datetime data type that corresponds to a
SQL datetime data type or dimensions that are implemented as
hierarchical dimensions of type TEXT.
In order to assign a VNF to a definition, the definition must be the one most recently
defined or considered during the current session. When it is not, you must first use a
CONSIDER statement to make it the current definition.
Syntax
VNF [template]
Arguments
template
A text expression that specifies the format for entering and displaying the values of the
current dimension. When template is omitted, any existing VNF for the current
definition is deleted and the default VNF is used (see Table 2–5, " Default VNFs for
DWMQY Dimensions" on page 2-8).
Note: When you enter a dimension value that does not conform to
the VNF, Oracle OLAP attempts to interpret the value as a date. See
"Entering Dimension Values as Dates" on page 10-288
A template contains a code for each component that you use to describe a time period
in the current dimension. The code for each component must be preceded by a left
angle bracket and followed by a right angle bracket. Basic information about coding a
template is provided in Table 10–12, " Basic Codes for Components in VNF Templates",
Table 10–13, " Component Combinations Allowed in VNF Templates", and
Table 10–14, " Format Styles for Day Available in VNF Templates".
Table 10–12, " Basic Codes for Components in VNF Templates" lists the basic codes for
the components of time periods. It uses a sample dimension called MYQTR, which is a
QUARTER dimension that ends in June. The examples are from the quarter July 1,
1995 through September 30, 1995. The period code (P) specifies the numeric position of
a time period within a fiscal year. You can use the P code with any dimension, but
only when you use it along with the FF or FFB code. The B code specifies the
beginning period.
Table 10–13, " Component Combinations Allowed in VNF Templates" lists the
component combinations you can combine in a VNF for each type of dimensions of
type DAY, WEEK, MONTH, QUARTER, or YEAR. Notice that you can use the fiscal
year codes (FF or FFB) in a template for any dimension of type DAY, WEEK, MONTH,
QUARTER, or YEAR. However, the fiscal year codes have a special meaning for
WEEK dimensions and for phased MONTH, QUARTER, and YEAR dimensions. For
other dimensions, the fiscal year is identical to the calendar year. See "Fiscal Years for a
Dimension of Type WEEK" on page 10-286, "Fiscal Years for Dimensions of Type
MONTH, QUARTER, or YEAR" on page 10-287, and "Fiscal Years for Dimensions of
Type DAY" on page 10-287.
Notice that in place of the basic codes listed in Table 10–13, " Component
Combinations Allowed in VNF Templates", you can substitute any of the format styles
listed in Table 10–14, " Format Styles for Day Available in VNF Templates". You can
also include the <NAME> component with any of the component combinations listed in
Table 10–13.
You cannot specify a template that includes too few or too many components. The
VNF must allow you to input dimension values without ambiguity. See "Coding VNFs
to Prevent Ambiguity" on page 10-287.
However, if you include only the component combinations that are allowed for a
particular type of dimension, and if the VNF permits unambiguous interpretation of
input, you have considerable flexibility in specifying a VNF template:
■ You can specify the components in any order.
■ You can include text before, after, and between the components.
In place of the basic codes for the day, month, calendar year, fiscal year, and period
that were listed in Table 10–13, " Component Combinations Allowed in VNF
Templates", you can substitute the format styles listed in Table 10–14, " Format Styles
for Day Available in VNF Templates", Table 10–15, " Format Styles for Month Available
in VNF Templates", Table 10–16, " Format Styles for Year Available in VNF Templates",
and Table 10–17, " Format Styles for Period Available in VNF Templates".
Note that for MTXT, MTXTL, MTEXT, and MTEXTL, the actual value displayed depends
on the value specified for the MONTHNAMES option:
■ For MTXT and MTEXT, when the name in the MONTHNAMES option is all
lowercase, the entire name is converted to uppercase. Otherwise, the first letter is
converted to uppercase and the second and subsequent letters remain in their
original case.
■ For MTXTL and MTEXTL, when the name in the MONTHNAMES option is all
uppercase, the entire name is converted to lowercase. Otherwise the first letter is
converted to lowercase and the second and subsequent letters remain in their
original case.
Notes
Discarding a VNF
When you want to discard a VNF for a dimension and return to using the default
VNF, use a CONSIDER statement to make the dimension's definition the current one,
and then use a VNF statement with no argument.
Month Names
The names used in the month component for the MTXT, MTXTL, MTEXT, and MTEXTL
formats are drawn from the current setting of the MONTHNAMES option.
June 2, 1995 begins on December 31, 1994 (a Saturday) and ends on December 29, 1995
(a Friday). When the VNF for myweek has the FF code, this fiscal year is identified as
1995. When the VNF has the FFB code, the fiscal year is identified as 1994.
■ When the template specifies <MTXT> or <MTXTL>, which indicate the first three
letters of the month name, you can include as much of the month name as you
want, from the first three letters to the full month name. When the template
specifies <MTEXT> or <MTEXTL>, which indicate a month name of indeterminate
length, you can include as much of the name as you want, from the first letter to
the full month name. In all cases, however, you must provide enough letters to
uniquely match a name in the MONTHNAMES option. For example, to
distinguish April from August, you must type at least the first two letters of these
names.
■ You can include as many or as few spaces as you want between components or
between text elements in a dimension value.
■ When the template contains date components that are not essential for identifying
a time period for a particular dimension, you can specify any date that falls within
the desired time period. For example, the <DD> component of the template
<DD><MTXT><YY> is not essential for identifying a period in a MONTH
dimension. Therefore, for June 1995 you can specify any date from 01JUN95
through 30JUN95.
Overriding a VNF
For additional flexibility in displaying the values of a dimension of type DAY, WEEK,
MONTH, QUARTER, or YEAR, you can override the dimension's VNF (and the
default VNF when the dimension has no VNF of its own) by using the CONVERT
function with a VNF argument.
The VNF argument to CONVERT enables you to include all the template codes that
are permitted in the template for a VNF statement, but it does not prevent you from
specifying too few components or more components than are necessary for identifying
a value. In addition, the VNF argument enables you to use additional codes that are
not allowed in the VNF template.
Examples
Note that Oracle OLAP automatically adds the time periods between the ones you
specify in the MAINTAIN statement.
When you use a MAINTAIN statement to add values to the week dimension, you can
specify the new values as dates rather than as values that conform to the VNF.
However, the VNF is used for displaying output in the desired format.
WHILE
The WHILE command repeatedly executes a statement while the value of a Boolean
expression remains TRUE. You can only use WHILE within a program.
Syntax
WHILE boolean-expression
statement block
Arguments
boolean-expression
Serves as the criterion for statement execution. While the expression remains TRUE,
statement is repeatedly executed. When the expression becomes FALSE, the execution
of statement ceases, and the program continues with the next line. Ensure that
something in the statement (or statements) eventually causes the Boolean expression to
become FALSE; otherwise, the code becomes an endless loop.
statement block
One or more statements to be executed while the Boolean expression is TRUE. You can
execute two or more statements by enclosing them within DO ... DOEND brackets.
The DO statement should follow immediately after the WHILE statement.
Notes
WHILE Compared to IF
The WHILE statement's main use is as an alternative to the IF...THEN...ELSE
comand.When you want one or more statements in your program to execute
repeatedly for as long as a Boolean expression remains TRUE, you use WHILE. When
you want them to execute only once when a Boolean expression is TRUE, you use IF.
Boolean Constant
You can specify a constant for the Boolean expression. When your statement is WHILE
TRUE, make sure to include a BREAK, RETURN, or EXIT statement between DO ...
DOEND so the program can finish the loop.
Branching in a Loop
You can use the BREAK, CONTINUE, and GOTO commands to branch within, or out
of, a WHILE loop, thereby altering the sequence of statement execution.
Examples
..." (statements)
IF ....
count = count + 1
DOEND
ZEROTOTAL
The ZEROTOTAL command resets one or all subtotals of specified report columns to
zero. You use the ZEROTOTAL command when you produce reports with the ROW
command.
Syntax
ZEROTOTAL [{n|ALL} [column1 columnN]]
Arguments
ZEROTOTAL with no arguments resets all subtotals in all columns to zero.
n
An INTEGER expression that specifies one of the 32 subtotals (1 to 32) Oracle OLAP
accumulates for each numeric column in a report. For the specified columns, this
subtotal is set to zero.
ALL
Sets all 32 subtotals to zero for the specified columns. ALL is the default when there
are no arguments. To reset all the subtotals to zero for specific columns, you must
include ALL in the statement.
ZEROTOTAL ALL 1 4 7
column
The column number of a report column. Column number 1 refers to the left-most
column in a report, regardless of the type of data it contains. When you do not supply
any column number arguments, Oracle OLAP sets the specified subtotal (or all
subtotals) to zero for all the columns in the report.
Notes
Examples
Unit Sales
Boston 3,538 3,369 3,875
Atlanta 4,058 3,866 4,251
Chicago 3,943 3,509 4,058
Dallas 814 824 867
Denver 1,581 1,532 1,667
Seattle 2,053 2,193 2,617
---------- ---------- ----------
Total Unit Sales 15,987.00 15,293.00 17,335.00
This appendix contains reference documentation for the following SQL functions that
you can use to extract multidimensional data from an analytic workspace and present
it in the two-dimensional format of a relational table:
■ Creating Relational Views Using OLAP_TABLE
■ Using OLAP DML Expressions in SELECT FROM OLAP_TABLE Statements
■ OLAP_TABLE
■ OLAP_CONDITION
■ OLAP_EXPRESSION
■ OLAP_EXPRESSION_BOOL
■ OLAP_EXPRESSION_DATE
■ OLAP_EXPRESSION_TEXT
■ a parent relation, which identifies the parent of each dimension member within a
hierarchy. See "Parentrel Relation" on page 1-11 for more information.
■ a hierarchy dimension, which lists the hierarchies of a dimension. See "Hierlist
Dimension" on page 1-11 for more information.
■ an inhierarchy variable or valueset, which specifies which dimension members
belong to each level of a hierarchy. See "Inhier Valueset or Variable" on page 1-13
for more information.
■ a grouping ID variable, which identifies the depth within a hierarchy of each
dimension member. See "Gidrel Relation" on page 1-18 for more information.
■ a family relation, which provides the full parentage of each dimension member in
a hierarchy. See "Familyrel Relation" on page 1-17 for more information.
■ a level dimension, which lists the levels of a dimension. See "Levellist Dimension"
on page 1-12 for more information.
A table type is a collection of object types; this collection is equivalent to the rows of a
table. The basic syntax for creating a table type is as follows.
CREATE TYPE table_name AS TABLE OF object_name;
OLAP_TABLE can use a limit map in conjunction with a predefined logical table, or it
can use the information in a limit map to dynamically generate a logical table at
runtime.
See Also:
■ "Using OLAP_TABLE With Predefined ADTs" on page A-2
■ "Using OLAP_TABLE With Automatic ADTs" on page A-4
■ Oracle Database Object-Relational Developer's Guide for information
about object types
■ "Create Type" inOracle Database SQL Language Reference
Example A–2, "Sample View of the TIME Dimension Using Predefined ADTs" on
page A-3 uses OLAP_TABLE with a predefined table type to create a relational view of
the TIME dimension in an analytic workspace named MYAW in the MYAW_AW schema.
The first parameter in the OLAP_TABLE call is the name of the analytic workspace. The
second is the name of the predefined table type. The fourth is the limit map that
specifies how to map the workspace dimension to the columns of the predefined table
type. The third parameter is not specified
Example A–2 Sample View of the TIME Dimension Using Predefined ADTs
CREATE TYPE time_cal_row AS OBJECT (
time_id varchar2(32),
cal_short_label varchar2(32),
cal_end_date date,
cal_timespan number(6));
Example A–4, "View of the TIME Dimension Using Automatic ADTs" creates the same
view produced by Example A–2, "Sample View of the TIME Dimension Using
Predefined ADTs" on page A-3, but it automatically generates the ADTs instead of
using a predefined table type. It uses AS clauses in the limit map to specify the data
types of the target columns.
When automatically generating ADTs, OLAP_TABLE uses default relational data types
for the target columns unless you override them with AS clauses in the limit map. The
default data type conversions used by OLAP_TABLE are described in Table A–1,
" Default Data Type Conversions" on page A-16.
select list of the query. When you specify one of these functions in the select list,
OLAP_TABLE generates additional columns for the results of the function.
Before you use one of these expressions, you must specify a ROW2CELL clause in the
limit map used by OLAP_TABLE to identifies the RAW column that OLAP_TABLE
populates with information used by the OLAP single-row functions.
since it is not embedded within OLAP_TABLE, and versatility, since it can be applied at
different entry points.
OLAP_TABLE saves the status of dimensions in the limit map before executing the
LIMIT commands that generate the result set for the query. After the data is fetched,
OLAP_TABLE restores the status of the dimensions. You can specify a PREDMLCMD
clause in the limit map to cause an OLAP DML command to execute before the
dimension status is saved. Modifications resulting from the PREDMLCMD clause remain
in the workspace after execution of OLAP_TABLE, unless reversed with a POSTDMLCMD
clause. For more information, see limit_map on page A-9.
The olap_command parameter of OLAP_TABLE specifies an OLAP DML command that
executes immediately before the result set is fetched. In some circumstances, the olap_
command parameter may contain an OLAP DML FETCH command, which itself
manages the fetch. Limits set by the olap_command parameter are only in effect during
the execution of OLAP_TABLE. For more information, see olap_command on page A-8.
OLAP_TABLE
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL Worksheet.
Returns
A table type whose rows are objects (ADTs) that identify the selected workspace data.
See "Creating Relational Views Using OLAP_TABLE" on page A-1.
Syntax
OLAP_TABLE(
analytic_workspace IN VARCHAR2,
table_object IN VARCHAR2,
olap_command IN VARCHAR2,
limit_map1 IN VARCHAR2,
limit_map2 IN VARCHAR2,
.
.
.
limit_map8 IN VARCHAR2)
RETURN TYPE;
Parameters
analytic_workspace
Provides the name of the analytic workspace where the source data is stored. It also
specifies how long the analytic workspace will be attached to your OLAP session,
which opens on your first call to OLAP_TABLE.
This parameter is always required by OLAP_TABLE.
The syntax of this parameter is:
'[owner.]aw_name DURATION QUERY | SESSION'
For example:
'olapuser.xademo DURATION SESSION'
■ owner
Specify owner whenever you are creating views that will be accessed by other
users. Otherwise, you can omit the owner if you own the analytic workspace. It is
required only when you are logged in under a different user name than the owner.
■ QUERY
Attaches an analytic workspace for the duration of a single query. Use QUERY only
when you need to see updates to the analytic workspace made in other sessions.
■ SESSION
Attaches an analytic workspace and keeps it attached at the end of the query. It
provides better performance than QUERY because it keeps the OLAP session open.
This performance difference is significant when the function is called without
either a table_object parameter or AS clauses in the limit map; in this case, the
OLAP_TABLE function must determine the appropriate table definition. See "Using
OLAP_TABLE With Automatic ADTs" on page A-4.
table_object
The name of a predefined table of objects, as described in "Using OLAP_TABLE With
Predefined ADTs" on page A-2.
This parameter is optional. Omit this parameter when you are using automatic ADTs.
The syntax of this parameter is:
'table_name'
For example:
'product_dim_tbl'
When you specify the table_name parameter, the column data types for the returned
data are predefined. In this case you cannot use AS clauses in the limit map.
When you omit the table_name parameter, the column data types for the returned data
are generated at runtime. You can either provide the target data types with AS clauses
in the limit map, or you can use the default data types described in Table A–1,
" Default Data Type Conversions". See "Using OLAP_TABLE With Automatic ADTs"
on page A-4.
olap_command
A single OLAP DML command. If you want to execute more than one command, then
you must create a program in your analytic workspace and call the program in this
parameter. The power and flexibility of this parameter comes from its ability to
process virtually any data manipulation commands available in the OLAP DML.
The order in which OLAP_TABLE processes the olap_command parameter is specified in
"Order of Processing in OLAP_TABLE" on page A-17.
The syntax of this parameter is:
'olap_command'
■ To make changes in the workspace session immediately before the data is fetched
(after all the limits have been applied) as described in "Using FETCH in the olap_
command Parameter" on page A-17.
■ To specify the source data directly instead of using a limit map as described in
"Using olap_command with a Limit Map" on page A-17.
limit_map
Maps workspace objects to relational columns and identifies the role of each one. See
"Creating Relational Views Using OLAP_TABLE" on page A-1.
The limit map can also specify special instructions to be executed by OLAP_TABLE. For
example: It can cause an OLAP DML command to execute before or after the limit
map is processed; it can specify a ROW2CELL column for the OLAP_CONDITION and
OLAP_EXPRESSION functions. (See "OLAP_CONDITION" on page A-24 and "OLAP_
EXPRESSION" on page A-29.)
The order in which OLAP_TABLE processes information in the limit map is specified in
"Order of Processing in OLAP_TABLE" on page A-17.
The limit map parameter is generally a required parameter. It can only be omitted
when you specify a FETCH command in the olap_command parameter. See the
discussion of olap_command on page A-8.
You can supply the entire text of the limit map as a parameter to OLAP_TABLE, or you
can store all or part of the limit map in a text variable in the analytic workspace and
reference it using ampersand substitution. For example, the following OLAP_TABLE
query uses a limit map stored in a variable called limitmapvar in the MYAW analytic
workspace of the MYAW_AW schema.
SELECT * FROM TABLE(OLAP_TABLE(
'myaw_aw.myaw DURATION SESSION',
'',
'',
'&(myaw_aw.myaw!limitmapvar)');
If you supply the limit map as text within the call to OLAP_TABLE, then it has a
maximum length of 4000 characters, which is imposed by PL/SQL. If you store the
limit map in the analytic workspace, then the limit map has no maximum length.
The syntax of the limit map has numerous clauses, primarily for defining dimension
hierarchies. Pay close attention to the presence or absence of commas, since syntax
errors will prevent your limit map from being parsed.
'[MEASURE column [AS datatype] FROM {measure | AW_EXPR expression}]
.
.
DIMENSION [column [AS datatype] FROM] dimension
[WITH
[HIERARCHY [column [AS datatype] FROM] parent_relation
[(hierarchy_dimension ''hierarchy_name'')]
[INHIERARCHY inhierarchy_obj]
[GID column [AS datatype] FROM gid_relation]
[PARENTGID column [AS datatype] FROM gid_relation]
[FAMILYREL column1 [AS datatype],
Where:
column is the name of a column in the target table.
datatype is the data type of column.
measure is a variable, formula, or relation in the analytic workspace.
expression is a formula or qualified data reference for objects in the analytic workspace.
dimension is a dimension in the analytic workspace.
parent_relation is a self-relation in the analytic workspace that defines the hierarchies
for dimension. See "Parentrel Relation" on page 1-11 for more information.
hierarchy_dimension is a dimension in the analytic workspace that contains the names
of the hierarchies for dimension. See "Hierlist Dimension" on page 1-11 for more
information
hierarchy_name is a member of hierarchy_dimension.
inhierarchy_obj is a variable or valueset in the analytic workspace that identifies which
dimension members are in each level of the hierarchy. See "Inhier Valueset or Variable"
on page 1-13 for more information
gid_relation is a relation in the analytic workspace that contains the grouping ID of
each dimension member in the hierarchy. See "Gidrel Relation" on page 1-18 for more
information
family_relation is a self-relation that provides the full parentage of each dimension
member in the hierarchy. See "Familyrel Relation" on page 1-17 for more information
level_dimension is a dimension in the analytic workspace that contains the names of the
levels for the hierarchy. See "Levellist Dimension" on page 1-12 for more information
label_variable is a variable in the analytic workspace that contains descriptive text
values for dimension.
hier_attribute_variable is a variable in the analytic workspace that contains attribute
values for hierarchy_name.
attribute_variable is a variable in the analytic workspace that contains attribute values
for dimension.
loop_clause specifies how Oracle OLAP determines how it loops through data values
and what rows to create in the relational table. When you exclude a LOOP clause,
Oracle OLAP loops through all of the data values that are identified by the dimensions
in the DIMENSION clauses in the limit map
For the complete syntax of the LOOP clause see "LOOP Clause" on page A-13.
olap_command is an OLAP DML command.
Detailed syntax for each of the clauses of the limit-map parameter follows.
■ MEASURE Clause
The MEASURE clause maps a variable, formula, or relation in the analytic
workspace to a column in the target table. You can list any number of MEASURE
clauses. This clause is optional when, for example, you wish to create a dimension
view.
The AS subclause specifies the data type of the target column. You can specify an
AS subclause when the table of objects has not been predefined. See "Using OLAP_
TABLE With Automatic ADTs" on page A-4.
In the FROM subclause, you can either specify the name of a variable, formula, or
relation or an OLAP expression that evaluates to one of these objects. For example:
AW_EXPR analytic_cube_sales - analytic_cube_cost
or
AW_EXPR LOGDIF(analytic_cube_sales, 1, time, LEVELREL time.lvlrel)
■ DIMENSION Clause
The DIMENSION clause identifies a dimension or conjoint in the analytic
workspace that dimensions one or more measures or attributes, or provides the
dimension members for one or more hierarchies in the limit map.
The column subclause is optional when you do not want the dimension members
themselves to be represented in the table. In this case, you should include a
dimension attribute that can be used for data selection.
For a description of the AS subclause, see "MEASURE Clause" on page A-11.
Every limit map should have at least one DIMENSION clause. If the limit map
contains MEASURE clauses, then it should also contain a single DIMENSION clause
for each dimension of the measures, unless a dimension is being limited to a single
value. If the measures are dimensioned by a composite, then you must identify
each dimension in the composite with a DIMENSION clause. For the best
performance when fetching a large result set, identify the composite in a LOOP
clause. See "LOOP Clause" on page A-13.
A dimension can be named in only one DIMENSION clause. Subclauses of the
DIMENSION clause identify the dimension hierarchies and attributes.
■ WITH Subclause for Dimension Hierarchies and Attributes
The WITH subclause introduces a HIERARCHY or ATTRIBUTE subclause. If you
do not specify hierarchies or attributes, then omit the WITH keyword. If you
specify both hierarchies and attributes, then precede them with a single WITH
keyword.
■ WITH HIERARCHY Subclause
The HIERARCHY subclause identifies the parent self-relation in the analytic
workspace that defines the hierarchies for the dimension. See "Parentrel
Relation" on page 1-11 for more information,
The HIERARCHY subclause is optional when the dimension does not have a
hierarchy, or when the status of the dimension has been limited to a single
level of the hierarchy. When a dimension has multiple hierarchies, specify a
HIERARCHY subclause for each one and specify a hierarchy_dimension phrase.
The union_subclause specifies exactly how Oracle OLAP determines which base
dimensions it uses to identify what data values to loop through. For a successful
union to occur, the objects that are referenced in this subclause must have the
same base dimensions. The union_subclause has the syntax show below.
[ignore_phrase] [dense_phrase] UNION ({aggmap_phrase | list_phrase }...)]
where:
aggmap_phrase has the following syntax which specifies how Oracle OLAP loops
through the values of an aggregated variable.
AGGMAP (ignore_phrase] [dense_phrase] aggmap {variable | dimension_list})
list_phrase has the following syntax which specifies how Oracle OLAP loops
through the values of a composite, partition template, or dimension. It has the
following syntax.
LIST ([ignore_phrase] [dense_phrase] dimension_list)
■ ignore_phrase — Specifies the dimension values that you do not want Oracle
OLAP to loop over. It has the following syntax.
IGNORE ignore_list
For ignore_list you can specify one of the following.
dimension_name
valueset_name
COMPLEMENT (valueset_name)
Within a single ignore_list you cannot specify a dimension in more than one
way. In other words, you cannot specify both a dimension and a valueset for
that same dimension; you cannot specify two valuesets for the same
dimension
■ dense_phrase — Specifies values that Oracle OLAP loops over even when the
measure cells identified by those values contain NA or null. In other words,
specifying a dimension in a DENSE phrase is similar to requesting a relational
outer join. Typically, you include dimension values in a DENSE phrase in
order to perform time-series processing (for example, in order to lag over
time). A DENSE phrase has the following syntax.
DENSE dense_list
For dense_list you can specify one or more of the following separated by
commas.
dimension_name
valueset_name
COMPLEMENT (valueset_name)
Within a single dense_list you cannot specify a dimension in more than one
way. In other words, you cannot specify both a dimension and a valueset for
that same dimension; you cannot specify two valuesets for the same
dimension.
However, you can have one valueset for a dimension in the outer DENSE
phrase and another valueset for the same dimension in an inner DENSE
phrase. If a dimension or a valueset of a dimension is specified in both an
inner and outer DENSE phrase, Oracle OLAP loops densely over the union of
the dense regions. If the dimension, itself, appears in either place, Oracle
OLAP loops densely over the whole dimension.
■ aggmap — The name of an aggmap object. When you specify only the name of
an aggmap object, Oracle OLAP uses the values in the PRECOMPUTE phrases
of the aggmap to identify the values to loop
■ variable — The name of the variable aggregated by aggmap_name.
■ dimension_list — A list of one or more composites, partition templates, or
dimensions.
■ PREDMLCMD Clause
The PREDMLCMD clause specifies an OLAP DML command that is executed before
the data is fetched from the analytic workspace into the target table. It can be used,
for example, to execute an OLAP model or forecast whose results will be fetched
into the table. The results of the command are in effect during execution of the
limit map, and continue into your session after execution of OLAP_TABLE is
complete. See "Order of Processing in OLAP_TABLE" on page A-17.
■ POSTDMLCMD Clause
The POSTDMLCMD clauses specifies an OLAP DML command that is executed after
the data is fetched from the analytic workspace into the target table. It can be used,
for example, to delete objects or data that were created by commands in the
PREDMLCMD clause, or to restore the dimension status that was changed in a
PREDMLCMD clause. See "Order of Processing in OLAP_TABLE" on page A-17.
Notes
Limit Maps
OLAP_TABLE uses a limit map to map dimensions and measures defined in an
analytic workspace to columns in a logical table. The limit map combines with the
WHERE clause of a SQL SELECT statement to generate a series of OLAP DML LIMIT
commands that are executed in the analytic workspace.
OLAP_TABLE can use a limit map in conjunction with a predefined logical table, or it
can use the information in a limit map to dynamically generate a logical table at
runtime.
Logical Tables
The logical table populated by OLAP_TABLE is actually a table type whose rows are
user-defined object types, also known as Abstract Data Types or ADTs.
A user-defined object type is composed of attributes, which are equivalent to the
columns of a table. The basic syntax for defining a row is as follows.
CREATE TYPE object_name AS OBJECT (
attribute1 datatype,
attribute2 datatype,
attributen datatype);
A table type is a collection of object types; this collection is equivalent to the rows of a
table. The basic syntax for creating a table type is as follows.
CREATE TYPE table_name AS TABLE OF object_name;
See Also:
■ Oracle Database Object-Relational Developer's Guide for information
about object types
■ "Create Type" inOracle Database SQL Language Reference
Note: Normally, you should only use the FETCH command with
OLAP_TABLE if you are upgrading an Express application that used
the FETCH command for SNAPI. If you are upgrading, note that the
full syntax is the same in Oracle as in Express 6.3. You can use the
same FETCH commands in OLAP_TABLE that you used previously
in SNAPI. For the syntax of the FETCH command, see "FETCH" on
page 9-254.
FETCH specifies explicitly how analytic workspace data is mapped to a table object.
The basic syntax is:
FETCH expression...
Enter one expression for each target column, listing the expressions in the same order
they appear in the row definition. Separate expressions with spaces or commas.You
must enter the entire statement on one line, without line breaks or continuation marks
of any type.
1. Execute any OLAP DML command specified in the PREDMLCMD parameter of the
limit map.
2. Save the current status of all dimensions in the limit map so that it can be restored
later (PUSH status).
3. Keep in status only those dimension members specified by INHIERARCHY
subclauses in the limit map (LIMIT KEEP).
4. Within the status set during step 3, keep only those dimension members that
satisfy the WHERE clause of the SQL SELECT statement containing the OLAP_
TABLE function (LIMIT KEEP).
5. Execute any OLAP DML command specified in the olap_command parameter of the
OLAP_TABLE function. (If olap_command includes a FETCH, fetch the data.)
6. Fetch the data (unless an OLAP DML FETCH command was specified in the olap_
command parameter).
7. Restore the status of all dimensions in the limit map (POP status).
8. Execute any OLAP DML command specified in the POSTDMLCMD parameter of the
limit map.
Examples
Because different applications have different requirements, several different formats
are commonly used for fetching data into SQL from an analytic workspace. The
examples in this section show how to create views using a variety of different formats.
Although these examples are shown as views, the SELECT statements can be extracted
from them and used directly to fetch data from an analytic workspace into an
application.
Note: The examples in this section use predefined ADTs. You could
modify them to use automatic ADTs. See "Using OLAP_TABLE With
Automatic ADTs" on page A-4.
Example A–5 Script for an Embedded Total Dimension View Using OLAP_TABLE
This example shows the PL/SQL script used to create an embedded total view of the
TIME dimension in an analytic workspace named MYAW. This view is similar to the
view in Example A–2, "Sample View of the TIME Dimension Using Predefined ADTs"
on page A-3, but it specifies both a Calendar and a Fiscal hierarchy, and it includes
HATTRIBUTE subclauses for hierarchy-specific End Date attributes.
The INHIERARCHY subclause identifies a valueset in the analytic workspace that lists
all the dimension members in each hierarchy of a dimension. OLAP_TABLE saves the
status of all dimensions in the limit map that have INHIERARCHY subclauses during
the processing of the limit map. See "Order of Processing in OLAP_TABLE" on
page A-17.
CREATE TYPE awtime_row AS OBJECT (
awtime_id VARCHAR2(12),
awtime_short_label VARCHAR2(12),
awtime_cal_end_date DATE,
awtime_fis_end_date DATE);
/
CREATE TYPE awtime_table AS TABLE OF awtime_row;
/
CREATE OR REPLACE VIEW awtime_view AS
Note that you must be sure to verify that you have created the views correctly by
issuing SELECT statements against them. Only at that time will any errors in the call to
OLAP_TABLE show up.
/
CREATE OR REPLACE VIEW awunits_view AS
SELECT awunits,
awtime, awcustomer, awproduct, awchannel, r2c
FROM TABLE(OLAP_TABLE(
'myaw DURATION SESSION',
'awunits_table',
'',
'MEASURE awunits FROM units_cube_units
DIMENSION awtime FROM time WITH
HIERARCHY time_parentrel
DIMENSION awcustomer FROM customer WITH
HIERARCHY customer_parentrel
(customer_hierlist ''MARKET_ROLLUP'')
INHIERARCHY customer_inhier
DIMENSION awproduct FROM product WITH
HIERARCHY product_parentrel
DIMENSION channel WITH
HIERARCHY channel_parentrel
ATTRIBUTE awchannel FROM channel_short_description
ROW2CELL r2c'))
WHERE awunits IS NOT NULL;
AWCHANNEL AWUNITS
--------- -------
All Channels 415392
Direct Sales 43783
Catalog 315737
Internet 55872
/
CREATE OR REPLACE VIEW awproduct_view AS
SELECT class, family, item
FROM TABLE(OLAP_TABLE(
'myaw DURATION QUERY',
'awproduct_table',
'',
'DIMENSION product WITH
HIERARCHY product_parentrel
FAMILYREL null, class, family, item
FROM product_familyrel USING product_levellist
LABEL product_short_description'));
OLAP_CONDITION
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL Worksheet.
Returns
The number 1 to indicate a successful invocation of OLAP_CONDITION.
Syntax
OLAP_CONDITION(
r2c IN RAW(32),
expression IN VARCHAR2,
event IN NUMBER DEFAULT 1);
RETURN NUMBER;
Parameters
r2c
The name of a column specified by a ROW2CELL clause in the limit map. This
parameter is used by OLAP_CONDITION to identify a particular invocation of OLAP_
TABLE.
The ROW2CELL column is used in the processing of the single-row functions. (See
"OLAP_EXPRESSION" on page A-29) OLAP_CONDITION simply uses it as an
identifier.
For information on creating a ROW2CELL column, see "ROW2CELL Clause" on
page A-13.
expression
A single OLAP DML command to be executed within the context of the OLAP_TABLE
function identified by the r2c parameter
event
The event during OLAP_TABLE processing that will trigger the execution of the OLAP
DML command specified by the expression parameter. This parameter can have the
value 0, 1, or 2, as described in Table A–2
Notes
Table A–2 Entry Points for OLAP_CONDITION in the OLAP_TABLE Limit Map
Entry Point Description
0 Execute the OLAP DML command after the PREDMLCMD clause of the limit map
is processed and before the status of the dimensions in the limit map is saved.
The entry point is between steps 1 and 2 in "Order of Processing in OLAP_
TABLE" on page A-17.
If OLAP_CONDITION limits any of the dimensions in the limit map, the limits
remain in the workspace after the execution of OLAP_TABLE (unless a command
in the POSTDMLCMD clause of the limit map changes the status).
1 Execute the OLAP DML command after the conditions of the WHERE clause are
satisfied and before the data is fetched. (Default.)
The entry point is between steps 4 and 5 in "Order of Processing in OLAP_
TABLE" on page A-17.
If an OLAP DML command (other than FETCH) is specified in the olap_command
parameter of OLAP_TABLE, it is executed after OLAP_CONDITION and before the
data is fetched. (The use of a FETCH command in the olap_command parameter, or
in OLAP_CONDITION itself, is not generally recommended. See "Using FETCH in
the olap_command Parameter" on page A-17.)
If OLAP_CONDITION limits any of the dimensions in the limit map, the limits
remain in effect for the duration of the query only.
2 Execute the OLAP DML command after the data is fetched and the status of
dimensions in the limit map has been restored.
The entry point is after step 8 in "Order of Processing in OLAP_TABLE" on
page A-17.
If OLAP_CONDITION limits any dimensions, the limits remain in the analytic
workspace after the query completes.
Examples
Several sample queries using OLAP_CONDITION are shown in Example A–11, "Queries
of UNIT_COST_PRICE_VIEW Using OLAP_CONDITION". These examples use the
PRICE_CUBE in an analytic workspace namedMYAW. The cube has a time dimension, a
product dimension, and measures for unit cost and unit price.
The examples are based on a view called unit_cost_price_view. The SQL for
creating this view is shown in Example A–10, "View of PRICE_CUBE". For information
about creating views of analytic workspaces, see "Creating Relational Views Using
OLAP_TABLE" on page A-1.
TIME TIME_SHORT_DESCRIPTION
---- ----------------------
3 2000
-- Reset status
SQL>exec dbms_aw.execute('allstat');
In the next query, OLAP_CONDIITON uses entry point 1. The limited data is returned
by OLAP_TABLE, but the limit does not remain in effect in the analytic workspace.
Note that the third parameter is not required in this case, since entry point 1 is the
default.
SQL>SELECT * FROM unit_cost_price_view
WHERE aw_product = 'Hardware'
AND aw_time in ('2000', '2001', '2002', '2003')
AND OLAP_CONDITION(r2c,
'limit time to time_short_description eq ''2000''', 1)=1
ORDER BY aw_time;
TIME TIME_SHORT_DESCRIPTION
---- ----------------------
19 Jan-98
20 Feb-98
21 Mar-98
22 Apr-98
.
.
.
1 1998
2 1999
3 2000
4 2001
85 2002
102 2003
119 2004
-- Reset status
SQL>exec dbms_aw.execute('allstat');
In the final query, OLAP_CONDIITON uses entry point 2. The limit does not affect the
data returned by OLAP_TABLE, but the limit remains in effect in the analytic
workspace.
SQL>SELECT * FROM unit_cost_price_view
WHERE aw_product = 'Hardware'
AND aw_time in ('2000', '2001', '2002', '2003')
AND OLAP_CONDITION(r2c,
'limit time to time_short_description eq ''2000''', 2)=1
ORDER BY aw_time;
TIME TIME_SHORT_DESCRIPTION
---- ----------------------
3 2000
OLAP_EXPRESSION
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL Worksheet.
Returns
An evaluation of numeric_expression for each row of the table object returned by the
OLAP_TABLE function.
OLAP_EXPRESSION returns numeric data. To return text, boolean, or date data, use
the OLAP_EXPRESSION_TEXT, OLAP_EXPRESSION_BOOL, or OLAP_EXPRESSION_
DATE functions.
Syntax
OLAP_EXPRESSION(
r2c IN RAW(32),
numeric_expression IN VARCHAR2)
RETURN NUMBER;
Parameters
r2c
The name of a column specified by a ROW2CELL clause in the limit map. See
"ROW2CELL Clause" of OLAP_TABLE on page A-13
numeric_experssion
An OLAP DML expression that returns a numeric result.
Examples
The following script was used to create the view unit_cost_price_view, which is
used in Example A–12, "OLAP_EXPRESSION: Time Series Function in a WHERE
Clause" on page A-30 and Example A–13, "OLAP_EXPRESSION: Numeric Calculation
in an ORDER BY CLause" on page A-31 to illustrate the use of OLAP_EXPRESSION.
For information about creating views of analytic workspaces, see "Creating Relational
Views Using OLAP_TABLE" on page A-1.
OLAP_EXPRESSION_BOOL
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL Worksheet.
Returns
An evaluation of boolean_expression for each row of the table object returned by the
OLAP_TABLE function.
OLAP_EXPRESSION_BOOL returns boolean data. To return numeric, date, or text data,
use the OLAP_EXPRESSION, OLAP_EXPRESSION_DATE, or OLAP_EXPRESSION_
TEXT functions.
Syntax
OLAP_EXPRESSION_BOOL(
r2c IN RAW(32),
boolean_expression IN VARCHAR2)
RETURN NUMBER;
Parameters
r2c
The name of a column specified by a ROW2CELL clause in the limit map. See
"ROW2CELL Clause" of OLAP_TABLE on page A-13
boolean_experssion
An OLAP DML expression that returns a Boolean result.
Examples
The following script was used to create the view awunits_view, which is used in
Example A–14 to illustrate the use of OLAP_EXPRESSION_BOOL.
AWCHANNEL AWUNITS
--------- -------
All Channels 415392
Direct Sales 43783
Catalog 315737
Internet 55872
The following statements show the descriptions of the Product, Customer, and Time
dimension members used in the query.
PRODUCT_AW PRODUCT_AW_SHORT_DESCRIPTION
--------------- --------------------------------------------------
1 Total Product
CUSTOMER_AW CUSTOMER_AW_SHORT_DESCRIPTION
--------------- --------------------------------------------------
7 Total Market
TIME_AW TIME_AW_SHORT_DESCRIPTION
--------------- --------------------------------------------------
4 2001
PRODUCTS LOWEST_UNITS
--------------- ------------
40 0
41 1
42 1
43 1
44 1
45 0
This query shows that products 41-44 all had less than 500 units. These products are
the documentation sets in German, French, Spanish, and Italian. The selected products
are shown as follows.
SQL>execute dbms_aw.execute
('limit product_aw to product_aw gt 39 and product_aw lt 46');
SQL>execute dbms_aw.execute('rpr product_aw_short_description');
PRODUCT_AW PRODUCT_AW_SHORT_DESCRIPTION
--------------- --------------------------------------------------
40 O/S Documentation Set - English
41 O/S Documentation Set - German
42 O/S Documentation Set - French
OLAP_EXPRESSION_DATE
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL Worksheet.
Returns
An evaluation of date_expression for each row of the table object returned by the OLAP_
TABLE function.
OLAP_EXPRESSION_DATE returns date data. To return numeric, boolean, or text data,
use the OLAP_EXPRESSION, OLAP_EXPRESSION_BOOL, or OLAP_EXPRESSION_
TEXT functions.
Syntax
OLAP_EXPRESSION_DATE(
r2c IN RAW(32),
date_expression IN VARCHAR2)
RETURN NUMBER;
Parameters
r2c
The name of a column specified by a ROW2CELL clause in the limit map. See
"ROW2CELL Clause" of OLAP_TABLE on page A-13
date_experssion
An OLAP DML expression that returns an OLAP DML datetime result.
Examples
Refer to the examples in OLAP_EXPRESSION and OLAP_EXPRESSION_BOOL for
examples of OLAP single-row functions.
OLAP_EXPRESSION_TEXT
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL Worksheet.
Returns
An evaluation of text_expression for each row of the table object returned by the OLAP_
TABLE function.
Syntax
OLAP_EXPRESSION_TEXT(
r2c IN RAW(32),
text_expression IN VARCHAR2)
RETURN NUMBER;
Parameters
r2c
The name of a column specified by a ROW2CELL clause in the limit map. See
"ROW2CELL Clause" of OLAP_TABLE on page A-13
text_experssion
An OLAP DML expression that returns a text result.
Example
Refer to the examples in OLAP_EXPRESSION and OLAP_EXPRESSION_BOOL for
examples of OLAP single-row functions.
The DBMS_AW PL/SQL package provides procedures and functions for interacting
with analytic workspaces.
This appendix contains the following topics:
■ Managing Analytic Workspaces
■ Converting an Analytic Workspace to Oracle 11g Storage Format
■ Embedding OLAP DML in SQL Statements
■ Using the Sparsity Advisor
■ Using the Aggregate Advisor
■ Summary of DBMS_AW Subprograms
■ One reference topic for each DBMS_AW subprograms
Each analytic workspace is associated with a list of analytic workspaces. The read-only
workspace EXPRESS.AW, which contains the OLAP engine code, is always attached
last in the list. When you create a new workspace, it is attached first in the list by
default.
You can reposition an analytic workspace within the list by using keywords such as
FIRST and LAST. For example, the following commands show how to move an
analytic workspace called MYAW.TEST2 from the second position to the first position
on the list.
EXECUTE dbms_aw.execute ('AW LIST');
From within SQL*Plus, you can rename workspaces and make copies of workspaces. If
you have an analytic workspace attached with read/write access, you can update the
workspace and save your changes in the permanent database table where the
workspace is stored. You must do a SQL COMMIT to save the workspace changes
within the database.
The following commands make a copy of the objects and data in workspace test2 in
a new workspace called test3, update test3, and commit the changes to the
database.
EXECUTE dbms_aw.aw_copy('test2', 'test3');
EXECUTE dbms_aw.aw_update('test3');
COMMIT;
See Also:
■ Oracle Database Upgrade Guide for more information on database
compatibility mode.
■ Oracle MetaLink at http://metalink.oracle.com for more
information about upgrading analytic workspaces.
4. Because you changed the database compatibility mode to Oracle Database 11g,
any new workspaces that you create are in the new storage format.
Use the following procedure to export an Oracle9i analytic workspace and import it in
an Oracle 11g database.
In Oracle9i SQL*Plus, export the analytic workspace to the directory identified by the
work_dir directory object.
EXECUTE dbms_aw.execute ('AW ATTACH ''awname''');
EXECUTE dbms_aw.execute ('ALLSTAT');
EXECUTE dbms_aw.execute ('CDA work_dir');
EXECUTE dbms_aw.execute ('EXPORT ALL TO EIF FILE ''filename''');
In Oracle 11g SQL*Plus, create a new workspace with the same name and schema, and
import the EIF file from the work_dir directory.
EXECUTE dbms_aw.execute ('AW CREATE awname');
EXECUTE dbms_aw.execute ('CDA work_dir');
EXECUTE dbms_aw.execute ('IMPORT ALL FROM EIF FILE ''filename''');
EXECUTE dbms_aw.execute ('UPDATE');
You can also use Oracle export and import utilities to move the entire schema,
including the analytic workspaces to an Oracle 10g database. See Oracle Database
Utilities and Oracle Database Upgrade Guide.
The Sparsity Advisor also provides a public table type for storing information about
the dimensions of the facts being analyzed. Three objects are used to define the table
type:
DBMS_AW$_COLUMNLIST_T
DBMS_AW$_DIMENSION_SOURCE_T
DBMS_AW$_DIMENSION_SOURCES_T
DESCRIBE dbms_aw$_dimension_source_t
Name Null? Type
----------------------------------------- -------- ----------------------------
DIMNAME VARCHAR2(100)
COLUMNNAME VARCHAR2(100)
SOURCEVALUE VARCHAR2(32767)
DIMTYPE NUMBER(3)
HIERCOLS DBMS_AW$_COLUMNLIST_T
PARTBY NUMBER(9)
DESCRIBE dbms_aw$_dimension_sources_t
dbms_aw$_dimension_sources_t TABLE OF DBMS_AW$_DIMENSION_SOURCE_T
primary key composed of foreign keys from four dimension tables. A fifth column
contains the facts for Unit Sales.
The CHANNEL_DIM and CUSTOMER_DIM tables contain all of the information for the
Channel and Customer dimensions in a basic star configuration. Three tables in a
snowflake configuration provide data for the Time dimension: MONTH_DIM,
QUARTER_DIM, and YEAR_DIM. The PRODUCT_CHILD_PARENT table is a parent-child
table and defines the Product dimension.
DECLARE
dimsources dbms_aw$_dimension_sources_t;
dimlist VARCHAR2(500);
sparsedim VARCHAR2(500);
defs CLOB;
BEGIN
-- Provide information about all dimensions in the cube
dbms_aw.add_dimension_source('channel', 'channel_id', dimsources,
'channel_dim', dbms_aw.hier_levels,
dbms_aw$_columnlist_t('channel_id', 'total_channel_id'));
dbms_aw.add_dimension_source('product', 'item_id', dimsources,
'product_child_parent', dbms_aw.hier_parentchild,
dbms_aw$_columnlist_t('product_id', 'parent_id'));
dbms_aw.add_dimension_source('customer', 'ship_to_id', dimsources,
'customer_dim', dbms_aw.hier_levels,
dbms_aw$_columnlist_t('ship_to_id', 'warehouse_id', 'region_id',
'total_customer_id'));
dbms_aw.add_dimension_source('time', 'month_id', dimsources,
'SELECT m.month_id, q.quarter_id, y.year_id
FROM time_month_dim m, time_quarter_dim q, time_year_dim y
WHERE m.parent=q.quarter_id AND q.parent=y.year_id',
dbms_aw.hier_levels,
dbms_aw$_columnlist_t('month_id', 'quarter_id', 'year_id'));
COMMIT;
END;
/
Choosing a balance between static and dynamic aggregation depends on many factors
including disk space, available memory, and the nature and frequency of the queries
that will run against the data. After weighing these factors, you may arrive at a
percentage of the data to preaggregate.
Once you have determined the percentage of the data to preaggregate, you can use the
Aggregate Advisor. These procedures analyze the distribution of dimension members
within hierarchies and identify an optimal set of dimension members to preaggregate.
See Also:
■ "ADVISE_REL Procedure" on page B-24
■ ADVISE_CUBE Procedure on page B-16
Example B–2 uses the following sample Customer dimension to illustrate the
ADVISE_REL procedure.
CUSTOMER_LEVELLIST
----------------------------------------
TOTAL_CUSTOMER
REGION
WAREHOUSE
TOTAL_MARKET
MARKET_SEGMENT
ACCOUNT
SHIP_TO
---- Levels in each hierarchy from leaf to highest
EXECUTE dbms_aw.execute('REPORT W 20 customer_hier_levels');
CUSTOMER_HIERL
IST CUSTOMER_HIER_LEVELS
-------------- --------------------
SHIPMENTS SHIP_TO
WAREHOUSE
REGION
TOTAL_CUSTOMER
MARKET_SEGMENT SHIP_TO
ACCOUNT
MARKET_SEGMENT
TOTAL_MARKET
-----------CUSTOMER_PARENTREL------------
------------CUSTOMER_HIERLIST------------
CUSTOMER MARKET_ROLLUP SHIPMENTS_ROLLUP
---------- -------------------- --------------------
103 44 21
104 45 21
105 45 21
106 45 21
7 NA NA
1 NA NA
8 NA 1
9 NA 1
10 NA 1
11 NA 8
12 NA 10
13 NA 9
14 NA 9
15 NA 8
16 NA 9
17 NA 8
18 NA 8
19 NA 9
20 NA 9
21 NA 10
---- Show text descriptions for the same twenty dimension members
EXECUTE dbms_aw.execute('REPORT W 15 DOWN customer W 35 ACROSS customer_hierlist:
<customer_short_description>');
ALL_LANGUAGES: AMERICAN_AMERICA
---------------------------CUSTOMER_HIERLIST---------------------------
-----------MARKET_ROLLUP----------- ---------SHIPMENTS_ROLLUP----------
CUSTOMER CUSTOMER_SHORT_DESCRIPTION CUSTOMER_SHORT_DESCRIPTION
--------------- ----------------------------------- -----------------------------------
103 US Marine Svcs Washington US Marine Svcs Washington
104 Warren Systems New York Warren Systems New York
105 Warren Systems Philladelphia Warren Systems Philladelphia
106 Warren Systems Boston Warren Systems Boston
7 Total Market NA
1 NA All Customers
8 NA Asia Pacific
9 NA Europe
10 NA North America
11 NA Australia
12 NA Canada
13 NA France
14 NA Germany
15 NA Hong Kong
16 NA Italy
17 NA Japan
18 NA Singapore
19 NA Spain
20 NA United Kingdom
21 NA United States
The returned Customer members with their text descriptions, related levels, and
related hierarchies, are shown as follows.
Customer
Member Description Hierarchy Level
31 Kosh Enterprises MARKET_ROLLUP ACCOUNT
2 Consulting MARKET_ROLLUP MARKET_SEGMENT
4 Government MARKET_ROLLUP MARKET_SEGMENT
5 Manufacturing MARKET_ROLLUP MARKET_SEGMENT
6 Reseller MARKET_ROLLUP MARKET_SEGMENT
7 TOTAL_MARKET MARKET_ROLLUP TOTAL_MARKET
1 TOTAL_CUSTOMER SHIPMENTS_ROLLUP TOTAL_CUSTOMER
8 Asia Pacific SHIPMENTS_ROLLUP REGION
Customer
Member Description Hierarchy Level
9 Europe SHIPMENTS_ROLLUP REGION
20 United Kingdom SHIPMENTS_ROLLUP WAREHOUSE
21 United States SHIPMENTS_ROLLUP WAREHOUSE
ADD_DIMENSION_SOURCE Procedure
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
ADD_DIMENSION_SOURCE (
dimname IN VARCHAR2,
colname IN VARCHAR2,
sources IN OUT dbms_aw$_dimension_sources_t,
srcval IN VARCHAR2 DEFAULT NULL,
dimtype IN NUMBER DEFAULT NO_HIER,
hiercols IN columnlist_t DEFAULT NULL,
partby IN NUMBER DEFAULT PARTBY_DEFAULT);
Parameters
Example
The following PL/SQL program fragment provides information about the TIME
dimension for use by the Sparsity Advisor. The source data for the dimension is stored
in a dimension table named TIME_DIM. Its primary key is named MONTH_ID, and the
foreign key column in the fact table is also named MONTH_ID. The dimension
hierarchy is level based as defined by the columns MONTH_ID, QUARTER_ID, and
YEAR_ID.
The program declares a PL/SQL variable named DIMSOURCES with a table type of
DBMS_AW$_DIMENSION_SOURCES_T to store the information.
DECLARE
dimsources dbms_aw$_dimension_sources_t;
BEGIN
dbms_aw.add_dimension_source('time', 'month_id', dimsources,
'time_dim', dbms_aw.hier_levels,
dbms_aw$_columnlist_t('month_id', 'quarter_id', 'year_id'));
.
.
.
END;
/
ADVISE_CUBE Procedure
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
ADVISE_CUBE (
aggmap_name IN VARCHAR2,
precompute_percentage IN INTEGER DEFAULT 20,
compressed IN BOOLEAN DEFAULT FALSE);
Parameters
Example
This example illustrates the ADVISE_CUBE procedure with a cube called UNITS
dimensioned by PRODUCT and TIME. ADVISE_CUBE returns the dimension
combinations to include if you want to preaggregate 40% of the cube's data.
SET SERVEROUTPUT ON
--- View valuesets
EXECUTE dbms_aw.execute('describe prodvals');
DEFINE PRODVALS VALUESET PRODUCT
EXECUTE dbms_aw.execute('describe timevals');
DEFINE TIMEVALS VALUESET TIME
--- View aggmap
---- The results are returned in the prodvals and timevals valuesets
ADVISE_DIMENSIONALITY Function
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
ADVISE_DIMENSIONALITY (
cubename IN VARCHAR2,
sparsedfn OUT VARCHAR2
sparsename IN VARCHAR2 DEFAULT NULL,
partnum IN NUMBER DEFAULT 1,
advtable IN VARCHAR2 DEFAULT NULL)
RETURN VARCHAR2;
Parameters
Example
The following PL/SQL program fragment defines two variables to store the
recommendations returned by the ADVISE_DIMENSIONALITY function. SPARSEDIM
stores the definition of the recommended composite, and DIMLIST stores the
recommended dimension order of the cube.
DECLARE
sparsedim VARCHAR2(500);
dimlist VARCHAR2(500);
BEGIN
-- Calls to ADD_DIMENSION_SOURCE and ADVISE_SPARSITY omitted here
.
.
.
The next example uses the Sparsity Advisor to evaluate the SALES table in the Sales
History sample schema. A WHILE loop displays the recommendations for all
partitions.
DECLARE
dimlist VARCHAR2(500);
sparsedim VARCHAR2(500);
counter NUMBER(2) := 1;
maxpart NUMBER(2);
BEGIN
-- Calls to ADD_DIMENSION_SOURCE and ADVISE_SPARSITY omitted here
.
.
.
The Sparsity Advisor recommends 11 partitions; the first ten use the same composite.
The last partition uses a different composite. (The SH_SPARSITY_ADVICE table shows
that TIME_ID is dense in the last partition, whereas it is very sparse in the other
partitions.)
Dimension list: sales_cube_composite<time channel product promotion customer>
Sparse dimension: DEFINE sales_cube_composite COMPOSITE COMPRESSED <time channel product promotion customer>
Dimension list: sales_cube_composite<time channel product promotion customer>
Sparse dimension: DEFINE sales_cube_composite COMPOSITE COMPRESSED <time channel product promotion customer>
.
.
.
Dimension list: time sales_cube_composite<channel product promotion customer>
Sparse dimension: DEFINE sales_cube_composite COMPOSITE COMPRESSED <channel product promotion customer>
ADVISE_DIMENSIONALITY Procedure
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
ADVISE_DIMENSIONALITY (
output OUT CLOB,
cubename IN VARCHAR2,
sparsename IN VARCHAR2 DEFAULT NULL,
dtype IN VARCHAR2 DEFAULT 'NUMBER',
advtable IN VARCHAR2 DEFAULT NULL);
Parameters
Example
The following PL/SQL program fragment defines a variable named DEFS to store the
recommended definitions.
DECLARE
defs CLOB;
BEGIN
-- Calls to ADD_DIMENSION_SOURCE and ADVISE_SPARSITY omitted here
.
.
.
dbms_aw.advise_dimensionality(defs, 'units_cube_measure_stored',
'units_cube_composite', 'DECIMAL');
dbms_output.put_line('Definitions: ');
dbms_aw.printlog(defs);
END;
/
In contrast to the Global schema, which is small and dense, the Sales cube in the Sales
History sample schema is large and very sparse, and the Sparsity Advisor
recommends 11 partitions. The following excerpt shows some of the additional OLAP
DML definitions for defining a partition template and moving the TIME dimension
members to the various partitions.
Definitions:
DEFINE sales_cube_composite_p1 COMPOSITE COMPRESSED <time channel product promotion customer>
DEFINE sales_cube_composite_p2 COMPOSITE COMPRESSED <time channel product promotion customer>
DEFINE sales_cube_composite_p3 COMPOSITE COMPRESSED <time channel product promotion customer>
DEFINE sales_cube_composite_p4 COMPOSITE COMPRESSED <time channel product promotion customer>
DEFINE sales_cube_composite_p5 COMPOSITE COMPRESSED <time channel product promotion customer>
DEFINE sales_cube_composite_p6 COMPOSITE COMPRESSED <time channel product promotion customer>
DEFINE sales_cube_composite_p7 COMPOSITE COMPRESSED <time channel product promotion customer>
DEFINE sales_cube_composite_p8 COMPOSITE COMPRESSED <time channel product promotion customer>
DEFINE sales_cube_composite_p9 COMPOSITE COMPRESSED <time channel product promotion customer>
DEFINE sales_cube_composite_p10 COMPOSITE COMPRESSED <time channel product promotion customer>
DEFINE sales_cube_composite_p11 COMPOSITE <channel product promotion customer>
DEFINE sales_cube_pt PARTITION TEMPLATE <time channel product promotion customer> -
PARTITION BY LIST (time) -
(PARTITION p1 VALUES () <sales_cube_composite_p1<>> -
PARTITION p2 VALUES () <sales_cube_composite_p2<>> -
PARTITION p3 VALUES () <sales_cube_composite_p3<>> -
PARTITION p4 VALUES () <sales_cube_composite_p4<>> -
PARTITION p5 VALUES () <sales_cube_composite_p5<>> -
PARTITION p6 VALUES () <sales_cube_composite_p6<>> -
PARTITION p7 VALUES () <sales_cube_composite_p7<>> -
PARTITION p8 VALUES () <sales_cube_composite_p8<>> -
PARTITION p9 VALUES () <sales_cube_composite_p9<>> -
PARTITION p10 VALUES () <sales_cube_composite_p10<>> -
PARTITION p11 VALUES () <time sales_cube_composite_p11<>>)
MAINTAIN sales_cube_pt MOVE TO PARTITION p1 -
'06-JAN-98', '07-JAN-98', '14-JAN-98', '21-JAN-98', -
'24-JAN-98', '28-JAN-98', '06-FEB-98', '07-FEB-98', -
'08-FEB-98', '16-FEB-98', '21-FEB-98', '08-MAR-98', -
'20-MAR-98', '03-JAN-98', '26-JAN-98', '27-JAN-98'
MAINTAIN sales_cube_pt MOVE TO PARTITION p1 -
'31-JAN-98', '11-FEB-98', '12-FEB-98', '13-FEB-98', -
'15-FEB-98', '17-FEB-98', '14-MAR-98', '18-MAR-98', -
'26-MAR-98', '30-MAR-98', '05-JAN-98', '08-JAN-98', -
'10-JAN-98', '16-JAN-98', '23-JAN-98', '01-FEB-98'
MAINTAIN sales_cube_pt MOVE TO PARTITION p1 -
'14-FEB-98', '28-FEB-98', '05-MAR-98', '07-MAR-98', -
'15-MAR-98', '19-MAR-98', '17-JAN-98', '18-JAN-98', -
'22-JAN-98', '25-JAN-98', '03-FEB-98', '10-FEB-98', -
'19-FEB-98', '22-FEB-98', '23-FEB-98', '26-FEB-98'
.
.
.
ADVISE_PARTITIONING_DIMENSION Function
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
ADVISE_PARTITIONING_DIMENSION (
cubename IN VARCHAR2,
sources IN dbms_aw$_dimension_sources_t,
advtable IN VARCHAR2 DEFAULT NULL)
RETURN VARCHAR2;
Parameters
Example
The following program fragment shows the ADVISE_PARTITIONING_DIMENSION
function being used to query the results after using the Sparsity Advisor.
DECLARE
dimsources dbms_aw$_dimension_sources_t;
BEGIN
-- Calls to ADD_DIMENSION_SOURCE and ADVISE_SPARSITY omitted here
.
.
.
dbms_output.put_line('Partitioning Dimension: ' ||
dbms_aw.advise_partitioning_dimension('units_cube', dimsources,
'aw_sparsity_advice'));
END;
/
The program uses DBMS_OUTPUT to display the partitioning dimension, which in this
case is the TIME dimension.
Partitioning Dimension: time
ADVISE_PARTITIONING_LEVEL Function
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
ADVISE_PARTITIONING_LEVEL (
cubename IN VARCHAR2,
sources IN dbms_aw$_dimension_sources_t,
advtable IN VARCHAR2 DEFAULT NULL)
RETURN VARCHAR2;
Parameters
Example
The following program fragment shows the ADVISE_PARTITIONING_LEVEL
function being used to query the results after using the Sparsity Advisor.
DECLARE
dimsources dbms_aw$_dimension_sources_t;
BEGIN
-- Calls to ADD_DIMENSION_SOURCE and ADVISE_SPARSITY omitted here
.
.
.
dbms_output.put_line('Partitioning Level: ' ||
dbms_aw.advise_partitioning_level('units_cube', dimsources,
'aw_sparsity_advice'));
END;
/
The program uses DBMS_OUTPUT to display the partitioning level, which in this case is
YEAR.
Partitioning Level: year
ADVISE_REL Procedure
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
ADVISE_REL (
family_relation_name IN VARCHAR2,
valueset_name IN VARCHAR2,
precompute_percentage IN INTEGER DEFAULT 20,
compressed IN BOOLEAN DEFAULT FALSE);
Parameters
ADVISE_SPARSITY Procedure
The ADVISE_SPARSITY procedure analyzes a fact table for sparsity using information
about its dimensions provided by the ADD_DIMENSION_SOURCE procedure. It
populates a table created by the SPARSITY_ADVICE_TABLE procedure with the
results of its analysis.
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Output Description
Table B–9 describes the information generated by ADVISE_SPARSITY.
Syntax
ADVISE_SPARSITY (
fact IN VARCHAR2,
cubename IN VARCHAR2,
dimsources IN dbms_aw$_dimension_sources_t,
advmode IN BINARY_INTEGER DEFAULT ADVICE_DEFAULT,
partby IN BINARY_INTEGER DEFAULT PARTBY_DEFAULT,
advtable IN VARCHAR2 DEFAULT NULL);
Parameters
Example
The following PL/SQL program fragment analyzes the sparsity characteristics of the
UNITS_HISTORY_FACT table.
DECLARE
dimsources dbms_aw$_dimension_sources_t;
BEGIN
-- Calls to ADD_DIMENSION_SOURCE for each dimension in the cube
.
.
.
dbms_aw.advise_sparsity('units_history_fact', 'units_cube', dimsources,
dbms_aw.advice_default);
END;
/
The following SELECT command displays the results of the analysis, which indicate
that there is one denser dimension (CHANNEL) and three comparatively sparse
dimensions (PRODUCT, CUSTOMER, and TIME).
SELECT fact, dimension, dimcolumn, membercount nmem, leafcount nleaf, advice, density
FROM aw_sparsity_advice
WHERE cubename='units_cube';
AW_ATTACH Procedure
The AW_ATTACH procedure attaches an analytic workspace to your SQL session so that
you can access its contents. The analytic workspace remains attached until you
explicitly detach it, or you end your session.
AW_ATTACH can also be used to create a new analytic workspace, but the AW_CREATE
procedure is provided specifically for that purpose.
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
AW_ATTACH (
awname IN VARCHAR2,
forwrite IN BOOLEAN DEFAULT FALSE,
createaw IN BOOLEAN DEFAULT FALSE,
attargs IN VARCHAR2 DEFAULT NULL,
tablespace IN VARCHAR2 DEFAULT NULL);
AW_ATTACH (
schema IN VARCHAR2,
awname IN VARCHAR2,
forwrite IN BOOLEAN DEFAULT FALSE,
createaw IN BOOLEAN DEFAULT FALSE,
attargs IN VARCHAR2 DEFAULT NULL,
tablespace IN VARCHAR2 DEFAULT NULL);
Parameters
Example
The following commands create a new analytic workspace named GLOBAL_TRACKING
and copies the contents of GLOBAL into it. The workspace is stored in a table named
AW$GLOBAL_TRACKING, which has three partitions and is stored in the user's default
tablespace.
EXECUTE dbms_aw.aw_attach('global');
EXECUTE dbms_aw.aw_copy('global', 'global_tracking', NULL, 3);
AW_COPY Procedure
The AW_COPY procedure copies the object definitions and data from one analytic
workspace into a new analytic workspace.
AW_COPY detaches the original workspace and attaches the new workspace first with
read/write access.
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
AW_COPY (
oldname IN VARCHAR2,
newname IN VARCHAR2,
tablespace IN VARCHAR2 DEFAULT NULL,
partnum IN NUMBER DEFAULT 8);
Parameters
Example
The following commands create a new analytic workspace named GLOBAL_TRACKING
and copies the contents of GLOBAL into it. The workspace is stored in a table named
AW$GLOBAL_TRACKING, which has three partitions and is stored in the user's default
tablespace.
EXECUTE dbms_aw.aw_attach('global');
EXECUTE dbms_aw.aw_copy('global', 'global_tracking', NULL, 3);
AW_CREATE Procedure
The AW_CREATE procedure creates a new, empty analytic workspace and makes it the
current workspace in your session.
The current workspace is first in the list of attached workspaces.
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
AW_CREATE (
awname IN VARCHAR2 ,
tablespace IN VARCHAR2 DEFAULT NULL ,
partnum IN NUMBER DEFAULT 8 );
AW_CREATE (
schema IN VARCHAR2 ,
awname IN VARCHAR2 ,
tablespace IN VARCHAR2 DEFAULT NULL);
Parameters
Example
The following command creates a new, empty analytic workspace named GLOBAL_
FINANCE. The new analytic workspace is stored in a table named AW$GLOBAL_
FINANCE with eight partitions in the user's default tablespace.
EXECUTE dbms_aw.aw_create('global_finance');
The next command creates an analytic workspace named DEMO in the GLOBAL schema.
AW$DEMO will have two partitions and will be stored in the GLOBAL tablespace.
EXECUTE dbms_aw.aw_create('global.demo', 'global', 2);
AW_DELETE Procedure
Syntax
AW_DELETE (
awname IN VARCHAR2);
AW_DELETE (
schema IN VARCHAR2,
awname IN VARCHAR2);
Parameters
Example
The following command deletes the SALES_DEMO analytic workspace in the user's
default schema.
EXECUTE dbms_aw.aw_delete('sales_demo');
AW_DETACH Procedure
The AW_DETACH procedure detaches an analytic workspace from your session so that
its contents are no longer accessible. All changes that you have made since the last
update are discarded. Refer to "AW_UPDATE Procedure" on page B-36 for information
about saving changes to an analytic workspace.
Syntax
AW_DETACH (
awname IN VARCHAR2);
AW_DETACH (
schema IN VARCHAR2,
awname IN VARCHAR2);
Parameters
Table B–15 AW_DETACH Procedure Parameters
Parameter Description
schema The schema that owns awname.
awname The name of an attached analytic workspace that you want to detach from
your session.
Example
The following command detaches the GLOBAL_FINANCE analytic workspace.
EXECUTE dbms_aw.aw_detach('global_finance');
The next command detaches the SALES_HISTORY analytic workspace in the SH_AW
schema.
EXECUTE dbms_aw.aw_detach('sh_aw', 'sales_history');
AW_RENAME Procedure
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
AW_RENAME (
oldname IN VARCHAR2,
newname IN VARCHAR2 );
Parameters
Example
The following commands detach the DEMO analytic workspace and change its name to
SALES_DEMO.
EXECUTE dbms_aw.aw_detach('demo');
EXECUTE dbms_aw.aw_rename('demo', 'sales_demo');
AW_TABLESPACE Function
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
AW_TABLESPACE (
awname IN VARCHAR2)
RETURN VARCHAR2;
AW_TABLESPACE (
schema IN VARCHAR2,
awname IN VARCHAR2)
RETURN VARCHAR2;
Returns
Name of a tablespace.
Parameters
Example
The following example shows the tablespace in which the GLOBAL analytic workspace
is stored.
SET serveroutput ON
AW_UPDATE Procedure
The AW_UPDATE procedure saves the changes made to an analytic workspace in its
permanent database table. For the updated version of this table to be saved in the
database, you must issue a SQL COMMIT statement before ending your session.
If you do not specify an analytic workspace to update, AW_UPDATE updates all the
user-defined workspaces that are currently attached with read/write access.
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
AW_UPDATE (
awname IN VARCHAR2 DEFAULT NULL);
AW_UPDATE (
schema IN VARCHAR2 DEFAULT NULL,
awname IN VARCHAR2 DEFAULT NULL);
Parameters
Example
The following commands save changes to the GLOBAL analytic workspace from the
temporary to the permanent tablespace, then commit the change to the database.
EXECUTE dbms_aw.aw_update('global');
COMMIT;
CONVERT Procedure
The CONVERT procedure converts an analytic workspace to the most recent release
format that is supported by the compatibility mode.
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
CONVERT (
original_aw IN VARCHAR2);
CONVERT (
original_aw IN VARCHAR2,
converted_aw IN VARCHAR2,
tablespace IN NUMBER DEFAULT);
Parameters
Example
This example performs the conversion in a single step, using the analytic workspace as
both the source and the target of the conversion.
EXECUTE dbms_aw.convert('global');
The next example performs the conversion in several steps. The converted workspace
must have the same name as the original workspace, because the fully-qualified names
of objects in the workspace include the workspace name.
EXECUTE dbms_aw.rename('global', 'global_temp');
EXECUTE dbms_aw.convert('global_temp', 'global');
EXECUTE dbms_aw.delete('global_temp');
EVAL_NUMBER Function
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
EVAL_NUMBER (
olap_numeric_expression IN VARCHAR2)
RETURN NUMBER;
Parameters
Example
The following example returns the value of the DECIMALS option in the current
analytic workspace. The DECIMALS option controls the number of decimal places that
are shown in numeric output. In this example, the value of DECIMALS is 2, which is
the default.
SET serveroutput ON
SELECT dbms_aw.eval_number('decimals') "Decimals" FROM dual;
Decimals
----------
2
EVAL_TEXT Function
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
EVAL_TEXT (
olap_text_expression IN VARCHAR2)
RETURN VARCHAR2;
Parameters
Example
The following example returns the value of the NLS_LANGUAGE option, which
specifies the current language of the session.
SET serveroutput ON
SELECT dbms_aw.eval_text('nls_language') "NLS Language" FROM dual;
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
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');
The next example shows how EXECUTE continues to process commands after
encountering an error:
EXECUTE dbms_aw.execute('SHOW DECIMALS');
2
*
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
*
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
GETLOG Function
This function returns the session log from the last execution of the INTERP or
INTERPCLOB functions in this package.
To print the session log returned by this function, use the DBMS_AW.PRINTLOG
procedure.
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
GETLOG()
RETURN CLOB;
Returns
The session log from the latest call to INTERP or INTERPCLOB.
Example
The following example shows the session log returned by a call to INTERP, then
shows the identical session log returned by GETLOG.
EXECUTE dbms_aw.printlog(dbms_aw.interp('AW ATTACH global; REPORT units_cube'));
UNITS_CUBE
--------------
TIME
CUSTOMER
PRODUCT
CHANNEL
EXECUTE dbms_aw.printlog(dbms_aw.getlog());
UNITS_CUBE
--------------
TIME
CUSTOMER
PRODUCT
CHANNEL
INFILE Procedure
The INFILE procedure evaluates the OLAP DML commands in the specified file and
executes them in the current analytic workspace.
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
INFILE (
filename IN VARCHAR2);
Parameters
Example
The following example executes the OLAP DML commands in the finances.inf
file. The location of the file is identified by the WORK_DIR database directory.
EXECUTE dbms_aw.infile('work_dir/finances.inf');
INTERP Function
The INTERP function executes one or more OLAP DML commands and returns the
session log in which the commands are executed. It is typically used in applications
when the 4K limit on output for the EXECUTE procedure may be too restrictive.
Input to the INTERP function is limited to 4K. For larger input values, refer to the
INTERPCLOB function of this package.
This function does not return the output of the DML commands when you have
redirected the output by using the OLAP DML OUTFILE command.
You can use the INTERP function as an argument to the PRINTLOG procedure in this
package to view the session log. See the example.
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
INTERP (
olap-commands IN VARCHAR2)
RETURN CLOB;
Parameters
Returns
The log file for the Oracle OLAP session in which the OLAP DML commands were
executed.
Example
The following sample SQL*Plus session attaches the GLOBAL analytic workspace and
lists the members of UNITS_CUBE.
SET serverout ON
EXECUTE dbms_aw.printlog(dbms_aw.interp('AW ATTACH global; REPORT units_cube'));
UNITS_CUBE
--------------
TIME
CUSTOMER
PRODUCT
CHANNEL
INTERPCLOB Function
The INTERPCLOB function executes one or more OLAP DML commands and returns
the session log in which the commands are executed. It is typically used in
applications when the 4K limit on input for the INTERP function may be too
restrictive.
This function does not return the output of the OLAP DML commands when you have
redirected the output by using the OLAP DML OUTFILE command.
You can use the INTERPCLOB function as an argument to the PRINTLOG procedure in
this package to view the session log. See the example.
Syntax
INTERPCLOB (
olap-commands IN CLOB)
RETURN CLOB;
Parameters
Returns
The log for the Oracle OLAP session in which the OLAP DML commands were
executed.
Example
The following sample SQL*Plus session creates an analytic workspace named
ELECTRONICS, imports its contents from an EIF file stored in the dbs directory object,
and displays the contents of the analytic workspace.
SET serverout ON size 1000000
EXECUTE dbms_aw.printlog(dbms_aw.interpclob('AW ATTACH global; DESCRIBE'));
INTERP_SILENT Procedure
The INTERP_SILENT procedure executes one or more OLAP DML commands and
suppresses all output from them. It does not suppress error messages from the OLAP
command interpreter.
Input to the INTERP_SILENT function is limited to 4K. If you want to display the
output of the OLAP DML commands, use the EXECUTE procedure, or the INTERP or
INTERPCLOB functions.
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
INTERP_SILENT (
olap-commands IN VARCHAR2);
Parameters
Example
The following commands show the difference in message handling between EXECUTE
and INTERP_SILENT. Both commands attach the GLOBAL analytic workspace in
read-only mode. However, EXECUTE displays a warning message, while INTERP_
SILENT does not.
EXECUTE dbms_aw.execute('AW ATTACH global');
IMPORTANT: Analytic workspace GLOBAL is read-only. Therefore, you will not be able
to use the UPDATE command to save changes to it.
OLAP_ON Function
The OLAP_ON function returns a boolean indicating whether or not the OLAP option is
installed in the database.
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
OLAP_ON ( )
RETURN BOOLEAN;
Returns
The value of the OLAP parameter in the V$OPTION table.
Example
The following PL/SQL code tests the value returned by OLAP_ON and returns a status
message.
BEGIN
IF dbms_aw.olap_on() = true
THEN dbms_output.put_line('The OLAP option is installed');
ELSE dbms_output.put_line('The OLAP option is not installed');
END IF;
END;
/
OLAP_RUNNING Function
The OLAP_RUNNING function returns a boolean indicating whether or not the OLAP
option has been initialized in the current session. Initialization occurs when you
execute an OLAP DML command (either directly or by using an OLAP PL/SQL or
Java package), query an analytic workspace, or execute the STARTUP Procedure.
Note: You cannot execute this function from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
OLAP_RUNNING( )
RETURN BOOLEAN;
Returns
TRUE if OLAP has been initialized in the current session, or FALSE if it has not.
Example
The following PL/SQL script tests whether the OLAP environment has been
initialized, and starts it if not.
BEGIN
IF dbms_aw.olap_running() THEN
dbms_output.put_line('OLAP is already running');
ELSE
dbms_aw.startup;
IF dbms_aw.olap_running() THEN
dbms_output.put_line('OLAP started successfully');
ELSE
dbms_output.put_line('OLAP did not start. Is it installed?');
END IF;
END IF;
END;
/
PRINTLOG Procedure
This procedure sends a session log returned by the INTERP, INTERPCLOB, or GETLOG
functions of this package to the print buffer, using the DBMS_OUTPUT package in
PL/SQL.
When you are using SQL*Plus, you can direct the printer buffer to the screen by
issuing the following command:
SET SERVEROUT ON SIZE 1000000
The SIZE clause increases the buffer from its default size of 4K.
If you are using a different program, refer to its documentation for the equivalent
setting.
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
PRINTLOG (
session-log IN CLOB);
Parameters
Example
The following example shows the session log returned by the INTERP function.
SET serverout ON size 1000000
ALL_DIMENSIONS
------------------------------
TIME.DIMENSION
CUSTOMER.DIMENSION
PRODUCT.DIMENSION
CHANNEL.DIMENSION
RUN Procedure
The RUN 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 EXECUTE Procedure, RUN stops
processing commands when 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.
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
RUN (
olap_commands IN STRING,
silent IN BOOLEAN DEFAULT FALSE);
RUN (
olap_commands IN CLOB,
silent IN BOOLEAN DEFAULT FALSE);
RUN (
olap_commands IN STRING,
output OUT STRING);
RUN (
olap_commands IN STRING,
output IN OUT CLOB);
RUN (
olap_commands IN CLOB,
output OUT STRING);
RUN (
olap_commands IN CLOB,
output IN OUT CLOB);
Parameters
Example
The following sample SQL*Plus session attaches an analytic workspace named
XADEMO, creates a formula named COST_PP in XADEMO, and displays the new formula
definition.
EXECUTE dbms_aw.run('DESCRIBE time');
*
ERROR at line 1:
ORA-34492: Analytic workspace object NOTHING does not exist.
ORA-06512: at "SYS.DBMS_AW", line 58
ORA-06512: at "SYS.DBMS_AW", line 134
ORA-06512: at line 1
SHUTDOWN Procedure
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
SHUTDOWN (
force IN BOOLEAN DEFAULT NO);
Parameters
Example
The following commands save all changes to the GLOBAL analytic workspace and
close the user's OLAP session.
EXECUTE dbms_aw.aw_update('global_finance');
COMMIT;
EXECUTE dbms_aw.shutdown();
SPARSITY_ADVICE_TABLE Procedure
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
SPARSITY_ADVICE_TABLE (
tblname IN VARCHAR2 DEFAULT);
Parameters
Example
The following example creates a table named GLOBAL_SPARSITY_ADVICE.
EXECUTE dbms_aw.sparsity_advice_table('global_sparsity_advice');
STARTUP Procedure
Note: You cannot execute this procedure from within the OLAP
Worksheet. You must execute if in a SQL tool such as SQL*Plus.
Syntax
STARTUP ( );
Example
The following example starts an OLAP session.
EXECUTE dbms_aw.startup();
Note: This package is owned by the SYS user. You must explicitly be
granted execution rights before you can use it.
ALL_OLAP_ALTER_SESSION View
Each row of ALL_OLAP_ALTER_SESSION identifies a role and a session initialization
parameter. When a user opens a session using the OLAP API, the session is initialized
using the parameters for roles granted to that user.
OLAP_API_SESSION_INIT C-1
Viewing the Configuration Table
OLAP_API_SESSION_INIT C-3
ADD_ALTER_SESSION Procedure
ADD_ALTER_SESSION Procedure
This procedure specifies an ALTER SESSION parameter for OLAP API users with a
particular database role. It adds a row to the OLAP$ALTER_SESSION table.
Syntax
ADD_ALTER_SESSION (
role_name IN VARCHAR2,
session_parameter IN VARCHAR2);
Parameters
The role_name and session_parameter are added as a row in OLAP$ALTER_
SESSION.
Example
The following example inserts a row in OLAP$ALTER_SESSION that turns on query
rewrite for users with the OLAP_DBA role.
EXECUTE olap_api_session_init.add_alter_session('OLAP_DBA',
'SET QUERY_REWRITE_ENABLED=TRUE');
Row inserted
ROLE CLAUSE_TEXT
------------ ------------------------------------------------------------
OLAP_DBA ALTER SESSION SET QUERY_REWRITE_ENABLED=TRUE
CLEAN_ALTER_SESSION Procedure
This procedure removes all ALTER SESSION parameters for any role that is not
currently defined in the database. It removes all orphaned rows in the OLAP$ALTER_
SESSION table for those roles.
Syntax
CLEAN_ALTER_SESSION ();
Example
The following example deletes all orphaned rows.
EXECUTE olap_api_session_init.clean_alter_session();
OLAP_API_SESSION_INIT C-5
DELETE_ALTER_SESSION Procedure
DELETE_ALTER_SESSION Procedure
This procedure removes a previously defined ALTER SESSION parameter for OLAP
API users with a particular database role. It deletes a row from the OLAP$ALTER_
SESSION table.
Syntax
DELETE_ALTER_SESSION (
role_name IN VARCHAR2,
session_parameter IN VARCHAR2);
Parameters
The role_name and session_parameter together uniquely identify a row in
OLAP$ALTER_SESSION.
Examples
The following call deletes a row in OLAP$ALTER_SESSION that contains a value of
OLAP_DBA in the first column and QUERY_REWRITE_ENABLED=TRUE in the second
column.
EXECUTE olap_api_session_init.delete_alter_session('OLAP_DBA',
'SET QUERY_REWRITE_ENABLED=TRUE');
no rows selected
Index-i
AGGREGATE command, 9-60 to 9-64 ampersand substitution
AGGREGATE function, 7-24 to 7-31 example of, 2-46
aggregating data program arguments and, 4-4
caching, 6-171 QDR with, 2-31, 2-46
formulas for, 7-27 using to pass arguments, 4-4, 10-41
on-the-fly, 3-15 analytic workspace aliases
partitioned variables, 8-94 creating, 9-105
precomputing, 3-15 definition of, 2-24
specifying a relation for, 9-46 deleting, 9-105
using an Aggcount variable, 7-16 analytic workspaces
using an aggmap object, 3-13 accessing from SQL, B-1 to B-54
using TCONVERT, 8-187 aggregation, B-7
See also aggregation specifications aliases. See analytic workspace aliases
aggregation attached (list of), 8-74
in analytic workspaces, B-7 to B-10 attaching, 6-10, 9-106
AGGREGATION function, 7-32 to 7-33 content summary, displaying, 9-127
aggregation specifications converting to 10g storage format, B-2
compiling, 3-14 creating, 9-114
defining, 9-168 current, 2-25
deleting, 9-226 deleting, 9-116, 9-126
models in, 9-57, 10-80, 10-82 deleting objects from, 9-226
writing, 9-14 detaching, 4-24, 9-117
See also aggregating data exporting, 4-21
aggregations identifying active, 9-120
identifying changes, 7-72, 7-73, 7-217 importing, 4-21
algorithm for composite values, 6-154 importing from Oracle 9i, B-2
alias dimension naming, 2-24
deleting, 9-226 obtaining information about, 7-54
alias dimensions partitioning, 9-115
base dimensions (list of), 8-74 permission programs for, 4-14
defining, 9-186 segmenting, 9-124
deleting, 9-226 sharing, 6-10
limiting, 9-188 storage format, B-2
maintaining, 9-187 updating, 10-279
populating, 9-187 ANTILOG function, 7-36
retrieving list of, 8-74 ANTILOG10 function, 7-37
aliases ANY function, 7-38 to 7-39
for analytic workspaces, 2-24 arc tangent calculation, 7-43
for analytic workspaces. See analytic workspace ARCCOS function, 7-40
aliases ARCSIN function, 7-41
for dimensions See alias dimensions ARCTAN function, 7-42
ALLCOMPILE program, 9-69 ARCTAN2 function, 7-43
ALLOCATE command, 9-70 to 9-75 ARG command
allocating data See ARGUMENT command
using an aggmap object, 3-15 ARG function, 7-44 to 7-45
using TCONVERT, 8-187 ARGCOUNT function, 7-46
See also allocation specifications ARGFR function, 7-47 to 7-48
allocation specifications ARGS function, 7-49 to 7-50
defining, 9-168 ARGUMENT command, 9-99 to 9-103
deleting, 9-226 arguments, 7-44
writing, 9-77 in user-defined functions, 4-4
See also allocating data passing as text, 4-4, 10-41
ALLOCERRLOGFORMAT option, 6-8 passing to a program, 7-44, 7-46, 7-47, 7-49, 9-131
ALLOCERRLOGHEADER option, 6-9 using ampersand substitution with, 4-4
ALLOCMAP command, 9-77 to 9-79 arithmetic
ALLSTAT command, 9-98 with DATE values, 2-36
ALTER SESSION commands, C-1 ASCII function, 7-51
A.M. datetime format element, 9-160 Assign event, 10-264
AM datetime format element, 9-160
ampersand (&) operator, 2-46
Index-ii
assignment statements Boolean
event, 10-264, 10-274 data type, 2-15
trigger, 10-264, 10-274 expressions, 2-38 to 2-43
with different dimensionality, 8-224 operators, 2-19
with QDR, 2-30 values, 6-120, 6-174
authentication, 8-90 branching in programs, 9-130, 9-154, 9-303, 10-11,
encoding text expressions, 8-90 10-41, 10-251
within Oracle OLAP, 10-128 BREAK command, 9-130
AVERAGE function, 7-52 bucket numbers, retrieving, 8-239
AW command, 9-104 to 9-124 build number of Oracle OLAP, 7-130
AW ALIASLIST, 9-105 bytes strings, 2-16
AW ATTACH, 9-106 to 9-113
AW CREATE, 9-114 to 9-115
C
AW DELETE, 9-116
AW DETACH, 9-117 CACHE statement, 9-37, 9-38
AW FREEZE, 9-119 caches
AW LIST, 9-120 See OLAP session cache
AW PURGE, 9-122 caching, 9-122
AW ROLLBACK, 9-123 calculated members
AW SEGMENTSIZE, 9-124 adding to dimension, 10-80
AW THAW, 9-125 identifying, 7-218
events, 4-28 calculating a linear regression, 10-156
triggers, 4-28 CALENDARWEEK option, 6-14
AW function, 7-54 to 7-56 CALL command, 9-131
AW PURGE, 9-122 CALLTYPE function, 7-66
AW_ATTACH procedure (PL/SQL), B-28 case statement in programs, 10-251
AW_COPY procedure (PL/SQL), B-30 CATEGORIZE function, 7-67
AW_CREATE procedure (PL/SQL), B-31 CDA command, 9-135
AW_DELETE procedure (PL/SQL), B-32 CEIL function, 7-69
AW_DETACH procedure (PL/SQL), B-33 CHANGEBYTES function, 7-70
AW_RENAME procedure (PL/SQL), B-34 CHANGECHARS function, 7-71
AW_TABLESPACE function (PL/SQL), B-35 CHANGEDRELATIONS function, 7-72
AW_UPDATE procedure (PL/SQL), B-36 CHANGEDVALIES function, 7-73
AWDESCRIBE program, 9-127 to 9-128 characters
AWWAITTIME option, 6-10 representing as decimals, 2-5
representing as hexadecimals, 2-5
representing as Unicode, 2-5
B special, 2-5
BACK function, 7-34, 7-35, 7-57 CHARLIST function, 7-74
BADLINE option, 4-12, 6-11 CHGDFN command, 9-136
base dimensions CHGDIMS function, 7-76
finding values of, 7-60, 7-226 CHILDLOCK statement, 9-82
identifying, 7-58 CHR function, 7-78
setting status list of, 10-64 CLEANUP command
BASEDIM function, 7-58 See SQL command in OLAP DML
BASEVAL function, 7-60 CLEAR command, 9-143
B.C. datetime format element, 9-160 CLOSE command
BC datetime format element, 9-160 See SQL command in OLAP DML
BEGINDATE, 7-62 COALESCE function, 7-79
BIN_TO_NUM function, 7-63 code comments, 2-5
binary data, 2-16 columns
BITAND function, 7-64 default width in reports, 6-16, 6-50
bits, adding, 7-64 getting value from a report column, 7-80
BLANK command, 9-129 headings in a report, 10-2
blank lines in reports, 9-129 in reports, 6-16
BLANKSTRIP function, 7-65 multiline text, 7-133
BMARGIN option, 6-13 COLVAL function, 7-80
COLWIDTH function, 6-16
COMMAS option, 6-17
Index-iii
comments controlled sparsity, 9-177
code, 2-5 conversion
comments in programs, 4-3 rules, string to date, 2-10, 7-88
COMMIT command, 9-146 CONVERT function, 7-82
comparing CONVERT procedure (PL/SQL), B-37
dates, 2-42 converting
values, 2-40, 2-42 ROWID data type, 8-132, 8-133
comparison operators, 2-19 to DSINTERVAL, 8-201
compilable objects, 6-19 to YMINTERVAL, 8-210
COMPILE command, 9-147 converting data types
COMPILEMESSAGE option, 6-18 decimals to integers, 7-213
COMPILEWARN option, 6-19 introduction to, 2-17
compiling, 6-19 COPYDFN command, 9-155
aggmaps, 3-14 copying definitions, 9-155
aggregation specifications, 3-14 CORRELATION function, 7-90
models, 3-6 COS function, 7-93
programs, 4-11 COSH function, 7-94
SQL statements, 10-239 cosine calculation, 7-93, 7-94
suppressing error messages, 6-18 COUNT function, 7-95
composites, 2-28 CUMSUM function, 7-97
base dimension values, 7-226 cumulative totals, 7-97, 8-136
changing to conjoint dimensions, 9-136 current
defining, 1-8, 9-171 analytic workspace, 2-25
deleting, 9-226 current directory, 9-135
deleting values of, 10-89 changing, 9-135
index algorithm, 6-154 identifying, 9-135
index type (determining), 8-76 current outfile, 6-36, 10-121
listing associated objects, 10-66 current status list
maintaining, 10-74 setting, 10-33
reporting, 10-167, 10-183 CURRENT_DATE function, 7-100
showing a value, 10-202 CURRENT_TIMESTAMP function, 7-101
specifying values for, 2-27 cursors, 10-219
specifying values of, 2-27 closing (SQL), 10-219
testing for a value, 7-219 importing (SQL), 10-233
unnamed, 9-218 custom measures, A-5
See also unnamed composites examples with OLAP_
composites (regular and compressed) EXPRESSION, A-30 to A-31
defined, B-4
concat dimensions
D
defining, 9-184
deleting, 9-226 data
specifying values for, 2-27 binary, 2-16
See also dimensions data fetches (SQL), 10-226
conditional, 2-43 data type conversions, A-16
conditional execution of commands, 9-229
conditional expressions, 2-43 to 2-44
IF, 2-43
SWTICH, 2-45
conditional operators, 2-43
conjoint dimensions
base dimension values, 7-226
changing to composites, 9-136
defining, 9-181
deleting, 9-226
index type (determining), 8-76
See also dimensions
CONSIDER command, 9-151
CONTEXT command, 4-8, 9-152
CONTEXT function, 4-8, 7-81
CONTINUE command, 9-154
Index-iv
data types datetime format elements
Boolean, 2-15 and Globalization Support, 9-160
converting, 2-17 capitalization, 9-161
creating a report, 10-167, 10-183 ISO standard, 9-159
DATE, 2-6 RR, 9-160
date, 2-8, 2-9, 2-11 suffixes, 9-160
DATETIME, 2-8 datetime values
determining data type of an object, 8-74 truncating, 8-220
DSINTERVAL, 2-14 DAY datetime format element, 9-160
for variables, 9-205 DAYABBRLEN option, 6-26
numeric, 2-4 DAYNAMES option, 6-28
of expressions, 2-21 DAYOF function, 7-102
of numeric expressions, 2-32 DBDESCRIBE program
of user-defined function, 4-4 name change, xxxviii
qualifying data for expressions, 8-97 See AWDESCRIBE program
RAW, 2-16 DBGOUTFILE command, 4-13, 9-163
restricting access, 10-128 and ECHOPROMPT, 6-36
ROWID, 2-16 DBMS_AW package, B-1 to B-54
showing a single value, 10-202 DBMS_AW PL/SQL package
text, 2-5 ADD_DIMENSION_SOURCE procedure, B-14
TIMESTAMP, 2-12 ADVISE_CUBE procedure, B-16
TIMESTAMP_LTZ, 2-13 ADVISE_DIMENSIONALITY function, B-18
TIMESTAMP_TZ, 2-12 ADVISE_DIMENSIONALITY procedure, B-20
transferring from one format to another, 8-224 ADVISE_REL procedure, B-24
UROWID, 2-17 ADVISE_SPARSITY procedure, B-25
YMINTERVAL, 2-13 AW_ATTACH procedure, B-28
DATABASE command AW_COPY procedure, B-30
name change, xxxviii AW_CREATE procedure, B-31
See AW command AW_DELETE procedure, B-32
DATABASE function AW_DETACH procedure, B-33
name change, xxxviii AW_RENAME procedure, B-34
See AW function AW_TABLESPACE function, B-35
database initialization, C-1 AW_UPDATE procedure, B-36
DATE data types, 2-6 CONVERT procedure, B-37
date data types, 2-8, 2-9, 2-11 EVAL_NUMBER function, B-38
date format models, 9-157 EVAL_TEXT function, B-39
long, 9-157 EXECUTE procedure, B-40
punctuation in, 9-161 GETLOG function, B-42
short, 9-157 INFILE procedure, B-43
text in, 9-161 INTERP function, B-44
DATE_FORMAT, 9-156 INTERP_SILENT function, B-46
DATEFORMAT option, 6-20 INTERPCLOB function, B-45
DATEORDER option, 6-24 OLAP_ON function, B-47, B-48
dates, 8-178, 8-212 PRINTLOG procedure, B-49
arithmetic, 2-36 RUN procedure, B-50
comparing, 2-42 SHUTDOWN procedure, B-52
current, 8-178, 8-212 SPARSITY_ADVICE_TABLE procedure, B-53
in arithmetic expressions, 2-38 STARTUP procedure, B-54
in text expressions, 2-34 DBMS_AW$_COLUMNLIST_T table, B-5
datetime arithmetic, 2-36 DBMS_AW$_DIMENSION_SOURCE_T object
datetime data type, B-5
format of, 9-156 DBMS_AW$_DIMENSION_SOURCES_T table
DATETIME data type, 2-34 type, B-5
DATETIME data types, 2-8 DBTIMEZONE function, 7-103
datetime expressions, 2-35 DBWAITTIME option
name change, xxxviii
See AWWAITTIME option
DDOF function, 7-104
DEADLOCK statement, 9-83
Index-v
debugging, 6-48 definitions
models, 3-12 copying, 9-155
programs, 4-12 to 4-13 creating, 9-166
decimal data types, comparing, 2-41 creating object properties, 10-142
decimal marker (displayed), 6-29 deleting, 9-226
decimal places (displayed), 6-31 moving within NAME dimension, 10-119
decimal values, 6-29 report of, 9-227, 9-301
decimal marker for output, 6-29 testing for, 7-128
truncating to an integer, 7-213 DELETE command, 9-226
DECIMALCHAR option, 6-29 event, 10-263
DECIMALOVERFLOW option, 6-30 trigger, 10-263
DECIMALS option, 6-31 Delete event, 10-263
DECLARE CURSOR command deleting
See SQL command in OLAP DML alias dimensions, 9-226
DECODE function, 7-105 composite values, 10-89
default composites, 9-226
outfile, 10-121 definitions, 9-226
relations, 2-27, 10-159 dimension alias, 9-226
default status list dimension values, 10-87
determining if in effect, 8-153 dimensions, 9-226
DEFAULTAWSEGSIZE option, 6-33 formulas, 9-226
DEFAULTDBFSIZE option models, 9-226
name change, xxxviii objects, 9-226
See DEFAULTAWSEGSIZE option partition templates, 9-226
DEFINE AGGMAP command, 9-168, 9-168 to 9-170 partitions, 9-226
DEFINE command, 9-166 programs, 9-226
events, 4-31 surrogates, 9-226
triggers, 4-31 triggers, 10-264
DEFINE COMPOSITE command, 1-8, 9-171 valuesets, 9-226
DEFINE DIMENSION ALIASOF DEPRDECL function, 7-108
command, 9-186 to 9-187 DEPRDECLSW function, 7-112
DEFINE DIMENSION command, 9-175 depreciation of assets, 7-108, 7-112, 7-117, 7-120
DEFINE FORMULA command, 9-189 DEPRSL function, 7-117
DEFINE MODEL command, 9-191 DEPRSOYD function, 7-120
DEFINE PARTITION TEMPLATE command, 9-193 DESCRIBE command, 9-227
DEFINE PROGRAM command, 9-195 descriptions
DEFINE RELATION command, 9-197 adding to a definition, 10-32
DEFINE SURROGATE command, 9-199 deleting from a definition, 10-32
DEFINE VALUESET command, 9-202 detaching
DEFINE VARIABLE command, 9-205 analytic workspaces, 4-24
DEFINE WORKSHEET command, 9-224 dimension alias
defining See alias dimensions
aggmap objects, 9-168 DIMENSION command, in a model, 10-104
alias dimensions, 9-186 DIMENSION statement
analytic workspace objects, 9-166 for aggregation, 9-40
dimension alias, 9-186 for allocation, 9-84
dimensions, 9-175 dimension status
formulas, 9-189 effect on expressions, 2-22
partitions, 9-193 null, 6-122
programs, 9-195 restoring, 4-7
relations, 9-197 saving current, 4-7
surrogates, 9-199 dimension surrogates
valuesets, 9-202 assigning values to, 10-194
variables, 9-205 defining, 9-199
worksheet objects, 9-224
Index-vi
dimension values double quotes, 2-5
comparing, 2-41 DSECONDS option, 6-35
counting related values, 8-183 DSINTERVAL data type, 2-14
deleting values of, 10-87 DSINTERVAL function, 8-201
latest value, 8-161 DY datetime format element, 9-160
null, 6-122
number of (determining), 8-75, 8-76
E
number of values in status, 8-158
place in status list, 8-165 ECHOPROMPT option, 4-13, 6-36
retrieving current status list EDIT command, 9-231
retrieving, 8-159 editing previously executed commands, 10-154
returning first value in status, 8-156 EIF file, 4-21, 9-234
returning last value in status, 8-157 exporting data from, 9-234
setting the status of, 10-33 importing data from, 10-13
sorting, 8-147, 10-207 EIFBYTES option, 6-37
testing for, 7-219 EIFEXTENSIONPATH option, 6-38
using qualified data reference, 8-97 EIFNAMES option, 6-39
using result of LIMIT command, 8-20 EIFSHORTNAMES option, 6-40
dimensionality, changing, 7-76 EIFTYPES option, 6-41
dimension-based equations, 3-3 EIFUPDBYTES option, 6-42
dimensions EIFVERSION option, 6-43
acquired, 7-54 embedded-total dimension views, A-18
checking status of, 8-153 embedded-total fact view, A-19
comparing values, 2-41 encoding, 8-90
defining, 9-175 ENDDATE function, 7-124
defining surrogates for, 9-199 ENDOF function, 7-125
deleting, 9-226 EQ command, 9-232
determining status of, 8-153 equations, dimension-based, 3-3
limiting, 10-33 ERRNAMES option, 6-44
limiting to single value, 2-28 error messages, 10-202
listing associated objects, 10-66 creating your own, 4-10
looping over values of, 9-291, 9-292 deferring, 4-8
maintaining, 10-74 displaying, 6-173
numeric value of text dimension, 2-33 option holding text of, 6-46
of expression, 2-21, 2-22 producing without error condition, 10-202
order in models, 10-106 signaling error condition, 10-204
QDR with, 2-28, 2-31 suppressing, 4-10, 6-18
related, 2-27, 10-159 suppressing during compilation, 6-18
restoring previous values, 4-7 wrapping, 6-173
saving current values, 4-7 ERRORLOG statement, 9-85
See also alias dimensions, base dimensions, concat ERRORMASK statement, 9-86
dimensions, conjoint dimensions, simple ERRORNAME option, 4-8, 6-45
dimensions errors
sorting values, 10-95 controlling during calculations, 2-33
status lists, 8-154 handling, 4-8
type of (determining), 8-76 handling in nested programs, 10-261
worksheet, 9-224 handling in programs, 10-260
directory name of first-occurring error, 6-45
changing, 9-135 signaling, 4-10, 10-261
identifying current, 9-135 SQL error codes, 6-156
displaying error messages, 6-173 when comparing numeric data, 2-40, 2-41
DIVIDEBYZERO option, 6-34 ERRORTEXT option, 4-8, 6-46
division, 8-107 escape character for LIKE, 6-53
by zero, 6-34 escape sequences, 2-5
calculating the remainder, 8-107 ESCAPEBASE option, 6-47
DO command, 9-229, 9-290 EVAL_NUMBER function (PL/SQL), B-38
used with FOR, 9-290 EVAL_TEXT function (PL/SQL), B-39
used with SWITCH, 10-251
used with WHILE, 10-290
DOEND command, 9-229
Index-vii
events FCEXEC command, 9-244
Assign, 10-264, 10-274 FCOPEN command, 7-138
assignment statements, 10-264 FCQUERY command, 7-139
Define, 4-31 FCSET command, 9-248
Delete, 10-263 FETCH command
deleting, 10-264 See SQL command in OLAP DML
identifying, 8-216 FETCH command (OLAP DML), A-17, A-22
Maintain, 10-263 fetching data (SQL), 10-226
Property, 10-264 file I/O, 7-147, 7-151, 9-257, 9-261, 9-263, 9-265, 9-279
Update, 4-27, 4-29, 10-264 closing, 7-147, 9-257
EVERSION function, 7-130 current directory, 9-135
EVERY function, 7-126 diagnosing errors when processing, 7-144
EXECUTE procedure (PL/SQL), B-40 forcing a page break, 9-261
EXISTS function, 7-128 gathering information about, 7-153
EXP function, 7-129 list of open files, 10-67
exponential forecasting, 9-293 opening, 7-151
exponents, retrieving, 7-129 processing data from, 9-282
EXPORT command, 4-21, 9-234 reading a record, 7-149
EXPORT to EIF command, 9-235 reading data from, 9-265
EXPORT to spreadsheet command, 9-241 reading Oracle OLAP commands from a
exporting data, 6-37, 9-235 file, 7-171, 10-30
expressions records read, 8-106
ampersand substitution, 2-46 setting attributes, 9-279
Boolean, 2-38 to 2-43 writing, 9-263
changing dimensionality of, 7-76 FILECLOSE command, 9-257
comparing, 8-66 FILECOPY command, 9-258
conditional, 2-43, 2-43 to 2-45 FILEDELETE command, 9-259
data type of, 2-21 FILEERROR function, 7-144
dates in, 2-38 FILEGET function, 7-147
datetime, 2-35 FILEMOVE command, 9-260
defined, 2-20 FILENEXT function, 7-149
determining dimensions of, 2-22 FILEOPEN function, 7-151
dimensions of, 2-21, 2-22 FILEPAGE command, 9-261
dimensions status, 2-22 FILEPUT command, 9-263
empty cells, 2-31 FILEQUERY function, 7-153
interval, 2-35 FILEREAD command, 9-265
NA values in, 2-31 files
numeric, 2-32 to 2-34 appending output, 10-122
objects in, 2-23 to 2-28 importing data from, 10-22
padding, 8-30, 8-134 saving output in, 10-122
parsing, 10-126 FILESET command, 9-279
retrieving largest, 7-175 fileunits, 7-151, 7-153
retrieving smallest, 8-18 attributes, 7-153
saving, 9-189 number of outfile destination, 6-123
substitution, 2-45 to 2-46 opening, 7-151, 10-121
text, 2-34 reading data from, 9-265
trimming, 8-31, 8-135 setting attributes, 9-279
using objects in, 2-28 FILEVIEW command, 9-282
using qualified data references in, 8-97 FILTERLINES function, 7-156
EXPTRACE option, 6-48 financial analysis, scenario modeling, 3-6
EXTBYTES function, 7-131 FINDBYTES function, 7-158
EXTCHARS function, 7-132 FINDCHARS function, 7-160
EXTCOLS function, 7-133 FINDLINES function, 7-162
EXTLINES function, 7-135 FINTSCHED function, 7-163
EXTRACT function, 7-136 floating point numbers, comparing, 2-40
floating-point format
limitations when calculating, 2-33
F
use of, 2-33
fastest-varying dimension, 9-210 FLOOR function, 7-166
FCCLOSE command, 9-243
Index-viii
FOR command, 9-229, 9-290 hash partitions, 9-115
breaking out of, 9-130 heading, 10-2
example of, 9-292 for a report, 10-2
looping over dimension values, 9-291, 9-292 for output pages, 6-126
used with BREAK, 9-130 including a page number, 6-124
used with CONTINUE, 9-154 producing standard report heading, 10-249
used with OKFORLIMIT, 6-121 HEADING command, 10-2 to 10-3
used with TEMPSTAT, 10-254 Help version, 0-xxvi
FORECAST command, 9-293 HIDE command, 10-4
FORECAST function, 7-187 HIERHEIGHT command, 10-7
forecasting context, 9-243 HIERHEIGHT function, 7-182
closing, 9-243 Holt-Winters forecasting, 9-293
executing, 9-244 hyperbolic
opening, 7-138 cosine calculation, 7-94
querying, 7-139 sine calculation, 8-141
setting characteristics of, 7-138 tangent calculation, 8-186
FORECAST.REPORT program, 9-296, 9-299
format model, 9-156
I
format models, 2-10
date IF command, 9-229, 10-11
changing, 2-10, 9-156 IF conditional expression, 2-43
default format, 2-10, 9-156 IFNONE keyword, 10-41
formats IMPORT command, 4-21, 10-13 to 10-29
for dates and numbers. See format models See also SQL command in OLAP DML
of return values from the database, 2-10 importing data, 6-37, 6-42
of values stored in the database, 2-10 controlling update frequency, 6-42
formatting from an analytic workspace, 10-14
datetime data, 9-156 from spreadsheets, 10-27
formulas from text files, 10-22
aggmap objects in, 8-74 tracking names of objects, 6-39
aggregating data with, 7-27 tracking types of objects, 6-41
compiling, 6-19, 9-147 INCLUDE command, 10-108
defining, 9-189 INF_STOP_ON_ERROR option, 6-49
deleting, 9-226 INFILE command, 10-30
expression for (retrieving), 8-76 INFILE procedure (PL/SQL), B-43
recursive, 6-144 INFO function, 7-186 to 7-200
specifying new expression, 9-232 FORECAST, 7-187
FPMTSCHED function, 7-167 MODEL, 7-190
FROM_TZ function, 7-170 PARSE, 7-197
FULLDSC program, 9-301 REGRESS, 7-199
functions INITCAP function, 7-201
calling, 9-131 initialization parameters, C-1
user-defined, 4-4, 9-131, 10-179 init.ora file, C-1
INLIST function, 7-202
input file
G reading from a file, 7-171, 10-30
GET function, 7-171 with SNAPI connection, 7-171
GETLOG function (PL/SQL), B-42 with XCA dialog, 7-171
GOTO command, 9-303 INSBYTES function, 7-203
GREATEST function, 7-175 INSCHARS function, 7-204
group marker, 6-162 INSCOLS function, 7-205
grouping ids, 5-18, 5-19, 5-20 INSLINES function, 7-207
GROUPINGID command, 9-306 INSTAT function, 7-208
GROUPINGID function, 7-176 integer part of decimal number, 7-213
GROWRATE function, 7-177 interest on loans, 7-163, 8-232
growth rate, 7-177 internal rate of return, 7-214
INTERP function (PL/SQL), B-44
INTERP_SILENT procedure (PL/SQL), B-46
H
INTERPCLOB function (PL/SQL), B-45
handling errors in programs, 10-260
Index-ix
interval limit maps, A-1, A-15, A-17
arithmetic, 2-36 order of processing, A-17
INTERVAL expressions, 2-35 syntax, A-9
INTPART function, 7-213 limiting
IRR function, 7-214 alias dimensions, 9-188
ISDATE program, 7-216 dimensions, 10-33
ISEMPTY function, 7-217 multidimensional valuesets, 9-203
ISSESSION function, 7-218 LIMITMAPINFO function, 8-24
ISVALUE function, 7-219 LIMIT.SORTREL option, 6-58
LIMITSTRICT option, 6-59, 10-45
line size for report heading, 6-68
J
LINENUM option, 6-62
JOINBYTES function, 7-220 lines on a page of report output, 6-129
JOINCHARS function, 7-221 LINESLEFT option, 6-64
JOINCOLS function, 7-223 LISTBY program, 10-66
JOINLINES function, 7-225 LISTFILES command, 10-67
LISTNAMES program, 10-68
K literals
numeric, 2-4
KEY function, 7-226 text, 2-34
LOAD command, 10-71
L loans, 7-163
interest payment on, 7-163
label column width, 6-50
interest payments on, 8-232
branching in a program, 9-303
payment on, 7-167
for error handling in programs, 10-260
payments on, 8-235
labels, 9-303
local variables, 10-281
in programs, 4-11
locale independent, 9-157
with IFNONE, 10-41
LOCALTIMESTAMP function, 8-26
LAG function, 3-5, 8-2
LOG command, 10-72
LAGABSPCT function, 8-5
LOG function, 8-27
LAGDIF function, 8-8
LOG10 function, 8-28
LAGPCT function, 8-10
logical operators, 2-19
larger value of two expressions, 8-34
logs
LARGEST function, 8-12
calculating base 10 logarithm, 8-28
largest value of an expression, 8-12
calculating natural logarithm, 8-27
LAST_DAY function, 8-14
LOOP clause in SQL FETCH, 10-226
LCOLWIDTH option, 6-50
looping, 9-290
LD command, 10-32
over dimension status, 9-290
LEAD function, 3-5, 8-15
looping, explicit, 5-21, 5-22, 5-23
LEAST function, 8-18
LOWCASE function, 8-29
LENGTH function, 8-19
lowercase, converting to, 8-29
LENGTH2 function, 8-19
LPAD function, 8-30
LENGTH4 function, 8-19
LSIZE option, 6-68
LENGTHB function, 8-19
LTRIM function, 8-31
LENGTHC function, 8-19
LIKE operator, 6-53, 6-56
LIKECASE option, 6-52 M
LIKEESCAPE option, 6-53 MAINTAIN command
LIKENL option, 6-56 event, 10-263
LIMIT BASEDIMS command, 10-64 MAINTAIN ADD, 10-77
LIMIT command, 10-33 MAINTAIN ADD for DAY, WEEK, MONTH,
using LEVELREL, 10-52 to 10-53 QUARTER and YEAR values, 10-79
using NOCONVERT, 10-62 MAINTAIN ADD for TEXT, ID, and INTEGER
using parent relation, 10-57 to 10-61
using POSLIST, 10-63
using related dimension, 10-54 to 10-56
using values, 10-42 to 10-51
LIMIT function, 8-20
Index-x
values, 10-77 MODGAMMA option, 6-76
MAINTAIN ADD SESSION, 10-80 MODINPUTORDER option, 6-79
MAINTAIN DELETE, 10-87, 10-89 MODMAXITERS option, 6-81
MAINTAIN MERGE, 10-92 MODOVERFLOW option, 6-82
MAINTAIN MOVE, 10-94 MODSIMULTYPE option, 6-84
MAINTAIN RENAME, 10-98 MODTOLERANCE option, 6-87
trigger, 10-263 MODTRACE option, 6-90
Maintain event, 10-263 module version numbers, 7-130
maintaining MODULO function, 8-43
alias dimensions, 9-187 MON datetime format element, 9-160
composites, 10-74 MONITOR command, 10-115
dimensions, 10-74 monitoring, 10-115
partition templates, 10-74 cost of program lines, 10-115
partitions, 10-74 cost of programs, 10-256
MAKEDATE function, 8-32 MONTH datetime format element, 9-160
margins, 6-13 MONTHABBRLEN option, 6-93
setting bottom margin, 6-13 MONTHNAMES option, 6-95
setting top margin, 6-163 MONTHS_BETWEEN function, 8-44
MAX function, 8-34 MOVE command, 10-119
MAXBYTES function, 8-35 MOVINGAVERAGE function, 8-45
MAXCHARS function, 8-36 MOVINGMAX function, 8-48
MAXFETCH option, 6-70 MOVINGMIN function, 8-50
maximum values, 8-48 MOVINGTOTAL function, 8-52
for each time period in the status, 8-48 multidimensional valuesets, 9-203
larger of two expressions, 8-34 multiline text
MEASUREDIM statement columns, 7-133
for aggregation, 9-43 MULTIPATHHIER option, 6-97
for allocation, 9-87 multiwriter mode, 7-54, 9-9, 9-108
MEDIAN function, 8-37
median value, 8-37
N
messages, suppressing, 6-18
MIN function, 8-39 NA values
minimum value, 8-50 accepted as numeric input, 6-100, 6-103
for each time period in the status, 8-50 caching, 6-171
smaller of two expressions, 8-39 comparing, 2-40
MMOF function, 8-40 controlling how treated, 2-32
MOD function, 8-43 in Boolean expression, 2-40
MODDAMP option, 6-71 in expressions, 2-31
MODE function, 8-41 NA2 bits, 2-32, 9-209
models permanently replacing, 6-167
adding to aggmap, 9-57 replacing, 8-73
compiling, 3-6, 9-147, 10-101 replacing with strings, 8-72
creating, 10-101 retrieving, 7-79
debugging, 3-12 spelling of, 6-107
defining, 9-191 substituting another value, 8-55
deleting, 9-226 triggers, 6-165, 6-167
editing, 10-101 NA2 bits, 2-32, 9-209
in aggregation specifications, 9-57, 10-80, 10-82 NA2 function, 8-54
obtaining information about, 7-190 NA2 values, 8-54, 8-56
removing from aggmap, 9-57 NAFILL function, 8-55
running, 3-10, 10-101 NAFLAG function, 8-56
scenario, 3-6 name, 10-68
solution variables, 3-3 changing object name, 10-165
MODEL.XEQRPT program dimension, 10-68
compiling, 6-19 listing names of dictionary entries, 10-68
defining, 9-191, 9-193 NAME dimension, 10-68 to 10-69
including, 10-108 names
nesting, 10-108 listing for objects, 10-68
options, 6-71, 6-76, 6-79, 6-81, 6-82, 6-84, 6-87 listing objects by, 10-66
MODERROR option, 6-74 qualified object, 2-24
Index-xi
NASKIP option, 6-100 NVL function, 8-72
NASKIP2 option, 6-103 NVL2 function, 8-73
NASPELL option, 6-107, 9-102
NATRIGGER
O
See $NATRIGGER
natural logarithm, 8-27 OBJ function, 8-74
negative value, 6-133 object definitions
in output, 6-133 adding descriptions to, 10-32
obtaining the root, 6-146 deleting descriptions from, 10-32
net present value, 8-64 object types
NEW_TIME function, 8-57 automatic, A-2, A-16
NEXT_DAY function, 8-59 predefining, A-2, A-16
NLS_CALENDAR option, 6-109 syntax for creating, A-2, A-15
NLS_CURRENCY option, 6-110 objects, 9-155
NLS_DATE_FORMAT option, 6-111 acquired (list of), 7-54
NLS_DATE_LANGAUGE option, 6-112 checking for changes, 8-75
NLS_DATE_LANGUAGE initialization compiling, 6-19
parameter, 9-161 creating by copying, 9-155
NLS_DUAL_CURRENCY option, 6-113 creating properties, 10-142
NLS_ISO_CURRENCY option, 6-114 data type of (determining), 8-75
NLS_LANG option, 6-115 defining, 9-166
NLS_LANGUAGE initialization parameter, 9-161 definition (retrieving), 8-75
NLS_LANGUAGE option, 6-116 deleting, 9-226
NLS_NUMERIC_CHARACTERS option, 6-117 describing its definition, 9-227
NLS_SORT option, 6-118 describing its properties, 9-301
NLS_TERRITORY initialization parameter, 9-161 dimensions of (retrieving), 8-75, 8-76
NLS_TERRITORY option, 6-119 dropping changes, 10-181
NLSSORT function, 8-60 exporting from analytic workspace, 9-234
NONE function, 8-61 identifying triggers, 8-216
NORMAL function, 8-63 importing into analytic workspace, 10-13
NOSPELL option, 6-120 in expressions, 2-23 to 2-28
NPV function, 8-64 listing, 8-88
null values listing names of, 10-66, 10-68
See NA values loading, 10-71
NULLIF function, 8-66 making current, 9-151
numbers obtaining information, 8-74
assigning random numbers, 8-100 pages used to store (determining), 8-76
commas in output, 6-17 qualified name, 2-24
decimal marker for output, 6-29 recalculating permissions, 10-135
decimal places in output, 6-31 renaming, 10-165
determining sign of, 8-139 restrictions on name, 9-166
negative values in output, 6-133 storage class (determining), 8-75
rounding, 8-123 testing for existence, 7-128
spelling out, 9-160 OBJLIST function, 8-88
thousands marker for output, 6-162 OBSCURE function, 8-90
NUMBYTES function, 8-67 OESEIFVERSION option
NUMCHARS function, 8-68 name change, xxxviii
numeric data types, 2-4 See EIFVERSION option
comparing, 2-40, 2-41 OKFORLIMIT option, 6-121
mixing, 2-32 OKNULLSTATUS option, 6-122, 10-37
numeric expressions, 2-32 to 2-34 OLAP, A-29
data type of the result, 2-32 OLAP API
dates in, 2-38 optimization, C-1
mixing data types, 2-32 OLAP DML
text dimensions in, 2-33 executing in SQL, A-24, A-29, A-38, B-3, B-49
numeric values quotation marks in, B-4
rounding, 8-123
NUMLINES function, 8-69
NUMTODSINTERVAL function, 8-70
NUMTOYMNTERVAL function, 8-71
Index-xii
OLAP session cache OUTFILE command, 10-121, 10-122
blocking creation of, 6-148 affect on DBMS_AW.EXECUTE, B-40
checking if empty, 8-74 affect on DBMS_AW.RUN, B-50
defined, 6-148 OUTFILEUNIT option, 6-123
for variable, 8-76 out-of-range decimal values, 6-30
non-NA values, 8-75 output, 10-121
populating with aggregated values, 6-171, 9-37 redirecting, 10-121
populating with NA values, 6-171 saving in a file, 10-122
OLAP_API_SESSION_INIT package, C-1 to C-6 overflow condition, 6-30
OLAP_CONDITION function (SQL), A-17,
A-24 to A-25
P
OLAP_EXPRESSION function (SQL), A-29, B-3
OLAP_EXPRESSION_BOOL function (SQL), A-32 padding expressions, 8-30, 8-134
OLAP_EXPRESSION_DATE function PAGE command, 10-124
(SQL), A-36 to A-37 PAGENUM option, 6-124
OLAP_EXPRESSION_TEXT function (SQL), A-38 PAGEPRG option, 6-126
OLAP_ON function (PL/SQL), B-47, B-48 PAGESIZE, 6-129
OLAP_TABLE paging in reports, 10-124
optimizing looping, 5-21, 5-22, 5-23 forcing a page break, 10-124
OLAP_TABLE function (SQL), A-7 to A-23 line number on current page, 6-62
custom measures, A-29, A-32, A-36, A-38 lines for bottom margin, 6-13
data map parameter, A-17 lines for top margin, 6-163
data type conversions, A-16 lines left on page, 6-64
examples, A-18 lines on a page, 6-129
FETCH command, A-17, A-22 page number, 6-124
limit map, A-1, A-15, A-17 producing a custom heading, 6-126
retrieving session log, B-42 producing a standard heading, 10-249
specifying a ROW2CELL column, A-13 turning on, 6-131
specifying an OLAP DML command, A-15 PAGING option, 6-131
specifying the analytic workspace, A-7 PARENS option, 6-133
specifying the logical table, A-8 PARSE command, 7-197, 10-126
ONATTACH program, 4-23 parsing expressions, 10-126
ONDETACH program, 4-24 PARTITION function, 8-92
OPEN command See SQL command in OLAP partition templates, 9-193
DML, 10-238 defining, 9-193
operating system, identifying, 8-181 deleting, 9-226
operators, 6-56 maintaining, 10-74
Boolean, 2-19 retrieving partition names, 8-78
comparisons, 2-19 retrieving partitioning method, 8-78
conditional, 2-43 PARTITIONCHECK function, 8-94
LIKE, 6-52, 6-53, 6-56 partitioned variables, 9-193, 9-205
logical, 2-19 aggregating, 8-94
overview, 2-18 defining, 9-205
substitution, 2-46 deleting data from, 10-90
optimization maintaining, 10-96
OLAP API, C-1 retrieving dimensions of, 8-78
options retrieving partitioning method, 8-78
displaying value of, 6-1 partitioning methods, 8-78
restoring previous values, 4-7 partitions, 9-193, 9-205
retrieving, 6-1 adding values to, 10-85, 10-96
saving current values, 4-7 defining, 9-193
specifying, 6-1
Oracle OLAP
internal build number, 7-130
ordinal numbers
specifying, 9-160
spelling out, 9-160
outfile
current, 6-36
Index-xiii
list partitions, 9-193 programs
deleting, 9-226 adding program contents to a definition, 10-139
deleting data, 10-90 branching, 9-130, 9-154, 10-251
identifying for value, 8-92 branching in, 10-41
list, 9-193 branching labels, 9-303
locking segments of, 10-239 calling, 9-131
moving values, 10-96 case statement, 10-251
range, 8-78, 9-193 comment lines in, 4-3
retrieving dimensions of, 8-78 compiling, 4-11, 6-19, 9-147, 9-149
retrieving names of, 8-78 conditional execution of commands, 10-11, 10-290
specifying values of, 10-96 debugging, 4-12 to 4-13, 6-48
pattern matching, 2-43 declaring arguments in, 4-4
payment schedules, 7-163 defining, 9-195
for loan interest, 7-163, 8-232 deleting, 9-226
for loans, 7-167, 8-235 determining how invoked, 7-66
PERCENTAGE function, 8-95 error handling, 6-45, 6-46, 10-260
permission programs, 4-14, 4-23, 4-25, 4-26 errors in, 4-8
permissions, 10-128 executing, 4-13
assigning to an object definition, 10-128 halting execution with an error, 10-204
recalculating permission, 10-135 hiding, 10-4
specifying conditions for accessing, 10-135 local variable, 10-281
violations of, 6-135 passing arguments to, 7-44, 7-46, 7-47, 7-49
PERMIT command, 10-128 performance cost, 10-256
PERMIT_READ program, 4-14, 4-25 permission, 4-14, 4-23, 4-25, 4-26
PERMIT_WRITE program, 4-14, 4-26 preserving environment, 4-6
PERMITERROR option, 6-135 preserving status, 7-81, 9-152
PERMITRESET command, 10-135 repeating commands, 9-290
platform, determining, 8-181 restoring previous values, 4-7
P.M. datetime format element, 9-160 restoring status, 10-137, 10-138
PM datetime format element, 9-160 returning a value, 10-179
POP command, 4-7, 10-137, 10-138 saving compiled code, 4-11
popping a whole series at once, 10-138 saving current values, 4-7
POPLEVEL command, 10-138 saving status, 10-144, 10-146
nesting, 10-147 startup, 4-14
using, 4-8 suspending execution, 10-206
populating terminating execution of, 10-179
alias dimensions, 9-187 timing execution, 10-115, 10-256
POUTFILEUNIT option, 6-137 trigger, 4-17, 4-27, 4-28, 4-29, 4-31, 10-274
PRECOMPUTE statement, 9-45 unhiding, 10-278
PREPARE command properties, 10-142
See SQL command in OLAP DML copying with an object definition, 9-155
PRGERR keyword (SIGNAL), 10-261 creating for objects, 10-142
PRGTRACE option, 6-139 listing for objects, 9-301
print buffer, B-40, B-50 PROPERTY command, 10-142
PRINTLOG procedure (PL/SQL), B-49 event, 10-264
PROCEDURE statement trigger, 10-264
See SQL command in OLAP DML, 10-242 Property event, 10-264
profiles, 8-179 PUSH command, 4-7, 10-144, 10-146
PROGRAM command, 10-139 marking start of series, 10-146
placement, 4-11
using, 4-7
PUSHLEVEL command, 10-146
nesting, 10-147
placement, 4-11
Q
QUAL function, 2-28, 8-97
Index-xiv
qualified data references relations
ampersand substitution, 2-31, 2-46 assigning values to, 10-191, 10-193, 10-197
creating, 2-28 comparing to text literals, 2-43
definition of, 2-28 default, 2-27, 10-159
for dimensions, 2-31 defining, 9-197
qualifying a relation, 2-31 limiting to single value, 2-31
replacing dimension of variable, 2-29, 2-30 QDR with, 2-31
specifying explicitly, 8-97 replacing dimension of, 2-31
using with relation, 2-31 relations, in aggmaps
with assignment statement, 2-30 identifying changes, 7-72
with dimensions, 2-28 RELEASE command, 10-162
with relations, 2-31 REM function, 8-107
with variables, 2-29, 2-30 remainder after division, 8-107
qualified object name, 2-24 REMAINDER function, 8-108
quotation marks REMBYTES function, 8-109
double, 2-5 REMCHARS function, 8-110
in OLAP DML, B-4 REMCOLS function, 8-111
REMLINES function, 8-113
RENAME command, 10-165
R
REPLBYTES function, 8-114
RANDOM function, 8-100 REPLCHARS function, 8-116
random numbers, 8-63, 8-100 REPLCOLS function, 8-118
random sparsity, 9-177 REPLLINES function, 8-120
RANDOM.SEED.1 option, 6-141 REPORT command, 10-167
RANDOM.SEED.2 option, 6-141 reporting, 10-167
range partitions reports
defining, 9-193 processing ROW command output, 8-130
retrieving calculation for, 8-78 producing, 8-130, 10-167
RANK function, 8-101 producing with ROW commands, 10-183
number of calls to, 8-103 RESERVED function, 8-121
number of computed values, 8-103 reserved words, 8-121
number of triggered sorts, 8-103 RESYNC command, 10-177
RANK_CALLS option, 8-103 RETURN command, 10-179
RANK_CELLS option, 8-103 return value of a program, 10-179
RANK_SORTS option, 8-103 REVERT command, 10-181
ranking performance monitoring, 8-103 ROLE option, 6-145
RAW data type, 2-16 roles, 8-179
reading files, 8-106 root of negative number, 6-146
current record number, 8-106 ROOTOFNEGATIVE option, 6-146
error diagnosis, 7-144 ROUND function
FILEREAD command, 9-265 for numbers, 8-127
processing a record, 9-282 ROW command, 10-183
reading a record, 7-149 processing output, 8-130
RECAP command, 10-150 ROW function, 8-130
RECNO function, 8-106 ROW2CELL column, A-5, A-13, A-24, A-25, A-29,
RECURSIVE option, 6-144 A-32, A-36, A-38
REDO command, 10-152 ROWID data type, 2-16
REEDIT command, 10-154 converting, 8-132, 8-133
REGRESS command, 7-199, 10-156 ROWIDTOCHAR function, 8-132
regressions ROWIDTONCHAR function, 8-133
linear, 10-156 RPAD function, 8-134
REGRESS.REPORT program, 10-158 RR datetime format element, 9-160
related dimensions, 2-27, 8-183, 10-159 RTRIM function, 8-135
limiting to, 6-58 RUN procedure (PL/SQL), B-50
RELATION command, 10-159 running totals, 8-136, 10-292
RELATION statement run-time aggregation, 3-15
for aggregation, 9-46 RUNTOTAL function, 8-136
for allocation, 9-88
relational tables See tables
Index-xv
S SP datetime format element suffix, 9-160
sparse data, 7-226
scenario models, 3-6
base dimension value, 7-226
seasonal data, 9-293
changing definitions, 9-136
SECONDS option, 6-147
eliminating, 9-218
segment width, 9-136
exporting, 9-235
segments
importing, 10-14
analytic workspace, 9-115
index algorithm, 6-154
locking, 10-239
obtaining information, 8-74
retrieving maximum size of, 7-55
reading from files, 9-265
SELECT statements (in OLAP DML), 10-220
renaming composites, 10-165
See also SQL command in OLAP DML
reporting, 10-167, 10-183
selecting
specifying composites, 9-205
alias dimension values, 9-188
SPARSE keyword, 1-8, 9-171
data, 10-33
SPARSEINDEX option, 6-154
SERVEROUTPUT option, B-40, B-49, B-50
sparsity
SESSCACHE option, 6-148
controlled, 9-177
session
random, 9-177
shutting down, B-52
See also sparse data
starting up, B-54
Sparsity Advisor, B-4 to B-7
session cache
SPARSITY_ADVICE_TABLE column
See OLAP session cache
descriptions, B-25
session logs
SPARSITY_ADVICE_TABLE procedure
printing, B-49
(PL/SQL), B-53
retrieving, B-42
special characters, 2-5
sessions, 10-72
spelled numbers
preserving environment, 4-6
specifying, 9-160
recording in disk file, 10-72
spreadsheets
restoring environment, 4-7
defining, 9-224
user ID, 8-179
exporting to, 9-241
SESSIONTIMEZONE function, 8-138
importing data from, 10-13, 10-27
SET command, 10-191
See also worksheet objects
SET1 command, 10-201
SPTH datetime format element suffix, 9-160
SHOW command, 10-202
SQL
SHUTDOWN procedure (PL/SQL), B-52
embedding OLAP commands, A-24 to A-25,
SIGN function, 8-139
A-29 to A-31, A-32, A-36 to A-37, A-38
SIGNAL command, 4-10, 10-204
managing analytic workspaces, B-1 to B-54
simultaneous equations in models, 3-6
SQL (in OLAP DML)
SIN function, 8-140
defining cursors, 10-220
sine calculation, 8-140, 8-141
embedding statements, 4-15, 10-214 to 10-246
single-row functions, A-5
precompiling statements, 10-239
SINH function, 8-141
retrieving errors, 6-156, 6-157
SLEEP command, 10-206
stored procedures, 10-242
slowest-varying dimension, 9-210
SQL command in OLAP DML, 10-214 to 10-246
smaller value of two expressions, 8-39
CLEANUP, 10-218
SMALLEST function, 8-142
CLOSE, 10-219
smallest value of an expression, 8-142
DECLARE CURSOR, 10-220
SMOOTH function, 8-144
EXECUTE, 10-225
solution variables
FETCH, 10-226
defined, 3-3
IMPORT, 10-233
example of, 10-102
PREPARE, 10-239
SORT
PROCEDURE, 10-242 to 10-243
command, 10-207
SELECT, 10-244
function, 8-147
SQLBLOCKMAX option, 6-155
SORTCOMPOSITE option, 6-152
SQLCODE option, 6-156
sorting
SQLCOLUMNS procedure, 10-220, 10-244
dimension values, 10-95
SQLERRM option, 6-157
status list of a dimension, 6-58, 8-147, 10-207
SQLFETCH function, 8-149
valuesets, 8-147, 10-207
SQLMESSAGES option, 6-158
SORTLINES function, 8-148
SQLTABLES procedure, 10-220, 10-244
SOURCEVAL statement, 9-94
Index-xvi
SQRT command, 8-150 stored procedures
square root, 8-150 creating, 10-242
calculating, 8-150 stored procedures (SQL)
result for negative number, 6-146 executing, 10-243
standard deviation calculation, 8-171 STORETRIGGERVAL property, 10-142
STARTOF function, 8-151 strings
STARTUP procedure (PL/SQL), B-54 byte, 2-16
startup programs, 4-14 length of, 8-19
STATALL function, 8-153 subevents, identifying, 8-216
STATDEPTH function, 8-154 substitution expressions, 2-45 to 2-46
statements substitution operator, 2-46
altering order of execution, 9-303 SUBSTR function, 7-211, 8-173
editing previously executed, 10-154 SUBSTR2 function, 7-211, 8-173
reading from a file, 10-30 SUBSTR4 function, 7-211, 8-173
reexecuting, 10-152 SUBSTRB function, 7-211, 8-173
sending to file, 10-150 SUBSTRC function, 7-211, 8-173
STATEQUAL, 8-155 substrings
STATFIRST function, 8-156 retrieving, 7-211, 8-173
STATIC_SESSION_LANGUAGE option, 6-159 SUBTOTAL function, 8-175
STATLAST function, 8-157 subtotals, 8-175
STATLEN function, 8-158 in a report, 8-175
STATLIST function, 8-159 resetting to zero, 10-292
STATMAX function, 8-161 surrogate dimension, 9-199
STATMIN function, 8-163 defining, 9-199
STATRANK function, 8-165 surrogates
status defining, 9-199
determining, 8-153 deleting, 9-226
setting, 10-33 SWITCH command, 9-130, 9-229, 10-251
setting inside a statement, 10-254 SWTICH
setting to null, 6-122 conditional expression, 2-45
status lists SYS_CONTEXT function, 8-177
base dimensions, 10-64 SYSDATE function, 8-178
comparing, 8-155 SYSINFO function, 8-179
empty, 6-122 SYSTEM function, 8-181
first value in, 8-156 SYSTIMESTAMP function, 8-182
last value in, 8-157
looping over, 6-121, 9-290, 10-254
T
most recent value, 8-161
null values, 6-122 table type, A-8
number of values in, 8-158 automatic, A-2, A-16
position in, 8-165 predefining, A-2, A-16
restoring, 10-137, 10-138 syntax for creating, A-2, A-15
result of LIMIT command, 8-20 tables
retrieving, 8-159 exporting from analytic workspaces, 10-215
retrieving depth of, 8-154 importing into analytic workspaces, 10-215
retrieving value by position, 8-168 TALLY function, 8-183
retrieving values from, 8-163, 8-229 TAN function, 8-185
saving, 7-81, 9-152, 10-144, 10-146 tangent calculation, 8-185
saving in a context, 9-152 angle value, 7-42
sending to outfile, 10-247 arc, 7-42, 7-43
setting to null, 6-122 hyperbolic, 8-186
sorting, 6-58, 8-147, 10-207 TANH function, 8-186
STATUS program, 10-247 TCONVERT function, 8-187
STATVAL function, 8-168 temporary members
STDDEV function, 8-171 adding to dimension, 10-80
STDHDR program, 10-249 identifying, 7-218
line size for centering, 6-68 TEMPSTAT command, 10-254
storage
changing, 9-136
of variables, 9-210
Index-xvii
text tracking, 10-115
comparing values, 2-42 cost of program lines, 10-115
data types, 2-5 cost of programs, 10-256
date and number formats, 2-10 TRACKPRG command, 10-256
literals, 2-34, 2-43 TRACKREPORT program, 10-258
passing arguments as, 4-4, 10-41 TRANSLATE function, 8-215
special characters, 2-5 TRAP command, 4-8, 10-260, 10-261
text expressions, 2-33, 2-34 TRIGGER command, 10-263
text formatting TRIGGER function, 8-216
importing worksheet data, 10-13 trigger objects, 8-216
TEXTFILL function, 8-194 trigger programs
TH datetime format element suffix, 9-160 Assign, 10-264
thousands marker, 6-162 Delete, 10-263
THOUSANDSCHAR option, 6-162 designing, 4-17
THSP datetime format element suffix, 9-160 Maintain, 10-263
time format models Property, 10-264
short, 9-159 Update, 4-27, 10-264
time of day, 8-178, 8-211 TRIGGER_AFTER_UPDATE program, 4-27
time series, 8-2 TRIGGER_AW program, 4-27, 4-28
cumulative totals over, 7-97 TRIGGER_BEFORE_UPDATE program, 4-29
data from previous time period, 8-2 TRIGGER_DEFINE program, 4-31
data from subsequent time period, 8-15 TRIGGERASSIGN command, 10-274
difference between time periods, 8-8 TRIGGERMAXDEPTH option, 6-165
maximum value in period, 8-48 triggers
minimum value in period, 8-50 Assign, 10-264, 10-274
moving totals over, 8-52 creating, 10-263 to 10-277
percent difference between time periods, 8-5, Define, 4-31
8-10 Delete, 10-263
time zone deleting, 10-264
formatting, 9-159 events, 8-216
time zones Maintain, 10-263
converting data to particular, 2-35 NA, 5-24, 6-165, 6-167
timestamp objects, 8-216
converting to local time zone, 2-35 Property, 10-264
TIMESTAMP data type, 2-12 subevents, 8-216
TIMESTAMP_LTZ data type, 2-13 Update, 4-27, 4-29, 10-264
TIMESTAMP_TZ data type, 2-12 TRIGGERSTOREOK option, 6-167
timezone offsets, 8-222 TRIM function, 8-218
timing, 10-115 trimming expressions, 8-31, 8-135
execution of program lines, 10-115 trimming strings, 8-218
execution of programs, 10-256 TRUNC function, 8-219
title for a report, 10-2 for numbers, 8-221
TMARGIN option, 6-163 TRUNCATE function, 8-219
TO_CHAR function, 8-196 for datetimes, 8-220
TO_DATE function, 8-199, 9-160 for numbers, 8-221
TO_NCHAR function, 8-202 tuples, B-4
TO_NUMBER function, 8-205 TZ_OFFSET function, 8-222
TO_TIMESTAMP_TZ function, 8-209
TOD function, 8-211
U
TODAY function, 8-212
TOTAL function, 8-213 UNHIDE command, 10-278
totals UNIQUELINES function, 8-223
calculating, 8-213 unnamed composites, 9-218
cumulative, 7-97 defining, 9-218
in a report, 8-136, 8-175, 10-167, 10-183 example of, 9-218
moving, 8-52 UNRAVEL function, 8-224
over time, 8-52 UPCASE function, 8-227
running, 8-136
TRACEFILEUNIT option, 6-164
Index-xviii
UPDATE command, 10-279 views
event, 10-264 creating embedded total dimensions, A-18
events, 4-27, 4-29 creating embedded total measures, A-19
trigger, 10-264 creating rollup form, A-20
triggers, 4-27, 4-29 template for creating with OLAP_TABLE, A-2
UROWID data type, 2-17 VINTSCHED function, 8-232
user ID, retrieving, 8-179 VNF
user-defined functions See value name format
arguments in, 4-4 VNF command, 2-7, 10-283
data type of, 4-4 VPMTSCHED function, 8-235
USERID option, 6-169
USETRIGGERS option, 6-170
W
UTC offset
replacing with time zone region, 2-12 WEEKDAYSNEWYEAR option, 6-172
WEEKOF function, 8-238
WHILE command, 9-130, 10-290
V used with BREAK, 9-130
VALSPERPAGE program, 8-228 used with CONTINUE, 9-154
value name format, 10-283 WIDTH_BUCKET function, 8-239
values wildcards, 2-43
restoring previous, 4-7 WKSDATA function, 8-241
saving current, 4-7 worksheet objects
See also Boolean values cells, 8-241
VALUES function, 8-229 data type of cells, 8-241
VALUESET statement, 9-95 to 9-97 defining, 9-224
valuesets deleting, 9-226
assigning values to, 9-203 dimensions, 9-224
checking status of, 10-247 See also spreadsheets
defining, 9-202 workspaces See analytic workspaces
deleting, 9-226 WRAPERRORS option, 6-173
limiting, 9-203
multidimensional, 9-203
Y
null, 6-122
number of values in, 8-158 YESSPELL option, 6-174
retrieving values, 8-156, 8-157, 8-161, 8-229 YMINTERVAL data type, 2-13
retrieving values from, 8-163 YMINTERVAL function, 8-210
setting the status of, 10-33 YRABSTART option, 6-175
sorting values, 8-147, 10-207 YYOF function, 8-244
VARCACHE option, 6-171
VARIABLE command, 10-281 Z
variables
acquired, 7-54 zero, 6-34
Aggcount, 7-16, 8-76, 9-139, 9-206, 9-207, 9-208 dividing by, 2-33, 6-34
assigning values to, 10-191 spelling of, 6-178
defining, 9-205 suppressing all-zero report rows, 6-176
defining with composite, 9-218 ZEROROW option, 6-176
deleting, 9-226 ZEROTOTAL command, 10-292
how data is stored, 9-210 ZSPELL option, 6-178
identifying changes, 7-73, 7-217
limiting to single value, 2-29, 2-30
local to a program, 10-281
partitioned, 9-193, 9-205
populating, 8-224
QDR with, 2-29, 2-30
replacing dimension of, 2-29, 2-30
reshaping dimensionality of, 8-97
session cache, 8-76
storage of, 9-210
version of Oracle OLAP, 7-130
Index-xix
Index-xx