OLAP View generator 10.2.0.3
Hi,
I am trying to use OLAP view generator plug in with AWM 10.2.0.3A. My all the dimensions are value based and only time dimension is level based.
I am not able to generate views for the value based dimensions but view for time is getting generated without any issues. I am getting following error when generating for account dimension.
AUG-03-2009 09:50:40: ... populating dimension map for ACCOUNT
AUG-03-2009 09:50:40: ..... clearing mappings for the dimension
AUG-03-2009 09:50:40: ..... retrieving physical objects
AUG-03-2009 09:50:42: ..... checking for value hierarchies
AUG-03-2009 09:50:42: ..... retrieving label for dimension levels
AUG-03-2009 09:50:42: ..... populating mapping info for the DIMENSION clause
AUG-03-2009 09:50:42: ..... populating mapping info for the INHIERARCHY clause
AUG-03-2009 09:50:42: ..... retrieving hierarchy information
AUG-03-2009 09:50:46: ..... populating mapping info for the HIERARCHY and FAMILYREL clauses for hierarchy COMPLETEPL
AUG-03-2009 09:50:46: ..... creating ACCOUNT_DEPTHVAR object to support value hierarchies
AUG-03-2009 09:50:46: ..... populating depth information in variable ACCOUNT_DEPTHVAR
AUG-03-2009 09:51:08: ..... populating mapping info for the HIERARCHY and FAMILYREL clauses for hierarchy GRA
AUG-03-2009 09:51:08: ..... populating mapping info for the HIERARCHY and FAMILYREL clauses for hierarchy MODEL
AUG-03-2009 09:51:08: ..... populating mapping info for the ATTRIBUTE clause
AUG-03-2009 09:51:09: ... completed populating mapping for ACCOUNT
AUG-03-2009 09:51:58: . Creating view for dimension ACCOUNT
AUG-03-2009 09:51:59: ... generating limitmap for ACCOUNT
AUG-03-2009 09:51:59: ..... mapping table out of date for dimension ACCOUNT. Updating mapping table.
AUG-03-2009 09:51:59: ... populating dimension map for ACCOUNT
AUG-03-2009 09:51:59: ..... clearing mappings for the dimension
AUG-03-2009 09:51:59: ..... retrieving physical objects
AUG-03-2009 09:51:59: ..... checking for value hierarchies
AUG-03-2009 09:51:59: ..... retrieving label for dimension levels
AUG-03-2009 09:51:59: ..... populating mapping info for the DIMENSION clause
AUG-03-2009 09:51:59: ..... populating mapping info for the INHIERARCHY clause
AUG-03-2009 09:51:59: ..... retrieving hierarchy information
AUG-03-2009 09:52:00: ..... populating mapping info for the HIERARCHY and FAMILYREL clauses for hierarchy COMPLETEPL
AUG-03-2009 09:52:00: ..... populating mapping info for the HIERARCHY and FAMILYREL clauses for hierarchy GRA
AUG-03-2009 09:52:00: ..... populating mapping info for the HIERARCHY and FAMILYREL clauses for hierarchy MODEL
AUG-03-2009 09:52:00: ..... populating mapping info for the ATTRIBUTE clause
AUG-03-2009 09:52:01: ... completed populating mapping for ACCOUNT
AUG-03-2009 09:52:02: **
AUG-03-2009 09:52:02: ** ERROR: View not created.
AUG-03-2009 09:52:02: ** CAUSE: CREATE VIEW statement failed
AUG-03-2009 09:52:02: ORA-22309: attribute with name "ACCOUNT_COMPLETEPL_LEVEL" already exists
AUG-03-2009 09:52:02: *** DEBUG INFORMATION ***
AUG-03-2009 09:52:02: VIEW CREATION DDL ((truncated after 3900 characters)
AUG-03-2009 09:52:02: CREATE OR REPLACE VIEW XPRO_OLAP_AGG.ACCOUNT_DIMVIEW AS
SELECT *
FROM table(OLAP_TABLE ('XPRO_OLAP_AGG.OLAP_AGG duration session',
'&(ACCOUNT_LIMITMAP)'))
MODEL
DIMENSION BY (
ACCOUNT)
MEASURES (
ACCOUNT_LEVEL,
ACCOUNT_PRECOMPUTE,
ACCOUNT_RELATED_STATISTICAL,
ACCOUNT_BENEFIT_UPLIFT,
ACCOUNT_STATISTICAL,
ACCOUNT_CLOSED_FLAG,
ACCOUNT_CLOSED_DATE,
ACCOUNT_PARENT_CD,
ACCOUNT_SDSC,
ACCOUNT_LDSC,
ACCOUNT_CD,
ACCOUNT_MODEL1_LVLDSC,
ACCOUNT_MODEL_LEVEL,
ACCOUNT_MODEL_PRNT,
ACCOUNT_GRA4_LVLDSC,
ACCOUNT_GRA3_LVLDSC,
ACCOUNT_GRA2_LVLDSC,
ACCOUNT_GRA1_LVLDSC,
ACCOUNT_GRA_LEVEL,
ACCOUNT_GRA_PRNT,
ACCOUNT_COMPLETE7_LVLDSC,
ACCOUNT_COMPLETE6_LVLDSC,
ACCOUNT_COMPLETE5_LVLDSC,
ACCOUNT_COMPLETE4_LVLDSC,
ACCOUNT_COMPLETE3_LVLDSC,
ACCOUNT_COMPLETE2_LVLDSC,
ACCOUNT_COMPLETE1_LVLDSC,
ACCOUNT_COMPLETEPL_LEVEL,
ACCOUNT_COMPLETEPL_PRNT
) RULES UPDATE SEQUENTIAL ORDER()
AUG-03-2009 09:52:02: LIMITMAP (truncated after 3900 characters):
AUG-03-2009 09:52:02: DIMENSION ACCOUNT FROM ACCOUNT WITH -
HIERARCHY ACCOUNT_COMPLETEPL_PRNT FROM ACCOUNT_PARENTREL(ACCOUNT_HIERLIST \'COMPLETEPL\') -
INHIERARCHY ACCOUNT_INHIER -
HATTRIBUTE ACCOUNT_COMPLETEPL_LEVEL FROM ACCOUNT_DEPTHVAR -
HATTRIBUTE ACCOUNT_GRA_LEVEL FROM ACCOUNT_DEPTHVAR -
HATTRIBUTE ACCOUNT_MODEL_LEVEL FROM ACCOUNT_DEPTHVAR -
FAMILYREL ACCOUNT_COMPLETE1_LVLDSC, -
ACCOUNT_COMPLETE2_LVLDSC, -
ACCOUNT_COMPLETE3_LVLDSC, -
ACCOUNT_COMPLETE4_LVLDSC, -
ACCOUNT_COMPLETE5_LVLDSC, -
ACCOUNT_COMPLETE6_LVLDSC, -
ACCOUNT_COMPLETE7_LVLDSC -
FROM ACCOUNT_FAMILYRELVAL(GID_DIMENSION 63), -
ACCOUNT_FAMILYRELVAL(GID_DIMENSION 31), -
ACCOUNT_FAMILYRELVAL(GID_DIMENSION 15), -
ACCOUNT_FAMILYRELVAL(GID_DIMENSION 7), -
ACCOUNT_FAMILYRELVAL(GID_DIMENSION 3), -
ACCOUNT_FAMILYRELVAL(GID_DIMENSION 1), -
ACCOUNT_FAMILYRELVAL(GID_DIMENSION 0) -
LABEL ACCOUNT_DSCR-
HIERARCHY ACCOUNT_GRA_PRNT FROM ACCOUNT_PARENTREL(ACCOUNT_HIERLIST \'GRA\') -
INHIERARCHY ACCOUNT_INHIER -
HATTRIBUTE ACCOUNT_COMPLETEPL_LEVEL FROM ACCOUNT_DEPTHVAR -
HATTRIBUTE ACCOUNT_GRA_LEVEL FROM ACCOUNT_DEPTHVAR -
HATTRIBUTE ACCOUNT_MODEL_LEVEL FROM ACCOUNT_DEPTHVAR -
FAMILYREL ACCOUNT_GRA1_LVLDSC, -
ACCOUNT_GRA2_LVLDSC, -
ACCOUNT_GRA3_LVLDSC, -
ACCOUNT_GRA4_LVLDSC -
FROM ACCOUNT_FAMILYRELVAL(GID_DIMENSION 7), -
ACCOUNT_FAMILYRELVAL(GID_DIMENSION 3), -
ACCOUNT_FAMILYRELVAL(GID_DIMENSION 1), -
ACCOUNT_FAMILYRELVAL(GID_DIMENSION 0) -
LABEL ACCOUNT_DSCR-
HIERARCHY ACCOUNT_MODEL_PRNT FROM ACCOUNT_PARENTREL(ACCOUNT_HIERLIST \'MODEL\') -
INHIERARCHY ACCOUNT_INHIER -
HATTRIBUTE ACCOUNT_COMPLETEPL_LEVEL FROM ACCOUNT_DEPTHVAR -
HATTRIBUTE ACCOUNT_GRA_LEVEL FROM ACCOUNT_DEPTHVAR -
HATTRIBUTE ACCOUNT_MODEL_LEVEL FROM ACCOUNT_DEPTHVAR -
FAMILYREL ACCOUNT_MODEL1_LVLDSC -
FROM ACCOUNT_FAMILYRELVAL(GID_DIMENSION 0) -
LABEL ACCOUNT_DSCR -
ATTRIBUTE ACCOUNT_CD FROM ACCOUNT_CD -
ATTRIBUTE ACCOUNT_LDSC FROM ACCOUNT_DSCR -
ATTRIBUTE ACCOUNT_SDSC FROM ACCOUNT_SDSCR -
ATTRIBUTE ACCOUNT_PARENT_CD FROM ACCOUNT_PARENT_CD -
ATTRIBUTE ACCOUNT_CLOSED_DATE FROM ACCOUNT_CLOSED_DATE -
ATTRIBUTE ACCOUNT_CLOSED_FLAG FROM ACCOUNT_CLOSED_FLAG -
ATTRIBUTE ACCOUNT_STATISTICAL FROM ACCOUNT_STATISTICAL -
ATTRIBUTE ACCOUNT_BENEFIT_UPLIFT FROM ACCOUNT_BENEFIT_UPLIFT -
ATTRIBUTE ACCOUNT_RELATED_STATISTICAL FROM ACCOUNT_RELATED_STATISTICAL_ACCOUNT -
ATTRIBUTE ACCOUNT_PRECOMPUTE FROM ACCOUNT_PRECOMPUTE -
ATTRIBUTE ACCOUNT_LEVEL FROM ACCOUNT_LEVELREL
AUG-03-2009 09:52:02: **
AUG-03-2009 09:52:02: ** ERROR: Unable to create view over dimension ACCOUNT.
AUG-03-2009 09:52:02: ORA-22309: attribute with name "ACCOUNT_COMPLETEPL_LEVEL" already exists
Am I missing something? Can I generate the views for the value based dimensions?
Thanks
Brijesh
Hi Brijesh
I had a similar problem when creating cube views for OBIEE under OLAP with multiple value-based hierarchies using the plugin.
The view generator makes several HATTRIBUTES for the _LEVEL metadata that is mapped in the OLAP AW, some of which are not part of the hierarchy that is being created, this is why it detects repeating fields.
What you need to do is create the view as you normally would. When you receive the error below, copy the SQL out of the error windows and save it somewhere.
CREATE OR REPLACE VIEW XPRO_OLAP_AGG.ACCOUNT_DIMVIEW AS
SELECT *
FROM table(OLAP_TABLE ('XPRO_OLAP_AGG.OLAP_AGG duration session',
'&(ACCOUNT_LIMITMAP)'))
MODEL
DIMENSION BY (
ACCOUNT)
MEASURES (
ACCOUNT_LEVEL,
ACCOUNT_PRECOMPUTE,
ACCOUNT_RELATED_STATISTICAL,
ACCOUNT_BENEFIT_UPLIFT,
ACCOUNT_STATISTICAL,
ACCOUNT_CLOSED_FLAG,
ACCOUNT_CLOSED_DATE,
ACCOUNT_PARENT_CD,
ACCOUNT_SDSC,
ACCOUNT_LDSC,
ACCOUNT_CD,
ACCOUNT_MODEL1_LVLDSC,
ACCOUNT_MODEL_LEVEL,
ACCOUNT_MODEL_PRNT,
ACCOUNT_GRA4_LVLDSC,
ACCOUNT_GRA3_LVLDSC,
ACCOUNT_GRA2_LVLDSC,
ACCOUNT_GRA1_LVLDSC,
ACCOUNT_GRA_LEVEL,
ACCOUNT_GRA_PRNT,
ACCOUNT_COMPLETE7_LVLDSC,
ACCOUNT_COMPLETE6_LVLDSC,
ACCOUNT_COMPLETE5_LVLDSC,
ACCOUNT_COMPLETE4_LVLDSC,
ACCOUNT_COMPLETE3_LVLDSC,
ACCOUNT_COMPLETE2_LVLDSC,
ACCOUNT_COMPLETE1_LVLDSC,
ACCOUNT_COMPLETEPL_LEVEL,
ACCOUNT_COMPLETEPL_PRNT
) RULES UPDATE SEQUENTIAL ORDER();Go into AWM and OLAP Worksheet and you will need to find the LIMITMAP variable, in your case ACCOUNTLIMITMAP.
Execute:
show convert(ACCOUNT_LIMITMAP infile)
This will print the contents of the variable in infile format as you will be loading it back later.
Copy this into an editor and what you will find is that under each dimension hierarchy (defined as HIERARCHY ACCOUNT_<hierarchy>_PRNT ...) there will be repeating HATTRIBUTE declarations.
You need to go through and delete the HATTRIBUTES that do no belong to the HIERARCHY pointed out above, which appears as:
HATTRIBUTE ACCOUNT_<hierarchy>_LEVEL
--HATTRIBUTE ACCOUNT_<hierarchy1>_LEVEL--
--HATTRIBUTE ACCOUNT_<hierarchy2>_LEVEL--
In your case i believe you will have these repeating:
ACCOUNT_MODEL_LEVEL
ACCOUNT_GRA_LEVEL
ACCOUNT_COMPLETEPL_LEVELDo this for each hierarchy in the limitmap leaving only the correct hierarchy HATTRIBUTE under each HIERARCHY ACCOUNT_<hierarchy>_PRNT
After that at the top of your notepad add ACCOUNT_LIMITMAP = 'DIMENSION ACCOUNT FROM ACCOUNT WITH ... etc
Load the file into AWM using the infile command, this will set the ACCOUNT_LIMITMAP correctly.
You will then need to execute the SQL from the error windows in SQL Developer and you should be able to see the view.
Edited by: birchy on Aug 4, 2009 9:35 AM
Similar Messages
-
Creating relational views over dimensions and cubes in an analytic workspace has never been easier. Check out the new sample plug-in for Analytic Workspace Manager 10.2.0.3 that makes creating views a snap.
1) Right-click a dimension or cube object, then choose Create Relational View...
2) Choose the columns you'd like to see in your view, then click Create View.
Your OLAP data is now available to any relational tool. Download the OLAP View Generator from OTN and give it a try. It's fun for the whole family!
http://www.oracle.com/technology/products/bi/olap/index.htmlI logged a TAR with Oracle and they gave me a pl/sql fix, which works for me now. It looked to be a bug of sorts.
This is the whole install_olap_view_generator.sql but beware it drops and creates things.....
prompt Installing OLAP View Generator sample - Version 1.0.2
prompt
prompt >> Turning off prompting for substitution variables (set scan off)
set scan off
prompt >> Removing the olap_views user. Ignore error if user does not exist.
drop user olap_views cascade;
prompt >> Creating OLAP_VIEWS tablespace...
CREATE TABLESPACE OLAP_VIEWS
DATAFILE 'OLAP_VIEWS.DBF' SIZE 20M AUTOEXTEND ON NEXT 5M;
prompt >> Creating OLAP_VIEWS_TEMP temporary tablespace...
CREATE TEMPORARY TABLESPACE OLAP_VIEWS_TEMP
TEMPFILE 'OLAP_VIEWS_TEMP.DBF' SIZE 20M AUTOEXTEND ON NEXT 5M
UNIFORM SIZE 256K;
prompt >> Creating OLAP_VIEWS user...
CREATE USER OLAP_VIEWS
IDENTIFIED BY OLAP_VIEWS DEFAULT TABLESPACE OLAP_VIEWS
TEMPORARY TABLESPACE OLAP_VIEWS_TEMP
QUOTA UNLIMITED ON OLAP_VIEWS;
grant olap_user to OLAP_VIEWS;
grant create public synonym to olap_views;
prompt >> Connecting as olap_views user
connect olap_views/olap_views
prompt >> Creating tables that store information about OLAP views and mappings
CREATE TABLE OLAP_VIEWS.OLAP_MAPPINGS
( LAST_UPDATED DATE,
AW_LAST_UPDATED DATE,
AW_OWNER VARCHAR2(30 BYTE),
AW_NAME VARCHAR2(30 BYTE),
CUBE_NAME VARCHAR2(30 BYTE),
CLAUSE VARCHAR2(30 BYTE),
OBJECT_NAME VARCHAR2(30 BYTE),
HIERARCHY VARCHAR2(30 BYTE),
LEVEL_NAME VARCHAR2(30 BYTE),
COLUMN_NAME VARCHAR2(30 BYTE),
AW_OBJECT VARCHAR2(100 BYTE),
DATA_TYPE VARCHAR2(30 BYTE),
DIMENSION_DESC VARCHAR2(100 BYTE),
POSITION NUMBER,
COLUMN_LABEL VARCHAR2(100 BYTE),
DESCRIPTION VARCHAR2(1000),
INCLUDE NUMBER DEFAULT 1
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.LAST_UPDATED IS 'Timestamp when the view was created';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.AW_LAST_UPDATED IS 'Timestamp of the AW when the view was created';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.AW_OWNER IS 'Schema containing the analytic workspace';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.AW_NAME IS 'Name of the analytic workspace';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.CUBE_NAME IS 'Name of the cube for the given measure';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.CLAUSE IS 'Clause in the limitmap (FAMILYREL, DIMENSION, etc.)';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.OBJECT_NAME IS 'The name of the object (measure or dimension) being mapped';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.HIERARCHY IS 'The hierarchy for the dimension. A dimension may have multiple hierarchies.';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.LEVEL_NAME IS 'A level within a hierarchy.';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.COLUMN_NAME IS 'Column name for an AW object';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.AW_OBJECT IS 'The mapped AW object';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.DATA_TYPE IS 'Relational data type for the column';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.DIMENSION_DESC IS 'AW object representing the description for a dimension member';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.POSITION IS 'Sort order for levels in a hierarchy (aggregate to detail)';
COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.COLUMN_LABEL IS 'Label that can be displayed to users in client tools';
CREATE TABLE OLAP_VIEWS.OLAP_VIEW_OBJECTS
( LAST_UPDATED DATE,
AW_OWNER VARCHAR2(30),
AW_NAME VARCHAR2(30),
VIEW_NAME VARCHAR2(61),
DIMENSION_NAME VARCHAR2(30),
CUBE_NAME VARCHAR2(30)
CREATE TABLE OLAP_VIEWS.OLAP_VIEW_LIMITMAP
( LAST_UPDATED DATE,
AW_OWNER VARCHAR2(30),
AW_NAME VARCHAR2(30),
VIEW_NAME VARCHAR2(61),
LIMITMAP CLOB
CREATE TABLE OLAP_VIEWS.OLAP_VIEW_LOG
( msg_key number,
MSG_ID TIMESTAMP (9),
MESSAGE VARCHAR2(4000)
create sequence OLAP_VIEWS.olap_log_seq
start with 1
increment by 1
nomaxvalue;
create trigger OLAP_VIEWS.olap_log_trigger
before insert on OLAP_VIEWS.OLAP_VIEW_LOG
for each row
begin
select OLAP_VIEWS.olap_log_seq.nextval into :new.msg_key from dual;
end;
CREATE or REPLACE VIEW olap_views.version as
SELECT 'Version 1.0.2' version
FROM dual;
prompt >> Create synonyms for the tables
CREATE OR REPLACE PUBLIC SYNONYM olap_mappings FOR olap_views.olap_mappings;
CREATE OR REPLACE PUBLIC SYNONYM OLAP_VIEW_LIMITMAP FOR olap_views.OLAP_VIEW_LIMITMAP ;
CREATE OR REPLACE PUBLIC SYNONYM OLAP_VIEW_OBJECTS FOR olap_views.OLAP_VIEW_OBJECTS;
CREATE OR REPLACE PUBLIC SYNONYM OLAP_VIEW_LOG FOR olap_views.OLAP_VIEW_LOG;
prompt >> Grant privileges on synonyms to PUBLIC
grant all on olap_mappings to public;
grant all on OLAP_VIEW_LIMITMAP to public;
grant all on olap_view_objects to public;
grant all on olap_view_log to public;
grant select on olap_views.version to public;
prompt >> Define PL/SQL Package OLAP_VIEWGENERATOR
create or replace PACKAGE OLAP_ViewGenerator authid current_user AS
-- Create a report of the views created over the cube
PROCEDURE reportViewInfo (
strOwner varchar2,
strAWname varchar2
-- Create views over all the dimensions and cubes in the AW
PROCEDURE createAWViews (
strOwner varchar2,
strAWname varchar2);
-- Generate a view over a cube
PROCEDURE createCubeView (
strOwner varchar2,
strAWname varchar2,
strCubename varchar2);
-- Generate a view over a dimension
-- RETURN: name of generated view
PROCEDURE createDimensionView (
strOwner varchar2,
strAWname varchar2,
strDimname varchar2);
-- Get the limitmap text for a cube
-- RETURN: limitmap text
FUNCTION getCubeLimitmap (
strOwner varchar2,
strAWname varchar2,
strCubename varchar2) return clob;
-- Get the limitmap text for a dimension
-- RETURN: limitmap text
FUNCTION getDimensionLimitmap (strOwner varchar2,
strAWname varchar2,
strDimname varchar2) return clob;
-- Updates the OLAP_MAPPINGS table with info describing a dimension, including the following:
-- AW object, column mapped to object, type of object (e.g. dimension, hierarchy, familyrel, etc.),
-- label for the object, etc
-- RETURN: true if successful, false if fails
FUNCTION generateDimensionMap (
strOwner varchar2,
strAWname varchar2,
strDimname varchar2) RETURN number;
-- Updates the OLAP_MAPPINGS table with the info describing a cube's measures:
-- AW object, column mapped to object, label for the object, etc
-- RETURN: true if successful, false if fails
FUNCTION generateCubeMap (
strOwner varchar2,
strAWname varchar2,
strCubename varchar2) return number;
FUNCTION getDataType (
strOwner varchar2,
strAWname varchar2,
strPhysObj varchar2) return varchar2;
END OLAP_ViewGenerator;
create or replace PACKAGE BODY OLAP_ViewGenerator AS
cachedate date; -- Date for the current run of the generator
bad_limitmap exception;
ATTACHED_RW constant number := 2;
ATTACHED_RO constant number := 1;
NOT_ATTACHED constant number := 0;
INCLUDE_LEVEL_ID constant number := 0; -- 0=FALSE, 1=TRUE
type log_record_type is record (msg_key number, msg_id timestamp, message varchar2(4000));
type log_table_type is table of log_record_type INDEX BY BINARY_INTEGER;
log_table log_table_type;
-- PRIVATE METHODS and PROCEDURES
-- Update the OLAP_VIEW_LOG table with contents of PL/SQL table
PROCEDURE updateLogTable as
BEGIN
delete olap_view_log;
commit;
FORALL i IN INDICES OF log_table
INSERT INTO olap_view_log
VALUES log_table (i);
commit;
-- Clear the log table
log_table.delete;
END updateLogTable;
-- Shortcut for displaying output
PROCEDURE show (message varchar2) as
msg varchar2(4000);
i number;
log_record log_record_type;
BEGIN
msg := '>> ' || to_char(systimestamp, 'MON-DD-YYYY HH:MI:SS') || ' - ' || message;
dbms_output.put_line(substr(msg, 1, 254));
i := log_table.count + 1;
log_record.msg_id := systimestamp;
log_record.message := message;
log_table(i) := log_record;
END show;
FUNCTION getDataType (
strOwner varchar2,
strAWname varchar2,
strPhysObj varchar2) return varchar2 as
dataType varchar2(10);
objName varchar2(100);
BEGIN
objName := upper(strOwner || '.' || strAWname || '!' || strPhysObj);
dataType := dbms_aw.interp('show obj(data ''' || objName || ''')');
-- Return NUMBER for all the number types
if dataType in ('INTEGER', 'LONGINTEGER', 'SHORTINTEGER', 'DECIMAL', 'SHORTDECIMAL')
then dataType := 'NUMBER';
else dataType := null;
end if;
return dataType;
EXCEPTION
when others then
return null;
END getDataType;
-- Attaches the specified AW r/w first
-- Returns the previous state of the AW:
-- 2 : Attached r/w
-- 1 : Attached r/o
-- 0 : Not attached
-- This state will be passed to detachAW in order to restore the AW to the previous state
FUNCTION attachAW (
strOwner varchar2,
strAWName varchar2) return number as
owner varchar2(30);
awname varchar2(30);
awlongname varchar2(100);
cmd varchar2(400);
isAttached number;
BEGIN
owner := upper(strOwner);
awname := upper(strAWName);
awlongname := upper(strOwner || '.' || strAWname);
-- Check if the AW is attached:
-- 2 : Attached r/w
-- 1 : Attached r/o
-- 0 : Not attached
cmd := 'if aw(attached ''' || awlongname || ''') and aw(rw ''' || awlongname || ''') then ' || ATTACHED_RW ||
' else if aw(attached ''' || awlongname || ''') and aw(ro ''' || awlongname || ''') then ' ||
ATTACHED_RO || ' else ' || NOT_ATTACHED;
isAttached := dbms_aw.eval_number(cmd);
-- Attach the AW r/w first
if isAttached = NOT_ATTACHED then
dbms_aw.aw_attach(owner, awname, true, false, 'FIRST');
elsif isAttached = ATTACHED_RO then
dbms_aw.aw_detach(owner, awname);
dbms_aw.aw_attach(owner, awname, true, false, 'FIRST');
else
dbms_aw.aw_attach(owner, awname, true, false, 'FIRST');
end if;
return isAttached;
exception
when others then
show ('**');
show ('** ERROR: Unable to attach AW ' || owner || '.' || awname || ' read-write.');
show ('** Ensure that you have priviliges to access the AW in this mode.');
show ('**');
raise;
END attachAW;
-- "Detaches" the specified AW. Note - this is really a restore the attach
-- mode of the AW to its previous state. So, if the AW was previously attached R/W - then
-- the AW will remain attached.
-- This previous state was returned by the attachAW function
PROCEDURE detachAW (
strOwner varchar2,
strAWName varchar2,
awState number
) as
owner varchar2(30);
awname varchar2(30);
BEGIN
owner := upper(strOwner);
awname := upper(strAWName);
if awState = ATTACHED_RW
then return;
elsif awState = NOT_ATTACHED
then dbms_aw.AW_DETACH(owner, awname);
else
dbms_aw.AW_DETACH(owner, awname);
dbms_aw.aw_attach(owner, awname, false);
end if;
return;
exception
when others then
-- shouldn't hit this condition
show ('**');
show ('** ERROR: Unable to restore attach state to AW ' || owner || '.' || awname || '.');
show ('**');
raise;
END detachAW;
FUNCTION getLastUpdateDate (
strOwner varchar2,
strAWName varchar2) return date as
owner varchar2(30);
awname varchar2(30);
awlongname varchar2(100);
last_updated varchar2(100);
isAttached number;
BEGIN
awlongname := upper(strOwner || '.' || strAWname);
owner := upper(strOwner);
awname := upper(strAWName);
isAttached := attachAW(owner, awname);
last_updated := dbms_aw.interp('show to_char(aw(date, ''' || awlongname || '''), ''YYYY-MON-DD,HH:MI:SS AM'')');
detachAW(owner, awname, isAttached);
return to_date(last_updated, 'YYYY-MON-DD,HH:MI:SS AM');
exception
when others then
show ('**');
show ('** ERROR: Unable to retrieve last updated date for AW ' || awname || '.');
show ('** Ensure that you have priviliges to access the AW.');
show ('**');
raise;
return null;
END getLastUpdateDate;
FUNCTION getDepthVar (
strOwner varchar2,
strAWName varchar2,
strDimname varchar2,
strHierDim varchar2,
strParentRel varchar2) return varchar2 as
owner varchar2(30);
awname varchar2(30);
awlongname varchar2(100);
isAttached number;
varName varchar2(100);
shortName varchar2(100);
varExists number;
cmd varchar2(1000);
BEGIN
awlongname := upper(strOwner || '.' || strAWname);
awname := upper(strAWname);
owner := upper(strOwner);
shortName := strDimname || '_DEPTHVAR';
varName := awlongname || '!' || shortName;
isAttached := attachAW(owner, awname);
-- Check if the depth variable exists
cmd := 'convert(exists(''' || varName || '''), int)';
varExists := dbms_aw.eval_number(cmd);
-- Define variable if it does not exist
-- DEFINE [dim]_DEPTHVAR VARIABLE INTEGER <[dim] [hierdim]>
-- PROPERTY '$NATRIGGER' 'statlen(limit(limit(organization to organization + 0 ) to ancestors using organization_parentrel))+1'
-- PROPERTY '$VARCACHE' 'VARIABLE'
if varExists = 0 then
show ('..... creating ' || shortname || ' object to support value hierarchies');
cmd := 'define ' || varName || ' variable integer <' || strDimname || ' ' || strHierDim || '>';
dbms_aw.execute(cmd);
cmd := 'PROPERTY ''$NATRIGGER'' ''statlen(limit(limit(' ||
strDimname || ' to ' || strDimname || ' + 0 ) to ancestors using ' || strParentRel || '))+1''';
dbms_aw.execute(cmd);
cmd := 'PROPERTY ''$VARCACHE'' ''VARIABLE''';
dbms_aw.execute(cmd);
show ('..... populating depth information in variable ' || shortName);
cmd := 'limit ' || strDimname || ' to ' || varName || ' eq 1';
dbms_aw.execute(cmd);
dbms_aw.AW_UPDATE(strOwner, strAWName);
end if;
detachAW(owner, awname, isAttached);
return shortName;
exception
when others then
show ('**');
show ('** ERROR: Unable to set up depth object for value based hierarchy in dimension ' || strDimname || '.');
show ('**');
show (sqlerrm);
raise;
return null;
END getDepthVar;
-- Return the generated column name for an AW object.
FUNCTION getColumnName (
parent varchar2,
awObj varchar2,
objType varchar2) return varchar2 as
displayName varchar2(100);
retval varchar2(100);
i number;
j number;
BEGIN
case
when objType = 'MEMBER_PARENTREL' then
retval := substr(parent, 1, 10) || '_' || substr(awObj, 1, 12) || '_PRNT';
when objType = 'LEVEL_LONG_DESCRIPTION' then
-- retval := substr(awObj, 1, 20) || '_LDSC';
retval := substr(parent, 1, 10) || '_' || substr(awObj, 1, 10) || '_LDSC';
when objType = 'MEMBER_LONG_DESCRIPTION' then
retval := substr(parent, 1, 10) || '_LDSC';
when objType = 'MEMBER_SHORT_DESCRIPTION' then
retval := substr(parent, 1, 10) || '_SDSC';
when objType = 'END_DATE' then
retval := substr(parent, 1, 10) || '_END_DATE';
when objType = 'TIME_SPAN' then
retval := substr(parent, 1, 10) || '_TIME_SPAN';
when objType = 'MEMBER_LEVELREL' then
retval := substr(parent, 1, 10) || '_' || substr(awObj, 1, 10) || '_LVL';
when objType = 'MEMBER_LEVELREL_DESC' then
retval := substr(parent, 1, 10) || '_' || substr(awObj, 1, 10) || '_LVLDSC';
when objType = 'LEVEL_ATTRIBUTE' then
retval := substr(parent, 1, 10) || '_LEVEL';
when objType = 'USER' then
retval := substr(parent, 1, 10) || '_' || substr(awObj, 1, 19);
else
retval := awObj;
end case;
return retval;
END getColumnName;
-- Generate a limitmap for a dimension based on the information in the cache
FUNCTION getDimensionLimitmap (
strOwner varchar2,
strAWname varchar2,
strDimname varchar2) return clob as
owner varchar2(30);
awname varchar2(30);
dimname varchar2(30);
limitmap clob;
ov_rec olap_mappings%ROWTYPE;
type hier_table is table of olap_mappings.hierarchy%TYPE INDEX BY BINARY_INTEGER;
hierlist hier_table;
target varchar2(2500);
aw_source varchar2(2500);
label_var varchar2(100);
run_date date;
no_values boolean;
yesno number;
aw_date date;
BEGIN
owner := upper(strOwner);
awname := upper(strAWname);
dimname := upper(strDimname);
no_values := false;
show('... generating limitmap for ' || dimname);
-- Update the olap_mappings table if nec.
begin
aw_date := getLastUpdateDate(owner, awname);
SELECT aw_last_updated
INTO run_date
FROM olap_mappings
WHERE aw_name = awname and
aw_owner = owner and
object_name = dimname and
rownum = 1;
exception
when NO_DATA_FOUND then
no_values := true;
end;
-- Check if the dimension mapping table needs to be updated.
-- This occurs if this current run is newer than the AW timestamp (i.e. an update
-- has occurred in the AW)
if no_values or run_date < aw_date
then
show ('..... mapping table out of date for dimension ' || dimname || '. Updating mapping table.');
yesno := generateDimensionMap(owner, awname, dimname);
if yesno = 0
then return null;
end if;
end if;
-- DIMENSION clause
-- e.g. DIMENSION category_id AS varchar2(100) FROM category WITH
SELECT *
INTO ov_rec
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
object_name = dimname and
CLAUSE = 'DIMENSION';
limitmap := 'DIMENSION ' || ov_rec.column_name || -- ' AS ' || ov_rec.data_type ||
' FROM ' || dimname || ' WITH ';
-- Process each dimension hierarchy.
-- Begin by retrieving the list of hierarchies for the dimension
SELECT hierarchy
BULK COLLECT
INTO hierlist
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
object_name = dimname and
CLAUSE = 'HIERARCHY' and
include = 1;
for i in 1 .. hierlist.count loop
-- HIERARCHY clause
-- e.g. HIERARCHY category_primary_parent AS varchar2(100) FROM category_parentrel(category_hierlist 'PRIMARY')
SELECT *
INTO ov_rec
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
object_name = dimname and
hierarchy = hierlist(i) and
CLAUSE = 'HIERARCHY' and
include = 1;
limitmap := limitmap || '-' || chr(10) || ' HIERARCHY ' || ov_rec.column_name ||
-- || ' AS ' || ov_rec.data_type ||
' FROM ' || ov_rec.aw_object;
-- INHIERARCHY clause
-- e.g. INHIERARCHY category_inhier
SELECT *
INTO ov_rec
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
object_name = dimname and
clause = 'INHIERARCHY' and
include = 1;
limitmap := limitmap || ' -' || chr(10) || ' INHIERARCHY ' || ov_rec.aw_object;
-- HATTRIBUTE clause (hierarchical attributes)
-- e.g HATTRIBUTE time_end_date FROM aw_time_end_date
DECLARE CURSOR hattr_cur is
SELECT *
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
object_name = dimname and
clause = 'HATTRIBUTE' and
include = 1;
BEGIN
for ov_rec in hattr_cur loop
limitmap := limitmap || ' -' || chr(10) || ' HATTRIBUTE ' || ov_rec.column_name ||
' FROM ' || ov_rec.aw_object;
end loop;
end;
-- FAMILYREL clause
-- e.g. FAMILYREL total_category_id AS varchar2(10),
-- category_id AS varchar2(10),
-- item_id AS varchar2(10)
-- FROM category_familyrelval (category_levellist 'TOTAL_CATEGORY'),
-- category_familyrelval (category_levellist 'CATEGORY'),
-- category_familyrelval (category_levellist 'ITEM')
-- show('..... FAMILYREL clause');
DECLARE CURSOR familyrel_cur is
SELECT *
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
object_name = dimname and
hierarchy = hierlist(i) and
clause = 'FAMILYREL' and
include = 1
ORDER BY position;
BEGIN
target := null;
aw_source := null;
for ov_rec in familyrel_cur loop
if target is null
then
target := ' -' || chr(10) || ' FAMILYREL ' || ov_rec.column_name; -- || ' AS ' || ov_rec.data_type;
aw_source := ' -' || chr(10) || ' FROM ' || ov_rec.aw_object;
else
target := target || ', -' || chr(10) || ' ' || ov_rec.column_name; -- || ' AS ' || ov_rec.data_type;
aw_source := aw_source || ', -' || chr(10) || ' ' || ov_rec.aw_object;
end if;
end loop;
end;
limitmap := limitmap || target || aw_source;
-- FAMILYREL LABEL clause
-- e.g. FAMILYREL total_category_id AS varchar2(10),
-- category_id AS varchar2(10),
-- item_id AS varchar2(10)
-- FROM category_familyrelval (category_levellist 'TOTAL_CATEGORY'),
-- category_familyrelval (category_levellist 'CATEGORY'),
-- category_familyrelval (category_levellist 'ITEM')
DECLARE CURSOR familyrel_cur is
SELECT *
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
object_name = dimname and
hierarchy = hierlist(i) and
clause = 'FAMILYREL_LONG_DESC' and
include = 1
ORDER BY position;
BEGIN
target := null;
aw_source := null;
for ov_rec in familyrel_cur loop
if target is null
then
target := ' -' || chr(10) || ' FAMILYREL ' || ov_rec.column_name; -- || ' AS ' || ov_rec.data_type;
aw_source := ' -' || chr(10) || ' FROM ' || ov_rec.aw_object;
else
target := target || ', -' || chr(10) || ' ' || ov_rec.column_name; -- || ' AS ' || ov_rec.data_type;
aw_source := aw_source || ', -' || chr(10) || ' ' || ov_rec.aw_object;
end if;
label_var := ov_rec.dimension_desc;
end loop;
end;
if aw_source is not null
then aw_source := aw_source || ' -' || chr(10) || ' LABEL ' || label_var;
end if;
limitmap := limitmap || target || aw_source;
end loop; -- Hierarchy loop
-- ATTRIBUTE clause
-- e.g ATTRIBUTE category_long_description AS varchar2(100) FROM category_long_description
DECLARE CURSOR attr_cur is
SELECT *
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
object_name = dimname and
clause = 'ATTRIBUTE' and
include = 1;
BEGIN
for ov_rec in attr_cur loop
limitmap := limitmap || ' -' || chr(10) || ' ATTRIBUTE ' || ov_rec.column_name ||
-- ' AS ' || ov_rec.data_type ||
' FROM ' || ov_rec.aw_object;
end loop;
end;
return limitmap;
show ('.. completed genrating limitmap for dimension ' || dimname);
END getDimensionLimitmap;
-- Returns the limitmap for a cube
FUNCTION getCubeLimitmap (
strOwner varchar2,
strAWname varchar2,
strCubename varchar2) return clob as
type dim_table is table of all_olap2_aw_cube_dim_uses.dimension_aw_name%TYPE INDEX BY BINARY_INTEGER;
dimlist dim_table;
limitmap clob;
owner varchar2(30);
awname varchar2(30);
cubename varchar2(30);
meas_rec olap_mappings%ROWTYPE;
meas_clause varchar2(1000);
run_date date;
no_values boolean;
yesno number;
dimmap clob;
aw_date date;
BEGIN
show('... generating limitmap for cube ' || cubename);
owner := upper(strOwner);
awname := upper(strAWname);
cubename := upper(strCubename);
-- Update the metadata cache if nec.
begin
-- Get the timestamp for when the AW was last updated
aw_date := getLastUpdateDate(owner, awname);
SELECT aw_last_updated
INTO run_date
FROM olap_mappings
WHERE aw_name = awname and
aw_owner = owner and
cube_name = cubename and
rownum = 1;
exception
when NO_DATA_FOUND then
no_values := true;
end;
-- Check if the cube cache needs to be updated.
-- This occurs if the AW has been updated since the view was created
if no_values or run_date < aw_date
then
show ('..... mapping table out of date for cube ' || cubename || '. Updating mapping table.');
yesno := generateCubeMap(owner, awname, cubename);
if yesno = 0
then return null;
end if;
end if;
-- Get the limitmap for each of the cube's dimensions
show('..... retrieving dimensions for the cube. Need limitmap for each dimension.');
SELECT dimension_aw_name
BULK COLLECT
INTO dimlist
FROM all_olap2_aw_cube_dim_uses
WHERE aw_owner = owner and
aw_name = awname and
aw_logical_name = cubename;
for i in 1 .. dimlist.count loop
dimmap := getDimensionLimitmap(owner, awname, dimlist(i));
if dimmap is null
then return null;
end if;
if limitmap is null
then limitmap := dimmap;
else limitmap := limitmap || '-' || chr(10) || dimmap;
end if;
end loop;
-- Get the limitmap for the measures in the cube
-- e.g. MEASURE amount AS number FROM expense_amount
-- show ('..... MEASURE clause');
DECLARE CURSOR meas_cur is
SELECT *
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
cube_name = cubename and
include = 1;
BEGIN
for meas_rec in meas_cur
loop
meas_clause := ' MEASURE ' || meas_rec.column_name;
-- Add data type if necessary (for numeric columns)
if meas_rec.data_type is not null then
meas_clause := meas_clause || ' AS ' || meas_rec.data_type;
end if;
meas_clause := meas_clause || ' FROM ' || meas_rec.aw_object;
limitmap := limitmap || '-' || chr(10) || meas_clause;
end loop;
END;
-- Add the ROW2CELL calc. This enables arbitrary OLAP DML calcs dynamically thru sql
limitmap := limitmap || '-' || chr(10) || ' ROW2CELL olap_calc';
show ('... completed generating limitmap for cube ' || cubename);
return limitmap;
END getCubeLimitmap;
-- Returns the SQL Model Clause or Comments for a Dimension or Cube View
FUNCTION getSQLText (
strOwner varchar2,
strAWName varchar2,
strObjType varchar2, -- CUBE or DIMENSION
strObject varchar2, -- Name of cube or dimension
strType varchar2, -- MODEL or COMMENT
strViewName varchar2
) return varchar2 as
clause varchar2(10000);
comments varchar2(32000);
type om_table_type is table of olap_mappings%ROWTYPE;
dimlist om_table_type;
measlist om_table_type;
owner varchar2(30);
awname varchar2(30);
objtype varchar2(30);
obj varchar2(30);
comma varchar2(2);
BEGIN
owner := upper(strOwner);
awname := upper(strAWname);
objtype := upper(strObjType);
obj := upper(strObject);
-- Need to generate a model clause that looks like the following:
/* MODEL
DIMENSION BY(
channel_id
MEASURES(
channel_primary_parent,
channel_total_channel_id,
channel_total_channel_desc,
channel_channel_id,
channel_channel_desc,
channel_level,
channel_long_description,
channel_short_description
RULES UPDATE SEQUENTIAL ORDER(); */
clause := 'MODEL ' || chr(10) || ' DIMENSION BY (';
-- Collect dimension list
if objtype = 'DIMENSION' then
-- Retrieve the dimension's column
SELECT *
INTO dimlist(1)
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
object_name = obj and
clause = 'DIMENSION';
else
-- Retrieve the columns for each of the dimensions for this cube
SELECT *
BULK COLLECT
INTO dimlist
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
clause = 'DIMENSION' and
object_name in (
SELECT dimension_aw_name
FROM all_olap2_aw_cube_dim_uses
WHERE aw_owner = owner and
aw_name = awname and
aw_logical_name = obj);
end if;
-- Populate the clause with the dimension id column
-- Populate the comments if there are any... (e.g. COMMENT ON COLUMN OLAP_VIEWS.OLAP_MAPPINGS.LAST_UPDATED IS 'Timestamp when the view was created'; )
comments := '';
for i in 1 .. dimlist.count loop
if dimlist(i).description is not null
then comments := comments || chr(10) || 'COMMENT ON COLUMN ' || strViewName || '.' || dimlist(i).column_name
|| ' IS ''' || dimlist(i).description || ''';';
end if;
if i = 1 then
clause := clause || chr(10) || ' ' || dimlist(i).column_name;
else
clause := clause || ',' || chr(10) || ' ' || dimlist(i).column_name;
end if;
end loop;
-- Close DIMENSION BY clause and add MEASURES clause
clause := clause || ')' || chr(10) || ' MEASURES (';
-- Begin by adding all the dimension attributes
-- This is required for both dimensions and cubes
comma := null;
for i in 1 .. dimlist.count loop
SELECT *
BULK COLLECT
INTO measlist
FROM olap_mappings
WHERE clause in ('HIERARCHY', 'FAMILYREL', 'FAMILYREL_LONG_DESC', 'ATTRIBUTE', 'HATTRIBUTE' ) and
aw_name = awname and
aw_owner = owner and
include = 1 and
object_name in (SELECT object_name
FROM olap_mappings
WHERE column_name = dimlist(i).column_name);
for j in 1 .. measlist.count loop
clause := clause || comma || chr(10) || ' ' || measlist(j).column_name;
comma := ',';
end loop;
end loop;
-- If this is a cube, then get all the measures as well
measlist.delete;
if objtype = 'CUBE'
then
SELECT *
BULK COLLECT
INTO measlist
FROM olap_mappings
WHERE cube_name = obj and
aw_name = awname and
aw_owner = owner and
include = 1;
for i in 1 .. measlist.count loop
clause := clause || ',' || chr(10) || ' ' || measlist(i).column_name;
end loop;
-- Add the olap_calc column
clause := clause || ',' || chr(10) || ' ' || 'OLAP_CALC';
end if;
clause := clause || chr(10) || ' ) RULES UPDATE SEQUENTIAL ORDER()';
if strType = 'MODEL'
then return clause;
else return comments;
end if;
return null;
END getSQLText;
-- Returns the SQL Model Clause for a Dimension or Cube View
FUNCTION getModelClause (
strOwner varchar2,
strAWName varchar2,
strObjType varchar2, -- CUBE or DIMENSION
strObject varchar2 -- Name of cube or dimension
) return varchar2 as
clause varchar2(10000);
type col_table is table of olap_mappings.column_name%TYPE INDEX BY BINARY_INTEGER;
dimlist col_table;
measlist col_table;
owner varchar2(30);
awname varchar2(30);
objtype varchar2(30);
obj varchar2(30);
comma varchar2(2);
BEGIN
owner := upper(strOwner);
awname := upper(strAWname);
objtype := upper(strObjType);
obj := upper(strObject);
-- Need to generate a model clause that looks like the following:
/* MODEL
DIMENSION BY(
channel_id
MEASURES(
channel_primary_parent,
channel_total_channel_id,
channel_total_channel_desc,
channel_channel_id,
channel_channel_desc,
channel_level,
channel_long_description,
channel_short_description
RULES UPDATE SEQUENTIAL ORDER(); */
clause := 'MODEL ' || chr(10) || ' DIMENSION BY (';
-- Collect dimension list
if objtype = 'DIMENSION' then
-- Retrieve the dimension's column
SELECT column_name
INTO dimlist(1)
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
object_name = obj and
clause = 'DIMENSION';
else
-- Retrieve the columns for each of the dimensions for this cube
SELECT column_name
BULK COLLECT
INTO dimlist
FROM olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
clause = 'DIMENSION' and
object_name in (
SELECT dimension_aw_name
FROM all_olap2_aw_cube_dim_uses
WHERE aw_owner = owner and
aw_name = awname and
aw_logical_name = obj);
end if;
-- Populate the clause with the dimension id column
for i in 1 .. dimlist.count loop
if i = 1 then
clause := clause || chr(10) || ' ' || dimlist(i);
else
clause := clause || ',' || chr(10) || ' ' || dimlist(i);
end if;
end loop;
-- Close DIMENSION BY clause and add MEASURES clause
clause := clause || ')' || chr(10) || ' MEASURES (';
-- Begin by adding all the dimension attributes
-- This is required for both dimensions and cubes
comma := null;
for i in 1 .. dimlist.count loop
SELECT column_name
BULK COLLECT
INTO measlist
FROM olap_mappings
WHERE clause in ('HIERARCHY', 'FAMILYREL', 'FAMILYREL_LONG_DESC', 'ATTRIBUTE', 'HATTRIBUTE' ) and
aw_name = awname and
aw_owner = owner and
include = 1 and
object_name in (SELECT object_name
FROM olap_mappings
WHERE column_name = dimlist(i));
for j in 1 .. measlist.count loop
clause := clause || comma || chr(10) || ' ' || measlist(j);
comma := ',';
end loop;
end loop;
-- If this is a cube, then get all the measures as well
measlist.delete;
if objtype = 'CUBE'
then
SELECT column_name
BULK COLLECT
INTO measlist
FROM olap_mappings
WHERE cube_name = obj and
aw_name = awname and
aw_owner = owner and
include = 1;
for i in 1 .. measlist.count loop
clause := clause || ',' || chr(10) || ' ' || measlist(i);
end loop;
-- Add the olap_calc column
clause := clause || ',' || chr(10) || ' ' || 'OLAP_CALC';
end if;
clause := clause || chr(10) || ' ) RULES UPDATE SEQUENTIAL ORDER()';
return clause;
END getModelClause;
-- PUBLIC FUNCTIONS and PROCEDURES
-- Populates the olap_mappings table with the structure of the limitmap
FUNCTION generateDimensionMap (
strOwner varchar2,
strAWname varchar2,
strDimname varchar2) RETURN number as
owner olap_views.OLAP_MAPPINGS.AW_OWNER%TYPE;
awname olap_views.OLAP_MAPPINGS.AW_NAME%TYPE;
dimname olap_views.OLAP_MAPPINGS.OBJECT_NAME%TYPE;
qdr varchar2(100);
success boolean;
columnName olap_views.OLAP_MAPPINGS.COLUMN_NAME%TYPE;
displayName varchar2(100); -- Name displayed to users in end user tools
dimDisplayName varchar2(100); -- For a dimension, name displayed to users in end user tools
parent_obj varchar2(100); -- AW object that contains parent-child relation
hierlist_obj varchar2(100); -- AW object containing list of hierarchies
inhier_obj varchar2(100); -- AW object specifying members in a hierarchy
familyrel_obj varchar2(100); -- AW object specifying family relationship for level-based hiers
familyrelval_obj varchar2(100); -- AW object specifying family relationship for value-based hiers
levelrel_obj varchar2(100); -- AW object specifying the level for a dimension member
levelList_obj varchar2(100);
gidDimension_obj varchar2(100);
long_desc_obj varchar2(100);
depth_obj varchar2(100);
currentvalue varchar2(100);
hier_levels all_olap2_aw_dim_hier_lvl_ord%ROWTYPE;
attrib_record all_olap2_aw_attributes%ROWTYPE;
str varchar2(100);
TYPE awinfo_table IS TABLE OF all_olap2_aw_phys_obj_prop.aw_prop_value%TYPE
INDEX BY varchar2(100);
level_list awinfo_table;
physobj_list awinfo_table;
TYPE awinfo_type is RECORD (
prop_value all_olap2_aw_phys_obj_prop.aw_prop_value%TYPE,
prop_name all_olap2_aw_phys_obj_prop.AW_PROP_NAME%TYPE);
propValue_record awinfo_type;
isValueBased boolean;
aw_date date;
type olapCur is ref cursor;
physObjCur olapCur;
isAttached number;
maxdepth number;
i number;
gid_value number;
description varchar2(1000);
BEGIN
owner := upper(strOwner);
awname := upper(strAWname);
dimname := upper(strDimname);
show ('... populating dimension map for ' || dimname);
-- Ensure the AW is attached R/W first
isAttached := attachAW (owner, awname);
-- Get the timestamp for the last time the AW was updated
aw_date := getLastUpdateDate(owner, awname);
* Begin by caching key metadata objects and physical objects that will be required
* for the dimension table cache.
show ('..... clearing mappings for the dimension');
DELETE olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
object_name = dimname;
* Retrieve physical AW objects that represent the hierarchies, levels, descriptions, etc.
* Will retrieve information directly from the AW dictionary
show ('..... retrieving physical objects');
-- Begin by defining a shadow dimension for the NAME dimension and a formula highlighting the object type.
-- Populate this shadow dimension with the appropriate AW objects for this dimension
-- Note: it's okay if the name_id dimension already exists - the define will simply
-- cause a benign error. name_id is a temporary structure that does not need to be persisted
begin
dbms_aw.execute('oknullstatus = yes');
dbms_aw.execute('define name_id dimension text temp session');
-- list of AW objects
dbms_aw.execute('define EXPRESS!name_obj_type formula text <name_id> session');
dbms_aw.execute('eq if obj(property ''AW$ROLE'', name_id) eq ''ATTRDEF'' then obj(property ''AW$TYPE'', name_id) else obj(property ''AW$ROLE'', name_id)');
-- list of physical level names
dbms_aw.execute('define EXPRESS!level_physicalname formula text <name_id> session');
dbms_aw.execute('eq obj(property ''PHYSICALNAME'', name_id)');
-- list of level display names
dbms_aw.execute('define EXPRESS!level_displayname formula text <name_id> session');
dbms_aw.execute('eq obj(property ''DISPLAYNAME'', name_id)');
-- list of value hierarchy names
dbms_aw.execute('define valuehiers dimension text temp session');
dbms_aw.execute('define EXPRESS!hier_logicalname formula text <valuehiers> session');
dbms_aw.execute('eq obj(property ''AW$LOGICAL_NAME'', valuehiers)');
-- maximum depth of a value hierarchy
dbms_aw.execute('define EXPRESS!hier_maxdepth formula int <valuehiers> session');
dbms_aw.execute('eq numlines(obj(property ''HIERARCHY_LEVELS'', valuehiers))');
-- Check for exceptions..... occurs if the object supporting objects already exist.
exception
when others then
null;
end;
-- Clear the cached list of names
dbms_aw.execute('mnt name_id delete all');
-- Populate the shadow dimension with all the dimension related objects
dbms_aw.execute('mnt name_id merge limit(name to obj(property ''AW$PARENT_NAME'') eq ''' ||
dimname || ''' or obj(property ''AW$ROLE'') eq ''GID_DIMENSION'')');
-- Retrieve the objects and their properties
open physObjCur for 'SELECT prop_value, prop_name
FROM table(OLAP_TABLE(''EXPRESS duration session'', null, null,
''DIMENSION prop_name FROM name_id
MEASURE prop_value FROM name_obj_type''))';
BEGIN
loop
fetch physObjCur into propValue_record;
exit when physObjCur%NOTFOUND;
physobj_list(propValue_record.prop_value) := propValue_record.prop_name;
end loop;
close physObjCur;
END;
parent_obj := physobj_list('MEMBER_PARENTREL');
hierlist_obj := physobj_list('HIERLIST');
inhier_obj := physobj_list('MEMBER_INHIER');
familyrel_obj := physobj_list('MEMBER_FAMILYREL');
familyrelval_obj := physobj_list('MEMBER_FAMILYRELVAL');
levelList_obj := physobj_list('LEVELLIST');
levelrel_obj := physobj_list('MEMBER_LEVELREL');
gidDimension_obj := physobj_list('GID_DIMENSION');
long_desc_obj := physobj_list('MEMBER_LONG_DESCRIPTION');
-- Populate the value hierarchy collection
-- Use a similar technique to the one above to find the hierarchies
show ('..... checking for value hierarchies');
dbms_aw.execute('mnt valuehiers delete all');
-- Populate the valuehiers dimension with all the value hierarchies for this dimension
dbms_aw.execute('mnt valuehiers merge limit(name to obj(property ''AW$PARENT_NAME'') eq ''' ||
dimname || ''' and obj(property ''AW$ROLE'') eq ''HIERDEF'' and obj(property ''VALUE_HIERARCHY'') eq True)');
-- Populate the LEVEL labels collection
-- Again, use techniques similar to the one above ** CHECK VALUE HIERARCHIES **
show ('..... retrieving label for dimension levels');
-- Populate the shadow dimension with all the dimension related objects
dbms_aw.execute('mnt name_id delete all');
dbms_aw.execute('mnt name_id merge limit(name to obj(property ''AW$PARENT_NAME'') eq ''' ||
dimname || ''' and obj(property ''AW$ROLE'') eq ''LEVELDEF'')');
-- Retrieve the objects and their properties
open physObjCur for 'SELECT display_name prop_value, physical_name prop_name
FROM table(OLAP_TABLE(''EXPRESS duration session'', null, null,
''DIMENSION level_name FROM name_id
MEASURE physical_name FROM level_physicalname
MEASURE display_name FROM level_displayname''))';
BEGIN
loop
fetch physObjCur into propValue_record;
exit when physObjCur%NOTFOUND;
level_list(propValue_record.prop_name) := propValue_record.prop_value;
end loop;
close physObjCur;
END;
-- Update the cache with DIMENSION clause
-- Example:
-- DIMENSION category_id AS varchar2(100) FROM category WITH
show ('..... populating mapping info for the DIMENSION clause');
dimDisplayName := dbms_aw.eval_text('obj(property ''DISPLAYNAME'' ''' || dimname || ''')') || ' member';
-- DIMENSION clause
description := dimname || ' dimension member values';
INSERT INTO olap_mappings(last_updated, aw_last_updated, aw_owner, aw_name, clause,
object_name, column_name, aw_object,
column_label, description)
VALUES (cachedate, aw_date, owner, awname, 'DIMENSION',
dimname, dimname, dimname,
dimDisplayName, description);
-- Update the cache with INHIER clause
-- Example:
-- INHIERARCHY category_inhier
-- INHIERARCHY clause
show ('..... populating mapping info for the INHIERARCHY clause');
description := 'Identifies dimension members that are in a given hierarchy';
INSERT INTO olap_mappings(last_updated, aw_last_updated, aw_owner, aw_name, clause,
object_name, column_name, aw_object,
column_label, description)
VALUES (cachedate, aw_date, owner, awname, 'INHIERARCHY',
dimname, null, inhier_obj,
null, description);
-- Loop over the HIERARCHIES for this dimension
-- Update the cache with HIERARCHY and FAMILYREL clauses
-- Example:
-- HIERARCHY category_standard_prnt AS varchar2(100) FROM category_parentrel(category_hierlist \'STANDARD\')
currentvalue := ' ';
show ('..... retrieving hierarchy information');
DECLARE
CURSOR hier_levels_cur is
SELECT *
FROM all_olap2_aw_dim_hier_lvl_ord
WHERE aw_owner = owner and
aw_name = awname and
aw_dimension_name = dimname and
length(aw_hierarchy_name) > 0
ORDER BY aw_hierarchy_name asc, position asc;
BEGIN
for hier_levels in hier_levels_cur
loop
str := hier_levels.aw_hierarchy_name;
-- If there is a change in hierarchy, then add the HIERARCHY clause
if str != currentvalue
then
show ('..... populating mapping info for the HIERARCHY and FAMILYREL clauses for hierarchy ' || str);
currentvalue := hier_levels.aw_hierarchy_name;
columnName := getColumnName (dimname, currentvalue, 'MEMBER_PARENTREL');
qdr := parent_obj || '(' || hierlist_obj || ' \''' || currentvalue || '\'')';
description := dimname || ' member''s parent in hierarchy ' || currentvalue;
displayName := dimDisplayName || ' Parent';
-- HIERARCHY clause
INSERT INTO olap_mappings(last_updated, aw_last_updated, aw_owner, aw_name, clause,
object_name, hierarchy, column_name, aw_object,
column_label, description)
VALUES (cachedate, aw_date, owner, awname, 'HIERARCHY',
dimname, currentvalue, columnName, qdr,
displayName, description);
-- Check if current hierarchy is value based
dbms_aw.execute('limit valuehiers to hier_logicalname eq ''' || currentvalue || '''');
if dbms_aw.eval_number('statlen(valuehiers)') = 0
then isValueBased := false;
else isValueBased := true;
end if;
-- Get the maximum depth of a value hierarchy
-- Also, set up the depth variable for a value-based hierarchy
if isValueBased then
maxdepth := dbms_aw.eval_number('hier_maxdepth');
i := maxdepth;
-- The depth object represents a level in a value based hierarchy
-- This object is not in standard form and will be created if nec by
-- getDepthVar
if depth_obj is null then
depth_obj := getDepthVar(owner, awname, dimname, hierlist_obj, parent_obj);
end if;
-- Add a LEVEL hierarchy attribute
-- There must be a level (or depth) attribute by hierarchy, since the level may change by hierarchy
columnName := substr(dimname, 1, 10) || '_' || substr(currentvalue, 1, 10) || '_LEVEL';
description := 'Depth of ' || dimname || ' member in hierarchy ' || currentvalue;
displayName := dimDisplayName || ' level';
INSERT INTO olap_mappings(last_updated, aw_last_updated, aw_owner, aw_name, clause,
object_name, column_name, aw_object,
column_label, description)
VALUES (cachedate, aw_date, owner, awname, 'HATTRIBUTE',
dimname, columnName, depth_obj,
displayName, description);
end if;
end if;
-- Add the FAMILYREL clause for this level
if isValueBased
then
i := i - 1;
gid_value := power(2, i) - 1;
-- columnName := getColumnName(dimname, hier_levels.aw_level_name, 'MEMBER_LEVELREL');
qdr := familyrelval_obj || '(' || gidDimension_obj || ' ' || gid_value || ')';
displayName := currentvalue || ' Level ' || hier_levels.position;
str := substr(currentvalue, 1, 8) || hier_levels.position;
columnName := getColumnName(dimname, str, 'MEMBER_LEVELREL');
description := dimname || ' member''s ancestor value for level ' || hier_levels.position || ' in hierarchy ' || currentvalue;
-- FAMILYREL clause
INSERT INTO olap_mappings(last_updated, aw_last_updated, aw_owner, aw_name, clause,
object_name, hierarchy, level_name, column_name, aw_object,
position, column_label, description, include)
VALUES (cachedate, aw_date, owner, awname, 'FAMILYREL',
dimname, currentvalue, str, columnName, qdr,
hier_levels.position, displayName || ' ID', description, include_level_id);
-- FAMILYREL description clause
description := dimname || ' member''s ancestor descriptive value for level ' || hier_levels.position || ' in hierarchy ' || currentvalue;
columnName := getColumnName(dimname, str, 'MEMBER_LEVELREL_DESC');
INSERT INTO olap_mappings(last_updated, aw_last_updated, aw_owner, aw_name, clause,
object_name, hierarchy, level_name, column_name, aw_object,
dimension_desc, position, column_label, description)
VALUES (cachedate, aw_date, owner, awname, 'FAMILYREL_LONG_DESC',
dimname, currentvalue, str, columnName, qdr,
long_desc_obj, hier_levels.position, displayName || ' Description', description);
else
-- Level based hierarchies use the level list object
-- They also use the FAMILYREL as the hierarchy structure
-- columnName := getColumnName(dimname, hier_levels.aw_level_name, 'MEMBER_LEVELREL');
columnName := getColumnName(dimname, hier_levels.aw_level_name, 'MEMBER_LEVELREL');
qdr := familyrel_obj || '(' || levelList_obj || ' \''' ||
hier_levels.aw_level_name || '\'')';
displayName := level_list(hier_levels.aw_level_name);
description := dimname || ' member''s ancestor value for level ' || hier_levels.aw_level_name || ' in hierarchy ' || currentvalue;
-- FAMILYREL clause
INSERT INTO olap_mappings(last_updated, aw_last_updated, aw_owner, aw_name, clause,
object_name, hierarchy, level_name, column_name, aw_object,
position, column_label, description, include)
VALUES (cachedate, aw_date, owner, awname, 'FAMILYREL',
dimname, currentvalue, hier_levels.aw_level_name, columnName, qdr,
hier_levels.position, displayName || ' ID', description, INCLUDE_LEVEL_ID);
-- FAMILYREL description clause
-- columnName := getColumnName(dimname, hier_levels.aw_level_name, 'LEVEL_LONG_DESCRIPTION');
columnName := getColumnName(dimname, hier_levels.aw_level_name, 'MEMBER_LEVELREL_DESC');
description := dimname || ' member''s ancestor descriptive value for level ' || hier_levels.aw_level_name || ' in hierarchy ' || currentvalue;
INSERT INTO olap_mappings(last_updated, aw_last_updated, aw_owner, aw_name, clause,
object_name, hierarchy, level_name, column_name, aw_object,
dimension_desc, position, column_label, description)
VALUES (cachedate, aw_date, owner, awname, 'FAMILYREL_LONG_DESC',
dimname, currentvalue, hier_levels.aw_level_name, columnName, qdr,
long_desc_obj, hier_levels.position, displayName || ' Description', description);
end if;
END LOOP; -- Loop over hierarchy levels
END; -- Cursor for hierarchy levels
-- Add ATTRIBUTES for the dimension
show ('..... populating mapping info for the ATTRIBUTE clause');
DECLARE
CURSOR attributes_cur is
SELECT *
FROM all_olap2_aw_attributes
WHERE aw_owner = owner and
aw_name = awname and
aw_dimension_name = dimname;
BEGIN
for attrib_record in attributes_cur
loop
columnName := getColumnName(attrib_record.aw_dimension_name,
attrib_record.aw_logical_name,
attrib_record.attribute_type);
description := attrib_record.description;
displayName := attrib_record.display_name;
/* if attrib_record.attribute_type in ('MEMBER_SHORT_DESCRIPTION', 'MEMBER_LONG_DESCRIPTION')
then
description := attrib_record.description;
displayName := attrib_record.display_name;
else
description := attrib_record.aw_dimension_name || ' attribute ' || attrib_record.aw_physical_object;
displayName := attrib_record.display_name;
end if;
-- ATTRIBUTE clause
-- Throwing column name
show ('Attribute clause column name= ' || columnName);
INSERT INTO olap_mappings(last_updated, aw_last_updated, aw_owner, aw_name, clause,
object_name, column_name, aw_object,
column_label, description)
VALUES (cachedate, aw_date, owner, awname, 'ATTRIBUTE',
dimname, columnName, attrib_record.aw_physical_object,
displayName, description);
end loop;
END;
-- Add the LEVELREL object as an attribute of the dimension.
columnName := getColumnName(dimname, null, 'LEVEL_ATTRIBUTE');
description := dimDisplayName || ' level';
displayName := description;
-- Throwing column name
show ('Levelrel clause column name= ' || columnName);
INSERT INTO olap_mappings(last_updated, aw_last_updated, aw_owner, aw_name, clause,
object_name, column_name, aw_object,
column_label, description)
VALUES (cachedate, aw_date, owner, awname, 'ATTRIBUTE',
dimname, columnName, levelrel_obj,
displayName, description);
-- Finally, ensure that the columns are unique across the the AW.
-- For example, if month_lvl is in two hierarchies, there will need to be two
-- columns: 1) month_lvl and 2) month_lvl1. Or, if there is a product dimension
-- and a product measure, these will also be uniquely identified
UPDATE olap_mappings map
SET map.column_name =
(SELECT case when (b.cum_occurrence > 1) then b.column_name || (b.cum_occurrence - 1)
else b.column_name
end as column_name
FROM
(SELECT a.aw_owner,
a.aw_name,
a.cube_name,
a.column_name,
SUM(a.occurrence) over(PARTITION BY cube_name, column_name ORDER BY occurrence ROWS unbounded preceding) cum_occurrence
FROM
(SELECT aw_owner,
aw_name,
cube_name,
column_name,
1 occurrence
FROM olap_mappings
WHERE aw_name= awname and
aw_owner=owner) a
) b
WHERE map.rowid = b.rowid)
WHERE map.aw_name = awname and
map.aw_owner = owner;
commit;
show ('... completed populating mapping for ' || dimname);
detachAW(owner, awname, isAttached);
return 1;
exception
when NO_DATA_FOUND then
rollback;
show ('**');
show ('** Error retrieving metadata for dimension ' || dimname);
show ('** You do not have access to the data in the AW.');
show ('** View creation failed');
show ('**');
show (SQLERRM);
detachAW(owner, awname, isAttached);
return 0;
when others then
rollback;
show ('**');
show ('** Error retrieving metadata for dimension ' || dimname);
show ('** View creation failed');
show ('**');
show (SQLERRM);
detachAW(owner, awname, isAttached);
return 0;
END generateDimensionMap;
-- Updates the OLAP_MAPPINGS table with information about a cube
FUNCTION generateCubeMap (
strOwner varchar2,
strAWname varchar2,
strCubename varchar2) return number as
owner varchar2(30);
awname varchar2(30);
cubename varchar2(30);
aw_date date;
BEGIN
owner := upper(strOwner);
awname := upper(strAWname);
cubename := upper(strCubename);
aw_date := getLastUpdateDate(owner, awname);
show ('... populating mapping for cube ' || cubename);
show ('..... clearing mappings for the cube');
DELETE olap_mappings
WHERE aw_owner = owner and
aw_name = awname and
cube_name = cubename;
-- Retrieve each of the measures
show ('..... collecting metadata for measures in cube');
INSERT INTO olap_mappings(last_updated, aw_last_updated, aw_owner, aw_name, cube_name, clause,
object_name, column_name, aw_object,
data_type,
column_label, description)
(SELECT cachedate, aw_date, aw_owner, aw_name, aw_cube_name, 'MEASURE',
aw_measure_name, aw_measure_name, aw_physical_object,
olap_views.olap_viewGenerator.getDataType(aw_owner, aw_name, aw_physical_object),
display_name, 'Measure ' || aw_measure_name
FROM all_olap2_aw_cube_measures);
commit;
return 1;
exception
when others then
rollback;
show ('**');
show ('** Error retrieving metadata for cube ' || cubename);
show ('** View creation failed');
show ('**');
show (SQLERRM);
return 0;
END generateCubeMap;
PROCEDURE createCubeView (
strOwner varchar2,
strAWname varchar2,
strCubename varchar2,
commitLog boolean) as
owner varchar2(30);
awname varchar2(30);
cubename varchar2(30);
limitmap clob;
cmd varchar2(4000);
output varchar2(4000);
varname varchar2(100);
sql_text varchar2(32767);
viewname varchar2(61);
cube_rec all_olap2_aw_cubes%rowtype;
type dim_table is table of all_olap2_aw_cube_dim_uses.dimension_aw_name%TYPE INDEX BY BINARY_INTEGER;
dimlist dim_table;
isAttached number;
BEGIN
owner := upper(strOwner);
awname := upper(strAWname);
cubename := upper(strCubename);
varname := cubename || '_CUBE_LIMITMAP';
viewname := owner || '.' || substr(cubename, 1, 21) || '_CUBEVIEW';
show ('. Creating view for cube ' || cubename);
-- Validate the arguments
begin
SELECT *
INTO cube_rec
FROM all_olap2_aw_cubes
WHERE aw_name = awname and
aw_owner = owner and
aw_logical_name = cubename;
exception
when NO_DATA_FOUND then
show ('**');
show ('** ERROR: View not created.');
show ('** Invalid arguments. Ensure that the schema, AW and cube names are valid.');
show ('** In addition, ensure that you have r/w priviliges to the AW.');
show ('**');
if commitLog
then updateLogTable();
end if;
raise;
end;
-- Attach the AW
begin
isAttached := attachAW(owner, awname);
exception
when others then
show ('**');
show ('** ERROR: View not created.');
show ('** Unable to attach AW r/w. Ensure no other users have the AW attached RW - then try again.');
show ('** In addition, ensure that you have r/w priviliges to the AW.');
show ('**');
if commitLog
then updateLogTable();
end if;
raise;
end;
-- Define the limitmap variable in the AW and assign the limitmap text to it
show ('..... generating limitmap for cube');
limitmap := getCubeLimitmap(owner, awname, cubename);
if limitmap is null
then
if commitLog then
updateLogTable();
raise bad_limitmap;
end if;
end if;
-- Define the variable
show ('..... assigning limitmap to variable in the AW');
begin
dbms_aw.execute('define ' || varname || ' variable text');
-- If the variable already exists, simply update it
exception
when others then
show ('..... ' || varname || ' found. Will update the variable');
end;
-- Assign the limitmap. Update and commit changes
begin
output := dbms_aw.interpclob(varname || ' = ''' || limitmap || '''');
dbms_aw.aw_update(owner, awname);
commit;
detachAW(owner, awname, isAttached);
exception
when others then
show ('**');
show ('** ERROR: View not created.');
show ('** CAUSE: Unable to assign the limitmap variable in the AW.');
show (SQLERRM);
detachAW(owner, awname, isAttached);
-- if commitLog
-- then updateLogTable();
-- end if;
raise;
end;
-- Create the view over the AW
-- Example:
CREATE or REPLACE VIEW channel_dimview AS
SELECT *
FROM table(OLAP_TABLE('GLOBAL.GLOBAL duration session',
'&(CHANNEL_LIMITMAP)' ))
show ('..... defining view ' || viewname || ' over the cube');
sql_text := 'CREATE OR REPLACE VIEW ' || viewname || ' AS ' || chr(10) ||
' SELECT * ' || chr(10) ||
' FROM table(OLAP_TABLE (''' || owner || '.' || awname || ' duration session'',' || chr(10) ||
''''',' || chr(10) ||
''''',' || chr(10) ||
'''&(' || varname || ')''))';
-- Add SQL Model clause
sql_text := sql_text || chr(10) ||
getSQLText(owner, awname, 'CUBE', cubename, 'MODEL', null);
begin
execute immediate sql_text;
exception
when others then
show ('**');
show ('** ERROR: View not created.');
show ('** CAUSE: CREATE VIEW statement failed');
show (SQLERRM);
show ('*** DEBUG INFORMATION ***');
show ('VIEW CREATION DDL ((truncated after 3900 characters)');
show (substr(sql_text, 1, 3900));
show ('LIMITMAP (truncated after 3900 characters):');
show (substr(limitmap, 1, 3900));
raise;
end;
-- Update the catalog containing the views and their contents
begin
-- Update the limitmap catalog
DELETE olap_view_limitmap
WHERE aw_owner = owner and
aw_name = awname and
view_name = viewname;
INSERT INTO olap_view_limitmap(last_updated, aw_owner, aw_name,
view_name, limitmap)
VALUES (cachedate, owner, awname,
viewname, limitmap);
-- Update the object catalog with the cube
DELETE olap_view_objects
WHERE aw_owner = owner and
aw_name = awname and
view_name = viewname and
cube_name = cubename;
INSERT INTO olap_view_objects(last_updated, aw_owner, aw_name,
view_name, cube_name)
VALUES (cachedate, owner, awname,
viewname, cubename);
-- Update the object catalog with the dimensions for the cube
SELECT dimension_aw_name
BULK COLLECT
INTO dimlist
FROM all_olap2_aw_cube_dim_uses
WHERE aw_owner = owner and
aw_name = awname and
aw_logical_name = cubename;
for i in 1 .. dimlist.count loop
DELETE olap_view_objects
WHERE aw_owner = owner and
aw_name = awname and
view_name = viewname and
dimension_name = dimlist(i);
INSERT INTO olap_view_objects(last_updated, aw_owner, aw_name,
view_name, dimension_name)
VALUES (cachedate, owner, awname,
viewname, dimlist(i));
end loop;
commit;
exception
when others then
rollback;
show ('**');
show ('** ERROR: Unable to update the OLAP_VIEW_OBJECTS and/or OLAP_VIEW_LIMITMAP catalog tables.');
show (SQLERRM);
show ('** NOTE: View ' || viewname || ' was successfully created.');
if commitLog
then updateLogTable();
end if;
return;
end;
show ('View ' || viewname || ' successfully created');
if commitLog
then updateLogTable();
end if;
return;
exception
when others then
rollback;
show ('**');
show ('** ERROR: Unable to create view over cube ' || cubename || '.');
show (SQLERRM);
if commitLog
then updateLogTable();
end if;
raise;
END createCubeView;
PROCEDURE createCubeView (
strOwner varchar2,
strAWname varchar2,
strCubename varchar2) as
BEGIN
createCubeView(strOwner, strAWname, strCubename, true);
END createCubeView;
PROCEDURE createDimensionView (
strOwner varchar2,
strAWname varchar2,
strDimname varchar2,
commitLog boolean) as
owner varchar2(30);
awname varchar2(30);
dimname varchar2(30);
limitmap clob;
cmd varchar2(4000);
output varchar2(4000);
varname varchar2(100);
sql_create varchar2(32767);
viewname varchar2(61);
dim_rec all_olap2_aw_dimensions%ROWTYPE;
isAttached number;
BEGIN
owner := upper(strOwner);
awname := upper(strAWname);
dimname := upper(strDimname);
varname := dimname || '_LIMITMAP';
viewname := owner || '.' || substr(dimname, 1, 22) || '_DIMVIEW';
show ('. Creating view for dimension ' || dimname);
begin
SELECT *
INTO dim_rec
FROM all_olap2_aw_dimensions
WHERE aw_name = awname and
aw_owner = owner and
aw_logical_name = dimname;
exception
when NO_DATA_FOUND then
show ('**');
show ('** ERROR: View not created.');
show ('** Invalid arguments. Ensure that the schema, AW and dimension names are valid.');
show ('** In addition, ensure that you have r/w priviliges to the AW.');
show ('**');
if commitLog
then updateLogTable();
end if;
raise;
end;
-- Attach the AW
begin
isAttached := attachAW(owner, awname);
exception
when others then
show ('**');
show ('** ERROR: View not created.');
show ('** Unable to attach AW r/w. Ensure no other users have the AW attached RW - then try again.');
show ('** In addition, ensure that you have r/w priviliges to the AW.');
show ('**');
if commitLog
then updateLogTable();
end if;
raise;
end;
-- Define the limitmap variable in the AW and assign the limitmap text to it
limitmap := getDimensionLimitmap(owner, awname, dimname);
if limitmap is null
then
show ('Error defining limitmap.');
if commitLog
then updateLogTable();
end if;
raise bad_limitmap;
end if;
-- Define the variable
begin
dbms_aw.execute('define ' || varname || ' variable text');
-- If the variable already exists, simply update it
exception
when others then
show ('..... will update variable ' || varname);
end;
-- Assign the limitmap. Update and commit changes
begin
output := dbms_aw.interpclob(varna -
Having problems downloading View Generator
Im trying to prepare AW and one of the thing listed as required is OLAP View Generator Sample at http://www.oracle.com/technology/products/bi/olap/viewGenerator_1_0_1.zip
but Im getting a 404 error. Anyone can link me an alternative download source...tried to google it but nothing came up.
Message was edited by:
morfyhHi,
I'm not sure where you got that link from, but on the oracle OLAP page on OTN ( http://www.oracle.com/technology/products/bi/olap/index.html ) there is the following link:
http://www.oracle.com/technology/products/bi/olap/viewGenerator_1_0_2.zip and it seems to be working.
When you start with the view generator, remember to read the readme file and run the necessary scripts.
Ragnar -
Has Anyone used View Generator in Workspace Manager 10.2.0.3A
It does not seem to show the dimensional attributes and all the pretty pictures in the blogs/forums seem to work!!!!
Can you tell me if I am missing something?Hi,
View Generator appears to be an OLAP product, which is distinct from Workspace Manager. I would recommend to use the following forum:
OLAP
Regards,
Ben -
Problem with using View Generator Plug-in in AWM
Hi,
I have noticed that the View Generator Plug-in does not show me the Level Short Desc and Level Long Desc when I pick the fields to be written to the view. Has anybody encountered this before? I am using Oracle 10gR2
Thanks,
BharatHi Bharat,
I checked my 10.2.0.3 environment and both the long and short description attributes are shown for each dimension. If you have not already done so, download the 10.2.0.3.A version of AWM and the associated "A" version of the SQL View generator from the OLAP home page on OTN.
Hope this helps
Keith
Keith Laker
Oracle Data Warehouse Product Management
OLAP Blog: http://oracleOLAP.blogspot.com/
OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
DM Blog: http://oracledmt.blogspot.com/
OWB Blog : http://blogs.oracle.com/warehousebuilder/
OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html -
SQL View Generator plug-in does not create LIMITMAP
I was wondering if anyone has encountered an issue where they create a SQL View using the AWM plug-in over an OLAP dimension but then receieve the error "ORA-34492 Analytic Workspace object <AW>.LIMITMAP does not exist" when they try to query the dimension. I created several SQL Views over other dimensions and they work just fine.
Thanks,
ScottHi Scott,
There may be a couple of reasons for this and I have seen this error myself. Firstly I think you are using 10gOLAP, correct? You should be using 10.2.0.3 patchset, then you need to apply the addition OLAP A database patch. These two patches can be downloaded from Metalink.
Next you need to download the updated version of AWM, 10.2.0.3.A from the OLAP home page on OTN. Then from the same page download and install the updated SQLView generator and make sure all the SQL scripts are installed correctly with no errors.
Once all that is done, the next step is to look at the cube you are trying to view. There is a limit (not sure of the exact details in terms of size) on the size of the LIMITMAP command that can be generated. Typically, if you have very long column names and very long AW name this can cause problems. In the first screen (I think) of the view generator there is the option to change the column names, which gives you the option to reduce the size of the names assigned to each column.
To try and debug this I would try creating a very simple view, based on one single measure from your cube and only select the dimension attribute "long description". Before you test the view, use the OLAP Worksheet within AWM to check if the LIMITMAP object was created. The name of the limitmap object is name_of_your_cube_LIMITMAP. If this object has not been created then I suspect there is something wrong with the PL/SQL package creating the view and we will need to switch on some tracing to determine why this is not working.
Hope this helps
Keith Laker
Oracle Data Warehouse Product Management
OLAP Blog: http://oracleOLAP.blogspot.com/
OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
DM Blog: http://oracledmt.blogspot.com/
OWB Blog : http://blogs.oracle.com/warehousebuilder/
OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html -
Table Maintenance View Generator - 46C to 60 compatibility
Table Maintenance View Generator - 46C to 60 compatibility
I think SAP changed the way it generated its View Maintenance Screens some time after release 46C such that view maintenance dialogs in 46C are maintainable in subsequent releases but that view dialogs created in subsequent releases are not compatible in 46C. <u>This is my hypothesis.</u>
<b>Can someone confirm? Is there a way to revert 60 code to the way the dialog was generated in 46C?</b>
The error in the transport log from a 60 system to a 46C system is:
"Field '<VIM_TOTAL_STRUC>' is unknown. It is neither in one of the specified"Hi April,
You can use standard program <b>RSWBO052</b> to change the package. Enter the object and mark the checkbox -> Execute -> Place the cursor in the object -> Right click mouse -> Reassign -> Enter new package -> Save.
or you can go to transaction SE80 -> Select Package -> Enter &TMP -> Hit Enter -> Find your object -> put the cursor and right click -> Other functions -> Object Directory Entry -> Change -> Change the package -> Save.
Hope this will help.
Regards,
Ferry Lianto
Please reward point if helpful. -
Flexfield View Generator Program Was Terminated With Signal 11
Hi All,
After compiling any flexfield, the Flexfield View Generator concurrent program is getting initiated which is completing with error status with the following log message:
/oracle/findev1/APPS/R12/apps/apps_st/appl/fnd/12.0 .0/bin/FNDFFVGN
Program was terminated by signal 11.
Need help related to the root cause of the error.
Thanks,
Chandra.Please see these docs.
During Patch FNDFFVGN Fails With EMSG Message And Signal 11 [ID 1364773.1]
12.1 Upgrade Has Invalid KFV With VIEW_HAS_FAILED_CHECK_LOG_FILE [ID 975083.1]
If you still have the same issue, please relink FNDFFVGN via adadmin and check then -- 11i : How To relink a single executable via ADADMIN Utility [ID 388198.1]
Thanks,
Hussein -
2 views generated from 1 Sqlserver view; associated trigger is on the 2nd v
I am getting mystifying results after my Sqlserver to Oracle conversion (which gave no errors). When the application runs against the Oracle database, it gives errors on attempts to insert into a view. We make heavy use of INSTEAD OF triggers to insert into views which are JOINs of several other tables. (We do a lot of subtyping where the common stuff lives in one table, and the data specific to different subtypes lives in lower-level tables, sometimes 3 or 4 levels deep). So we insert into views which are joins of the tables at all the necessary levels, with the PK at all levels having the same value.
Here's an eg. of our lookup code tables: The top table is tDbobjects, which contains fields like 'entered by', created date, etc.
Next level down is tLookupObjects, which contains fields like 'french desc', 'english desc'
Bottom level is tRaceTypes, which contains (at a minimum), 'code value'
So, the RaceTypes view contains all the fields from the 3 tables, via a join of tDbobjects, TlookupObjects, TRaceTypes, where the PK of all 3 is the same.
And, there's an Instead Of trigger on the RaceTypes view for insert. (named RaceTypesInsert)
But, after running the db thru Sql Workbench,
2 views are created for each Sqlserver view. The first (RaceTypes) matches the original Sqlserver view RaceTypes; the 2nd is a select from the 1st view, and is named RaceTypes_vw
The RaceTypesInsert trigger is created against the RaceTypes_vw view, not the RaceTypes view.
This causes all kinds of trouble with the app, which was written against the Sqlserver db, and knows nothing about views with the '_vw' suffix.
Our whole development effort revolves around the ability to develop against Sqlserver, run the db thru the Workbench conversion to Oracle, and run the app against Oracle.
Help!
Here's the text of the file that I don't know how to attach: it's the create scripts for tables, views, triggers:
SQLSERVER DATABASE OBJECTS
-- tables
-- TDBOBJECTS
CREATE TABLE [dbo].[tDbObjects](
[Id] [uniqueidentifier] ROWGUIDCOL NOT NULL,
[DisplayText] [varchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CreatedDate] [datetime] NULL,
[ModifiedDate] [datetime] NULL,
[EnteredBy] [uniqueidentifier] NULL,
[ModifiedBy] [uniqueidentifier] NULL,
[LegacyFlag] [numeric](1, 0) NULL,
PRIMARY KEY CLUSTERED
[Id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
-- TLOOKUPOBJECTS
CREATE TABLE [dbo].[tLookupObjects](
[Id] [uniqueidentifier] ROWGUIDCOL NOT NULL,
[DescriptionEn] [varchar](240) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DescriptionFr] [varchar](240) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[EffectiveDate] [datetime] NOT NULL,
[ExpiryDate] [datetime] NULL,
[CurrentFlag] [numeric](1, 0) NOT NULL,
PRIMARY KEY CLUSTERED
[Id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
-- TRACETYPES
CREATE TABLE [dbo].[tRaceTypes](
[Id] [uniqueidentifier] ROWGUIDCOL NOT NULL,
[Migration_RACE_CODE] [varchar](6) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
PRIMARY KEY CLUSTERED
[Id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
-- views
-- DBOBJECTS
CREATE VIEW [dbo].[DbObjects] ( [Id], [DisplayText], [CreatedDate], [ModifiedDate], [EnteredBy], [ModifiedBy], [LegacyFlag]) AS
SELECT tDbObjects.[Id], tDbObjects.[DisplayText], tDbObjects.[CreatedDate], tDbObjects.[ModifiedDate], tDbObjects.[EnteredBy], tDbObjects.[ModifiedBy], tDbObjects.[LegacyFlag]
FROM tDbObjects
-- LOOKUPOBJECTS
CREATE VIEW [dbo].[LookupObjects] ( [Id], [DisplayText], [CreatedDate], [ModifiedDate], [EnteredBy], [ModifiedBy], [LegacyFlag], [DescriptionEn], [DescriptionFr], [EffectiveDate], [ExpiryDate], [CurrentFlag]) AS
SELECT DbObjects.[Id], DbObjects.[DisplayText], DbObjects.[CreatedDate], DbObjects.[ModifiedDate], DbObjects.[EnteredBy], DbObjects.[ModifiedBy], DbObjects.[LegacyFlag], tLookupObjects.[DescriptionEn], tLookupObjects.[DescriptionFr], tLookupObjects.[EffectiveDate], tLookupObjects.[ExpiryDate], tLookupObjects.[CurrentFlag]
FROM tLookupObjects JOIN DbObjects ON tLookupObjects.Id = DbObjects.Id
-- RACETYPES
CREATE VIEW [dbo].[RaceTypes] ( [Id], [DisplayText], [CreatedDate], [ModifiedDate], [EnteredBy], [ModifiedBy], [LegacyFlag], [DescriptionEn], [DescriptionFr], [EffectiveDate], [ExpiryDate], [CurrentFlag], [Migration_RACE_CODE]) AS
SELECT LookupObjects.[Id], LookupObjects.[DisplayText], LookupObjects.[CreatedDate], LookupObjects.[ModifiedDate], LookupObjects.[EnteredBy], LookupObjects.[ModifiedBy], LookupObjects.[LegacyFlag], LookupObjects.[DescriptionEn], LookupObjects.[DescriptionFr], LookupObjects.[EffectiveDate], LookupObjects.[ExpiryDate], LookupObjects.[CurrentFlag], tRaceTypes.[Migration_RACE_CODE]
FROM tRaceTypes JOIN LookupObjects ON tRaceTypes.Id = LookupObjects.Id
-- TRIGGER ON RACETYPES
CREATE TRIGGER [RaceTypesInsert] ON [dbo].[RaceTypes] INSTEAD OF INSERT AS
IF NOT EXISTS(SELECT * FROM LookupObjects WHERE Id in (SELECT Id FROM Inserted )) INSERT INTO LookupObjects( [Id], [DisplayText], [CreatedDate], [ModifiedDate], [EnteredBy], [ModifiedBy], [LegacyFlag], [DescriptionEn], [DescriptionFr], [EffectiveDate], [ExpiryDate], [CurrentFlag])
SELECT [Id], [DisplayText], [CreatedDate], [ModifiedDate], [EnteredBy], [ModifiedBy], [LegacyFlag], [DescriptionEn], [DescriptionFr], [EffectiveDate], [ExpiryDate], [CurrentFlag]
FROM INSERTED
INSERT INTO tRaceTypes ([Id], [Migration_RACE_CODE])
SELECT [Id], [Migration_RACE_CODE]
FROM INSERTED
if exists( select * from DbClasses where DisplayText = 'RaceTypes') insert into tDbObjectDbClass( id, DbObject, DbClass) select newid(), Id, (select id from DbClasses where DisplayText = 'RaceTypes') from INSERTED
--------------- ORACLE DB, AFTER CONVERSION ---------------------
-- TABLES
-- TDBOBJECTS
CREATE TABLE "CP_D"."TDBOBJECTS"
( "ID" CHAR(36 CHAR) NOT NULL ENABLE,
"DISPLAYTEXT" VARCHAR2(200 CHAR) NOT NULL ENABLE,
"CREATEDDATE" DATE,
"MODIFIEDDATE" DATE,
"ENTEREDBY" CHAR(36 CHAR),
"MODIFIEDBY" CHAR(36 CHAR),
"LEGACYFLAG" NUMBER(1,0),
CONSTRAINT "PK_TDBOBJECTS_34C8D9D1" PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "CPD_DATA" ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "CPD_DATA" ;
-- TLOOKUPOBJECTS
CREATE TABLE "CP_D"."TLOOKUPOBJECTS"
( "ID" CHAR(36 CHAR) NOT NULL ENABLE,
"DESCRIPTIONEN" VARCHAR2(240 CHAR) NOT NULL ENABLE,
"DESCRIPTIONFR" VARCHAR2(240 CHAR) NOT NULL ENABLE,
"EFFECTIVEDATE" DATE NOT NULL ENABLE,
"EXPIRYDATE" DATE,
"CURRENTFLAG" NUMBER(1,0) NOT NULL ENABLE,
CONSTRAINT "PK_TLOOKUPOBJECTS_5AEE82B9" PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "CPD_DATA" ENABLE,
CONSTRAINT "FK_TLOOKUPOBJEC_ID_251C81ED" FOREIGN KEY ("ID")
REFERENCES "CP_D"."TDBOBJECTS" ("ID") ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "CPD_DATA" ;
-- TRACETYPES
CREATE TABLE "CP_D"."TRACETYPES"
( "ID" CHAR(36 CHAR) NOT NULL ENABLE,
"MIGRATION_RACE_CODE" VARCHAR2(6 CHAR),
CONSTRAINT "PK_TRACETYPES_1F98B2C1" PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "CPD_DATA" ENABLE,
CONSTRAINT "FK_TRACETYPES_ID_7073AF84" FOREIGN KEY ("ID")
REFERENCES "CP_D"."TLOOKUPOBJECTS" ("ID") ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "CPD_DATA" ;
-- VIEWS (only RACETYPES / RACETYPES_VW INCLUDED HERE)
-- RACETYPES
CREATE OR REPLACE FORCE VIEW "CP_D"."RACETYPES" ("ID", "DISPLAYTEXT", "CREATEDDATE", "MODIFIEDDATE", "ENTEREDBY", "MODIFIEDBY", "LEGACYFLAG", "DESCRIPTIONEN", "DESCRIPTIONFR", "EFFECTIVEDATE", "EXPIRYDATE", "CURRENTFLAG", "MIGRATION_RACE_CODE") AS
SELECT LookupObjects.Id,
LookupObjects.DisplayText,
LookupObjects.CreatedDate,
LookupObjects.ModifiedDate,
LookupObjects.EnteredBy,
LookupObjects.ModifiedBy,
LookupObjects.LegacyFlag,
LookupObjects.DescriptionEn,
LookupObjects.DescriptionFr,
LookupObjects.EffectiveDate,
LookupObjects.ExpiryDate,
LookupObjects.CurrentFlag,
tRaceTypes.Migration_RACE_CODE
FROM tRaceTypes
JOIN LookupObjects
ON tRaceTypes.Id = LookupObjects.Id;
-- RACETYPES_VW
CREATE OR REPLACE FORCE VIEW "CP_D"."RACETYPES_VW" ("ID", "DISPLAYTEXT", "CREATEDDATE", "MODIFIEDDATE", "ENTEREDBY", "MODIFIEDBY", "LEGACYFLAG", "DESCRIPTIONEN", "DESCRIPTIONFR", "EFFECTIVEDATE", "EXPIRYDATE", "CURRENTFLAG", "MIGRATION_RACE_CODE") AS
SELECT "ID","DISPLAYTEXT","CREATEDDATE","MODIFIEDDATE","ENTEREDBY","MODIFIEDBY","LEGACYFLAG","DESCRIPTIONEN","DESCRIPTIONFR","EFFECTIVEDATE","EXPIRYDATE","CURRENTFLAG","MIGRATION_RACE_CODE" FROM RaceTypes;
-- TRIGGERS
-- RACETYPESINSERT
CREATE OR REPLACE TRIGGER "CP_D"."RACETYPESINSERT"
INSTEAD OF INSERT
ON RaceTypes_vw
DECLARE
v_temp NUMBER(1, 0) := 0;
BEGIN
BEGIN
SELECT 1 INTO v_temp
FROM DUAL
WHERE NOT EXISTS ( SELECT *
FROM LookupObjects
WHERE Id IN ( SELECT :NEW.Id
FROM DUAL ) );
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
IF v_temp = 1 THEN
INSERT INTO LookupObjects
( Id, DisplayText, CreatedDate, ModifiedDate, EnteredBy, ModifiedBy, LegacyFlag, DescriptionEn, DescriptionFr, EffectiveDate, ExpiryDate, CurrentFlag )
VALUES ( :NEW.Id, :NEW.DisplayText, :NEW.CreatedDate, :NEW.ModifiedDate, :NEW.EnteredBy, :NEW.ModifiedBy, :NEW.LegacyFlag, :NEW.DescriptionEn, :NEW.DescriptionFr, :NEW.EffectiveDate, :NEW.ExpiryDate, :NEW.CurrentFlag );
END IF;
INSERT INTO tRaceTypes
( Id, Migration_RACE_CODE )
VALUES ( :NEW.Id, :NEW.Migration_RACE_CODE );
BEGIN
SELECT 1 INTO v_temp
FROM DUAL
WHERE EXISTS ( SELECT *
FROM DbClasses
WHERE DisplayText = 'RaceTypes' );
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
IF v_temp = 1 THEN
INSERT INTO tDbObjectDbClass
( id, DbObject, DbClass )
VALUES ( SYS_GUID(), :NEW.Id, ( SELECT id
FROM DbClasses
WHERE DisplayText = 'RaceTypes' ) );
END IF;
END;Can you tell me more info? Why are 2 views generated? Is the '_vw' view is generated because of the Instead Of trigger? (It looks like it -- it's part of the ddl file that generates the trigger)
Manual mods aren't really a viable workaround -- we have over 100 views, plus delete and update triggers, which also suffer from this problem. -
Access the nodes data in a table view (generated by aet).
Hi all ,
I have created a table view in bp overview page.
so it has created new component /ztable/zbol entity .
Now how can i access the nodes of BP page..in the new component created?.thanks vishal ,
but as per the thread,when we create table view using aet ,
Table view in EHP1 CRM 7.0
You dont need to worry about the component usage nor you need to create or handle anything like that for AET compoent for table extension. SAP has a special way to handle it in WD_USAGE_INITIALIZE of component controller for AET extension generated component so its nothing for us to do about it. Thanks to SAP
so still i need to redefine..or can directly access the nodes in do_prepare_output.? -
Issue with Maintenence View generated using SE54
Hello all,
We generated a view V_T16FC with the tables T16FC
T16FD
T16FG
when we try to see the data in the view , it is saying no data in the view , though the data is ther in all the three tables .
I checked foreign key relations they are fine .
can any please provide what could be the problem .
Helpful answers will be rewarded.
Urgent !!!!Check the below link.
[http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ecec446011d189700000e8322d00/content.htm|http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ecec446011d189700000e8322d00/content.htm]
Hope it helps.
Thanks,
Balaji -
Not able to View generated SQL statement
Hi,
In order to view the generated SQL statement in Receiver JDBC Adapter,
i have done logSQLStatement as true in CC still not able to view in RWB,
also mesg protocol i m using in CC is "xml sql format", is it bcos of this i am not able to ?
If yes, then how can i see that sql string?
Regards,
PratibhaPratibha,
In our JDBC scenario the message protocol is also set to XML SQL Format
The Integration Process has a mapping step of type XSL that uses an Imported Archive to create the SQL select statement. Then there is a synchronous Send step for the JDBC component
Both this SQL statement and the returned SQL result are available in the XML message monitor SXMB_MONI
Regards,
Mike -
How to view generated pdf file
hi ,
I have generate d pdf file from jasper & i store it on cdrive. but i don't how to view it from program.
i had given
JasperExportManager.exportReportToPdfFile(jasperPrint, "c:\\rpt_Invoice.pdf");
JasperManager.printReportToPdfFile(jasperPrint, "BasicReport.pdf");
JasperViewer.viewReport(jasperPrint);
this code. it generate pdf file & viw jasper , but is there any method to view pdf file .
ThanksSearch forums?
Search jasper API?
Google java pdf viewer?
org.jdesktop.jdic.desktop.Desktop.open(java.io.File)? -
How to view/generate resource utilization report
hi
I have used 3 resources in project , and wanted to know how to generate report of overall individual project utilization.
we don't use any project server here.
Thanks
RagavHi,
Do you use Project 2010 or 2013?
Both versions propose
visual reports with a "resource work summary report" Excel template.
Otherwise if you do not need to export the data in Excel but only to vizualize the data, the resource usage view is an excellent way to see the resources utilization on a project.
Hope this helps,
Guillaume Rouyre, MBA, MVP, MCP | -
View Generated workset for a Collaboration Room
I am aware that a workset gets created under a folder with a unique id for each collaboration room that is created.
How can I view this workset and the iViews that are created on it?
Example: In this folder is a workset.
pcd:portal_content/com.sap.ip.collaboration/Rooms/b004fe38-9621-2a10-2fb9-ac627d60092a/workset
How can I view it's contents?You are correct about the browse into function for normal worksets and pages and iViews.
However, this doesn't work for the worksets generated for collaboration rooms.
Thank you for your input.
Maybe you are looking for
-
Problem in Report selection screen
Hi friends, I have a requirement to change the selection screen dynamically . My actual requirement is, i have there radio buttons in the selection screen , based on the click of the radio button the input blocks should get changed. I am able to achi
-
State of usb2 audio class compliance?
this isn't exactly archlinux specific but does anybody know the state of linux usb2 audio class compliance? I've understood that there was no audio specification for usb2 for quite some time and that made a big mess in the audio community. There is n
-
DB13 jobs doesn't work anymore
Hi all, we have the folowing problem : our D01(it is an ERP-system) was separate installed on two different servers (application server (was srv056) and database(srd455) were separate installed). Three weeks ago we have moved them both(the applicatio
-
Tcodes for Sales order confirmation, Adv shipping notification, del note?
i wanna know where do we create sales docs like shipping notification, delivery schedule, invoice or billing document, po confirmation , sales order confirmation etc etc. which are not the regular sales documents like the sales ord
-
By misstake the trans on /usr/sap was deleted. How to regenrate that?
By misstake the trans on /usr/sap was deleted. Does anyone knows how to regenerate the content of that directory(and subdirectories) We do not hawe a backup as this is an old test system