Skip Headers

Oracle9i OLAP User's Guide
Release 2 (9.2.0.2)

Part Number A95295-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page Go to next page
View PDF

Example: Creating OLAP Metadata for a Fact Table

In the Sales History sample schema, COSTS is a fact table with the following columns.I

Column Name Data Type

PROD_ID

NUMBER

TIME_ID

DATE

UNIT_COST

NUMBER

UNIT_PRICE

NUMBER

The following statements create a logical CWM2 cube object, ANALYTIC_CUBE, for the COSTS fact table. The dimensions of the cube are: PRODUCT_DIM, shown in "Example: Creating OLAP Metadata for a Dimension Table", and TIME_DIM, a time dimension mapped to a table TIME.

---   Create the ANALYTIC_CUBE Cube  ---
cwm2_olap_cube.create_cube('SH', 'ANALYTIC_CUBE', 'Analytics', 
     'Analytic Cube','Unit Cost and Price Analysis');

---  Add the dimensions to the cube  ---
cwm2_olap_cube.add_dimension_to_cube('SH', 'ANALYTIC_CUBE', 
         'SH', 'TIME_DIM');
cwm2_olap_cube.add_dimension_to_cube('SH', 'ANALYTIC_CUBE', 
         'SH', 'PRODUCT_DIM');

---   Create the measures  ---
cwm2_olap_measure.create_measure('SH', 'ANALYTIC_CUBE', 'UNIT_COST', 
          'Unit Cost','Unit Cost', 'Unit Cost');
cwm2_olap_measure.create_measure('SH', 'ANALYTIC_CUBE', 'UNIT_PRICE', 
          'Unit Price','Unit Price', 'Unit Price');

---   Create the mappings  ---
cwm2_olap_table_map.Map_FactTbl_LevelKey 
     ('SH', 'ANALYTIC_CUBE','SH', 'COSTS', 'LOWEST LEVEL',
      'DIM:SH.PRODUCTS/HIER:STANDARD/LVL:L4/COL:PROD_ID;
       DIM:SH.TIME/HIER:CALENDAR/LVL:L3/COL:MONTH;');
cwm2_olap_table_map.Map_FactTbl_Measure 
     ('SH', 'ANALYTIC_CUBE','UNIT_COST', 'SH', 'COSTS', 'UNIT_COST',
      'DIM:SH.PRODUCTS/HIER:STANDARD/LVL:L4/COL:PROD_ID;
       DIM:SH.TIME/HIER:CALENDAR/LVL:L3/COL:MONTH;');
cwm2_olap_table_map.Map_FactTbl_Measure 
     ('SH', 'ANALYTIC_CUBE','UNIT_PRICE', 'SH', 'COSTS', 'UNIT_PRICE',
      'DIM:SH.PRODUCTS/HIER:STANDARD/LVL:L4/COL:PROD_ID;
       DIM:SH.TIME/HIER:CALENDAR/LVL:L3/COL:MONTH;');