Help with universe with multiple related tables/loops

Post Author: bradwist
CA Forum: Semantic Layer and Data Connectivity
Hi. I am relatively new to Business Objects and have been putting together some universes for our use. Most things I can accomplish well enough. However, I've run into an issue that I think fits within this topic. I've got several related tables and I'm looking for the best way to construct the universe to support our queries. The best way to describe them is to say that the database has a table of Person records, and a table of Relationships. One Person may be related to another Person in a number of ways (sibling, spouse, parent, etc). This can be pictured as Person   Relationship     ID -
< PersonID        -
< RelatedPersonID or Person1 -< Relationship >- Person2 where Person1 and Person2 really both point to the same physical table. I believe these tend to lend themselves to Aliases. However, each Person table really has a number of subordinate records in tables (addresses, phone numbers, etc). Address1 >--- Person1 -< Relationship >- Person2 ---< Address2 While this can be done (and I've done so), it's difficult to explain to some analysts why this construct is needed in the universe in order to answer a question like: Give me all of Bob's Siblings, their ages, and their addresses. This is a simplification, as our structures actually include other types of Entities (Person, Business, Government, Organizations), all of which can be related to one another. Is there a way that BO Universes will support this structure? Thanks.

exp system/manager file=exp.dmp log=exp.log full=y at the source database.
imp system/manager file=exp.dmp log=imp_show.log full=y show=y - create the log file without importing the data
edit the imp_show.log and extract the statements that are needed to re-create users,roles,alter user and grants.
Pre-create the tablespaces using SQL*Plus in the target database.
execute the modified imp_show.log(All DDl's)
imp system/manager file=exp.dmp log=imp.log fromuser=A touser=B
Re-compile all the Invalid Objects.
HTH
-Anantha

Similar Messages

  • Create XML (using DTD) from multiple relation tables

    Hello and thank you in advanced.
    I'm trying to create an XML document, based on a specific DTD, by selecting information from multiple tables in the database.
    Is there a tool (in XDK maybe?) that will allow me to map my relational tables to a specific DTD?
    I could build the XML manually, but I was hoping that Oracle has already solved this problem with an automated tool.
    Thanks again,
    Sean Cloutier

    Is that the same thing as me writing an XSQL document which contains all of my queries (or views).
    In other words, do I have to map everything by hand or is there a tool to do that for me?
    thanks again,
    Sean
    null

  • Help with constraints on object relational tables

    Hi
    I am looking to create an object relational database with a check constraint on the relationships. For example:
    * I have table called person_tab which is a table of person_t type.
    * Person_t type is inherited by the manager_t type and the applicant_t type.
    * I have a second table called interview_tab of interview_t type.
    * The interview table has two columns (manager and appilcant) that are scope restrained to the person table.
    * I would also like to put check constraints on these columns to say:
    ----- Manager: check the person_number is less than 20000
    ----- Applicant: check the person_number is greater than 19999
    Can anyone tell me if this is possible and if so how can it be done?
    Thanks in advance
    Stephen

    You have circular dependencies (manager_t depends upon interview_list_t depends upon interview_t depends upon manager_t) which I don't think is a good idea. But then that's probably just my old-fashioned relational head baulking at this new-fangled OO way of looking at data models. However, my experience with using types and subtypes in Oracle does teach me that this is a complete pain in the neck, because it makes changing your Type definitions a very awkward process.
    am I right in saying I cannot use the check constraint?I think so. If the value range for ID is a property of being a Manager or an Applicant then properly that should be enforced by those types not by the Interview type. Then all that Interviews needs to worry about is that it gets instantiated with attributes of the correct Type.
    I've simplified your model a bit. To start with I'm going to create a single PERSONS table to store both managers and applicants...
    SQL> CREATE TYPE person_t AS OBJECT (
      2  personno NUMBER,
      3  surname VARCHAR2(30),
      4  forename VARCHAR2(30),
      5  dob DATE
      6  ) NOT FINAL;
      7  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE applicant_t UNDER person_t
      2  (qualifications varchar2(200))
      3  FINAL ;
      4  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE manager_t UNDER person_t
      2  (extension varchar2(5)) FINAL;
      3  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE interview_t AS OBJECT (
      2  interviewno NUMBER,
      3  idate DATE,
      4  itime NUMBER,
      5  interest NUMBER,
      6  is_made_by REF manager_t,
      7  attended_by REF applicant_t
      8  ) ;
      9  /
    Type created.
    SQL>
    SQL>
    SQL> CREATE TABLE persons OF person_t
      2  /
    Table created.
    SQL> CREATE TABLE interviews OF interview_t
      2  /
    Table created.
    SQL> Okay let's create some objects...
    SQL> declare
      2     mgr manager_t := manager_t(1,'RUNCITER', 'GLEN', sysdate - (42*365), 'x1234');
      3     app applicant_t := applicant_t(2,  'CHIP', 'JOE', sysdate - (38*365), 'BSc, MSc');
      4     intv interview_t;
      5     m_ref REF  person_t;
      6     a_ref REF person_t;
      7  begin
      8     INSERT INTO persons p VALUES mgr
      9         RETURNING REF(p) INTO m_ref   ;
    10     INSERT INTO persons p VALUES app
    11         RETURNING REF(p) INTO a_ref   ;
    12     insert into interviews
    13     values (interview_t(1001, sysdate, 45, 5, TREAT(m_ref AS REF manager_t)
            , TREAT(a_ref AS REF applicant_t)));
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    SQL> SELECT i.interviewno, i.is_made_by.surname, i.attended_by.surname
      2  FROM interviews i
      3  /
    INTERVIEWNO IS_MADE_BY.SURNAME             ATTENDED_BY.SURNAME                 
           1001 RUNCITER                       CHIP                                
    SQL> Have we got integrity?
    SQL> rollback
      2  /
    Rollback complete.
    SQL>
    SQL> declare
      2     mgr manager_t := manager_t(1,'RUNCITER', 'GLEN', sysdate - (42*365), 'x1234');
      3     app applicant_t := applicant_t(2,  'CHIP', 'JOE', sysdate - (38*365), 'BSc, MSc');
      4     intv interview_t;
      5     m_ref REF  person_t;
      6     a_ref REF person_t;
      7  begin
      8     INSERT INTO persons p VALUES mgr
      9         RETURNING REF(p) INTO m_ref   ;
    10     INSERT INTO persons p VALUES app
    11         RETURNING REF(p) INTO a_ref   ;
    12     insert into interviews
    13     values (interview_t(1001, sysdate, 45, 5, TREAT(a_ref AS REF manager_t)
             , TREAT(m_ref AS REF applicant_t)));
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> SELECT i.interviewno, i.is_made_by.surname, i.attended_by.surname
      2  FROM interviews i
      3  /
    INTERVIEWNO IS_MADE_BY.SURNAME             ATTENDED_BY.SURNAME                 
           1001                                                                    
    SQL> Kind of, but it's not very satisfactory. Let's use separate tables for MANAGERS and APPLICANTS...
    SQL> rollback
      2  /
    Rollback complete.
    SQL>
    SQL> CREATE TABLE managers OF manager_t
      2  /
    Table created.
    SQL>
    SQL> CREATE TABLE applicants OF applicant_t
      2  /
    Table created.
    SQL> declare
      2     mgr manager_t := manager_t(1,'RUNCITER', 'GLEN', sysdate - (42*365), 'x1234');
      3     app applicant_t := applicant_t(2,  'CHIP', 'JOE', sysdate - (38*365), 'BSc, MSc');
      4     intv interview_t;
      5     m_ref REF  manager_t;
      6     a_ref REF applicant_t;
      7  begin
      8     INSERT INTO managers m VALUES mgr
      9         RETURNING REF(m) INTO m_ref   ;
    10     INSERT INTO applicants a VALUES app
    11         RETURNING REF(a) INTO a_ref   ;
    12     insert into interviews values (interview_t(1001, sysdate, 45, 5, m_ref, a_ref));
    13 
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> SELECT i.interviewno, i.is_made_by.surname, i.attended_by.surname
      2  FROM interviews i
      3  /
    INTERVIEWNO IS_MADE_BY.SURNAME             ATTENDED_BY.SURNAME                 
           1001 RUNCITER                       CHIP                                
    SQL> rollback
      2  /
    Rollback complete.
    SQL> declare
      2     mgr manager_t := manager_t(1,'RUNCITER', 'GLEN', sysdate - (42*365), 'x1234');
      3     app applicant_t := applicant_t(2,  'CHIP', 'JOE', sysdate - (38*365), 'BSc, MSc');
      4     intv interview_t;
      5     m_ref REF  manager_t;
      6     a_ref REF applicant_t;
      7  begin
      8     INSERT INTO managers m VALUES mgr
      9         RETURNING REF(m) INTO m_ref   ;
    10     INSERT INTO applicants a VALUES app
    11         RETURNING REF(a) INTO a_ref   ;
    12     insert into interviews values (interview_t(1001, sysdate, 45, 5, a_ref, m_ref));
    13 
    14  end;
    15  /
       insert into interviews values (interview_t(1001, sysdate, 45, 5, a_ref, m_ref));
    ERROR at line 12:
    ORA-06550: line 12, column 69:
    PL/SQL: ORA-00932: inconsistent datatypes: expected REF APC.APPLICANT_T got REF
    APC.MANAGER_T
    ORA-06550: line 12, column 4:
    PL/SQL: SQL Statement ignored
    SQL>I hope that's useful to you.
    Cheers, APC
    Layout of SQL*Plus session tweaked for readability
    Message was edited by:
    APC

  • Storing datagrams in multiple related tables using XSU

    Hi,
    I'm trying to store an xml document into multiple tables. I have Steve's book and it doesn't seem to provide the solution I need for my problem.
    My schema is something like this:
    <DATA>
    <PERSON> (1 or many elements)
    <PERSON_ID></PERSON_ID>
    <PERSON_NAME></PERSON_NAME>
    <STUDY> (1 or many elements)
    <STUDY_ID></STUDY_ID>
    <STUDY_NAME></STUDY_NAME>
    <SERIES> (1 or many elements)
    <SERIES_ID></SERIES_ID>
    <SERIES_NAME></SERIES_NAME>
    <IMAGE> (1 or many elements)
    <IMAGE_ID></IMAGE_ID>
    <IMAGE_NAME></IMAGE_NAME>
    </IMAGE>
    </SERIES>
    </STUDY>
    </PERSON>
    </DATA>
    And I want to insert in multiple tables such as PERSON, STUDY, SERIES, IMAGE.
    Each of these tables has a foreign key (SID) (from the parent table so that, e.g. for a certain IMAGE you know what SERIES belongs to, and so on.) that is generated by a sequence.
    The problem is how to insert the correct foreign key (SID) into the multiple tables, that is, if I generate a SID for PERSON how do I get that value and insert it into STUDY as a foreign key. That supposing I use INSTEAD OF triggers to check for the uniqueness and generate the sequence.
    Steve's book does not provide any solution for that in the chapter 14 with XMLloader. And the problem in chapter 12 is not the same I propose here (that is very similar to the one in chapter 14).
    Thanks.
    - Jose Angel -
    null

    Thanks,
    your solution is good only assuming that all the values are new, but then if you are doing an update the value sequencename.CURRVAL does not correspond with the idprimary.
    Unfortunately my triggers do the checking to see if an insert or an upgrade is needed and then act consequently.
    Anyway, I think I have a solution and it's using store procedures that will be called by the triggers (instead of doing the operations in the trigger) and will be part of a package so they'll be able to share some kind of global variables (for the package) that will be active as far as the session lasts.
    Thanks for your help though.
    - Jose angel -
    null

  • Sliding window for historical data purge in multiple related tables

    All,
    It is a well known question of how to efficiently BACKUP and PURGE historical data based on a sliding window.
    I have a group of tables, they all have to be backed up and purged based on a sliding time window. These tables have FKs related to each other and these FKs are not necessary the timestamp column. I am considering using partition based on the timestamp column for all these tables, so i can export those out of date partitions and then drop them. The price I have to pay by this design is that timestamp column is actually duplicated many times among parent table, child tables, grand-child tables although the value is the same, but I have to do the partition based on this column in all tables.
    It's very much alike the statspack tables, one stats$snapshot and many child tables to store actual statistic data. I am just wondering how statspack.purge does this, since using DELETE statement is very inefficient and time consuming. In statspack tables, snap_time is only stored in stats$snapshot table, not everywhere in it's child table, and they are not partitioned. I guess the procedure is using DELETE statement.
    Any thought on other good design options? Or how would you optimize statspack tables historical data backup and purge? Thanks!

    hey oracle gurus, any thoughts?

  • Mix object tables with relational tables?

    Hallo,
    is it possible to mix object tables with relational tables in one database?
    I didn't succeed in assigning a foreign key from a relational table to an object table.
    Is this only working with column objects in relational tables?

    Hi
    is it possible to mix object tables with relational tables in one database?
    Every database contains both types of tables. So, it is basically not a problem.
    I didn't succeed in assigning a foreign key from a relational table to an object table.
    Is this only working with column objects in relational tables?It would be interesting to know how you tried... e.g. what error you get... Here an example (executed on 11.1).
    SQL> create or replace type tt as object ( n number );
      2  /
    SQL> create table ot of tt (constraint ot_pk primary key (n));
    SQL> create table rt (n number, constraint rt_ot_fk foreign key (n) references ot (n));
    SQL> insert into ot values (tt(1));
    SQL> insert into rt values (1);
    SQL> insert into rt values (2);
    insert into rt values (2)
    ERROR at line 1:
    ORA-02291: integrity constraint (OPS$CHA.RT_OT_FK) violated - parent key not foundHTH
    Chris

  • Are there any (dis)advantages in building a universe on fully normalized tables instead of building dimensional model/tables and then universe on top of them?

    Hello,
    I’m hoping someone can help me with understanding advantages and disadvantages if we want to build a universe on top of a fully normalized tables, compared to using a dimensional model with star schemas.
    I’ve read some discussions here that say that it is possible to create a universe on top of normalized tables. Then, can we avoid building of dimensional tables (a data mart), and just use normalized tables? I would say that it is easier to use star schema dimensions and facts tables to build a universe, but our end users might ask “why do we have to go through building a dimensional data mart, if we can have same reports with hierarchies and drill-down functionality based on a universe built on top of our already existing normalized tables?”
    Can you point me to some established best practices regarding using normalized tables to build a universe? Any documents with some examples for this?
    Any expected difficulties during design/development phase of our universe, related to using normalized tables?
    Any expected performance degradation if we use normalized tables compared to using dimensional tables?
    Can I build universe more easily if I transform (modify) our normalized model (by using alias tables and views) to look like snowflake model?
    I’m using BOE XI 3.1, tables are in Oracle 11.2.
    Thank you

    Few Disadvantages that I usually face when building universe on Normalized tables,
    1. Performance - Read operations have to suffer because indexing strategies do not go well with table joins
    2. Derived Tables - Due to complex Queries/ Logic, most of the time, end-up creating derived tables, which doesn't use back-end table indexes and slows down the report runtime.
    3. Normalized table/ Transaction tables may not always have proper cardinality and often results in Cartesian products
    4. Normalized tables may not have tight referential integrity and may have to join more than one column and join on varchar, etc whereas, good Dimensional model datawarehouse will have proper keys/ integer joins and not always necessary to join on multiple fields
    5. Often deal with Fan and Chasm Traps
    6. Dealing with Database fields with nulls, blanks, date in numeric format, etc.,
    7. No Facts, Dimensions separated and most of the time they are in same table
    and More...
    If performance is not a matter and building Datawarehouse is a big deal, then I will start building Universe on normalized tables by having the database diagram as reference for Joins, contexts, etc
    Note: After dealing with universes based on normalized tables for few years (by creating views, complex sql queries data loading to tables and unv on these tables, derived tables), I ended up creating star-schema dimensional model (couple of months extra ETL work), users/ developers felt lot better when they have to create standard/ ad-hoc reports and they are super fast compared to previous universes.

  • Add relational table in my essbase business model

    Hi experts,
    I have an essbase multidimensional datasource. One of dimensions of this source is Entity.
    Entity has some hierarchies (Gen1, Gen2, Gen3, Gen4, Gen5)
    Each generation has ID and description.
    My requirement is to change description of Gen4 with description (DescGen4) of relational table.
    So, my relational table has IDGen4, DescGen4.
    I think that I have a join with IDGen4 (essbase dimension) with IDGen4 with relational table. I have done an I can see new description in my presentation layer in answers but my problem is when I want to see measure. If DescGen4 is in answers columns I can't see data....
    Any help??
    Thanks!!

    Hi Alex,
    When you take measures with dimensions,you need to set the level of the dimesnions to detail so taht when tat measure is picked up the data would show in accordance.
    http://www.rittmanmead.com/2007/11/essbase-integration-with-obiee-101331/
    Regards,
    Kranthi.

  • Approach to parse large number of XML files into the relational table.

    We are exploring the option of XML DB for processing a large number of files coming same day.
    The objective is to parse the XML file and store in multiple relational tables. Once in relational table we do not care about the XML file.
    The file can not be stored on the file server and need to be stored in a table before parsing due to security issues. A third party system will send the file and will store it in the XML DB.
    File size can be between 1MB to 50MB and high performance is very much expected other wise the solution will be tossed.
    Although we do not have XSD, the XML file is well structured. We are on 11g Release 2.
    Based on the reading this is what my approach.
    1. CREATE TABLE XML_DATA
    (xml_col XMLTYPE)
    XMLTYPE xml_col STORE AS SECUREFILE BINARY XML;
    2. Third party will store the data in XML_DATA table.
    3. Create XMLINDEX on the unique XML element
    4. Create views on XMLTYPE
    CREATE OR REPLACE FORCE VIEW V_XML_DATA(
       Stype,
       Mtype,
       MNAME,
       OIDT
    AS
       SELECT x."Stype",
              x."Mtype",
              x."Mname",
              x."OIDT"
       FROM   data_table t,
              XMLTABLE (
                 '/SectionMain'
                 PASSING t.data
                 COLUMNS Stype VARCHAR2 (30) PATH 'Stype',
                         Mtype VARCHAR2 (3) PATH 'Mtype',
                         MNAME VARCHAR2 (30) PATH 'MNAME',
                         OIDT VARCHAR2 (30) PATH 'OID') x;
    5. Bulk load the parse data in the staging table based on the index column.
    Please comment on the above approach any suggestion that can improve the performance.
    Thanks
    AnuragT

    Thanks for your response. It givies more confidence.
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    Example XML
    <SectionMain>
    <SectionState>Closed</SectionState>
    <FunctionalState>CP FINISHED</FunctionalState>
    <CreatedTime>2012-08</CreatedTime>
    <Number>106</Number>
    <SectionType>Reel</SectionType>
    <MachineType>CP</MachineType>
    <MachineName>CP_225</MachineName>
    <OID>99dd48cf-fd1b-46cf-9983-0026c04963d2</OID>
    </SectionMain>
    <SectionEvent>
    <SectionOID>99dd48cf-2</SectionOID>
    <EventName>CP.CP_225.Shredder</EventName>
    <OID>b3dd48cf-532d-4126-92d2</OID>
    </SectionEvent>
    <SectionAddData>
    <SectionOID>99dd48cf2</SectionOID>
    <AttributeName>ReelVersion</AttributeName>
    <AttributeValue>4</AttributeValue>
    <OID>b3dd48cf</OID>
    </SectionAddData>
    - <SectionAddData>
    <SectionOID>99dd48cf-fd1b-46cf-9983</SectionOID>
    <AttributeName>ReelNr</AttributeName>
    <AttributeValue>38</AttributeValue>
    <OID>b3dd48cf</OID>
    <BNCounter>
    <SectionID>99dd48cf-fd1b-46cf-9983-0026c04963d2</SectionID>
    <Run>CPFirstRun</Run>
    <SortingClass>84</SortingClass>
    <OutputStacker>D2</OutputStacker>
    <BNCounter>54605</BNCounter>
    </BNCounter>
    I was not aware of Virtual column but looks like we can use it and avoid creating views by just inserting directly into
    the staging table using virtual column.
    Suppose OID id is the unique identifier of each XML FILE and I created virtual column
    CREATE TABLE po_Virtual OF XMLTYPE
    XMLTYPE STORE AS BINARY XML
    VIRTUAL COLUMNS
    (OID_1 AS (XMLCAST(XMLQUERY('/SectionMain/OID'
    PASSING OBJECT_VALUE RETURNING CONTENT)
    AS VARCHAR2(30))));
    1. My question is how then I will write this query by NOT USING COLMUN XML_COL
    SELECT x."SECTIONTYPE",
    x."MACHINETYPE",
    x."MACHINENAME",
    x."OIDT"
    FROM po_Virtual t,
    XMLTABLE (
    '/SectionMain'
    PASSING t.xml_col                          <--WHAT WILL PASSING HERE SINCE NO XML_COL
    COLUMNS SectionType VARCHAR2 (30) PATH 'SectionType',
    MachineType VARCHAR2 (3) PATH 'MachineType',
    MachineName VARCHAR2 (30) PATH 'MachineName',
    OIDT VARCHAR2 (30) PATH 'OID') x;
    2. Insetead of creating the view then Can I do
    insert into STAGING_table_yyy ( col1 ,col2,col3,col4,
    SELECT x."SECTIONTYPE",
    x."MACHINETYPE",
    x."MACHINENAME",
    x."OIDT"
    FROM xml_data t,
    XMLTABLE (
    '/SectionMain'
    PASSING t.xml_col                         <--WHAT WILL PASSING HERE SINCE NO XML_COL
    COLUMNS SectionType VARCHAR2 (30) PATH 'SectionType',
    MachineType VARCHAR2 (3) PATH 'MachineType',
    MachineName VARCHAR2 (30) PATH 'MachineName',
    OIDT VARCHAR2 (30) PATH 'OID') x
    where oid_1 = '99dd48cf-fd1b-46cf-9983';<--VIRTUAL COLUMN
    insert into STAGING_table_yyy ( col1 ,col2,col3
    SELECT x."SectionOID",
    x."EventName",
    x."OIDT"
    FROM xml_data t,
    XMLTABLE (
    '/SectionMain'
    PASSING t.xml_col                         <--WHAT WILL PASSING HERE SINCE NO XML_COL
    COLUMNS SectionOID PATH 'SectionOID',
    EventName VARCHAR2 (30) PATH 'EventName',
    OID VARCHAR2 (30) PATH 'OID',
    ) x
    where oid_1 = '99dd48cf-fd1b-46cf-9983';<--VIRTUAL COLUMN
    Same insert for other tables usind the OID_1 virtual coulmn
    3. Finaly Once done how can I delete the XML document from XML.
    If I am using virtual column then I beleive it will be easy
    DELETE table po_Virtual where oid_1 = '99dd48cf-fd1b-46cf-9983';
    But in case we can not use the Virtual column how we can delete the data
    Thanks in advance
    AnuragT

  • Need to increase performance-bulk collect in cursor with limit and in the for loop inserting into the trigger table

    Hi all,
    I have a performance issue in the below code,where i am trying to insert the data from table_stg into target_tab and in parent_tab tables and then to child tables via cursor with bulk collect .the target_tab and parent_tab are huge tables and have a row wise trigger enabled on it .the trigger is mandatory . This timetaken for this block to execute is 5000 seconds.Now my requirement is to reduce it to 5 to 10 mins.
    can someone please guide me here.Its bit urgent .Awaiting for your response.
    declare
    vmax_Value NUMBER(5);
      vcnt number(10);
      id_val number(20);
      pc_id number(15);
      vtable_nm VARCHAR2(100);
      vstep_no  VARCHAR2(10);
      vsql_code VARCHAR2(10);
      vsql_errm varchar2(200);
      vtarget_starttime timestamp;
      limit_in number :=10000;
      idx           number(10);
              cursor stg_cursor is
             select
                   DESCRIPTION,
                   SORT_CODE,
                   ACCOUNT_NUMBER,
                     to_number(to_char(CORRESPONDENCE_DATE,'DD')) crr_day,
                     to_char(CORRESPONDENCE_DATE,'MONTH') crr_month,
                     to_number(substr(to_char(CORRESPONDENCE_DATE,'DD-MON-YYYY'),8,4)) crr_year,
                   PARTY_ID,
                   GUID,
                   PAPERLESS_REF_IND,
                   PRODUCT_TYPE,
                   PRODUCT_BRAND,
                   PRODUCT_HELD_ID,
                   NOTIFICATION_PREF,
                   UNREAD_CORRES_PERIOD,
                   EMAIL_ID,
                   MOBILE_NUMBER,
                   TITLE,
                   SURNAME,
                   POSTCODE,
                   EVENT_TYPE,
                   PRIORITY_IND,
                   SUBJECT,
                   EXT_PRD_ID_TX,
                   EXT_PRD_HLD_ID_TX,
                   EXT_SYS_ID,
                   EXT_PTY_ID_TX,
                   ACCOUNT_TYPE_CD,
                   COM_PFR_TYP_TX,
                   COM_PFR_OPT_TX,
                   COM_PFR_RSN_CD
             from  table_stg;
    type rec_type is table of stg_rec_type index by pls_integer;
    v_rt_all_cols rec_type;
    BEGIN
      vstep_no   := '0';
      vmax_value := 0;
      vtarget_starttime := systimestamp;
      id_val    := 0;
      pc_id     := 0;
      success_flag := 0;
              vstep_no  := '1';
              vtable_nm := 'before cursor';
        OPEN stg_cursor;
              vstep_no  := '2';
              vtable_nm := 'After cursor';
       LOOP
              vstep_no  := '3';
              vtable_nm := 'before fetch';
    --loop
        FETCH stg_cursor BULK COLLECT INTO v_rt_all_cols LIMIT limit_in;
                  vstep_no  := '4';
                  vtable_nm := 'after fetch';
    --EXIT WHEN v_rt_all_cols.COUNT = 0;
        EXIT WHEN stg_cursor%NOTFOUND;
    FOR i IN 1 .. v_rt_all_cols.COUNT
      LOOP
       dbms_output.put_line(upper(v_rt_all_cols(i).event_type));
        if (upper(v_rt_all_cols(i).event_type) = upper('System_enforced')) then
                  vstep_no  := '4.1';
                  vtable_nm := 'before seq sel';
              select PC_SEQ.nextval into pc_id from dual;
                  vstep_no  := '4.2';
                  vtable_nm := 'before insert corres';
              INSERT INTO target1_tab
                           (ID,
                            PARTY_ID,
                            PRODUCT_BRAND,
                            SORT_CODE,
                            ACCOUNT_NUMBER,
                            EXT_PRD_ID_TX,         
                            EXT_PRD_HLD_ID_TX,
                            EXT_SYS_ID,
                            EXT_PTY_ID_TX,
                            ACCOUNT_TYPE_CD,
                            COM_PFR_TYP_TX,
                            COM_PFR_OPT_TX,
                            COM_PFR_RSN_CD,
                            status)
             VALUES
                            (pc_id,
                             v_rt_all_cols(i).party_id,
                             decode(v_rt_all_cols(i).product_brand,'LTB',2,'HLX',1,'HAL',1,'BOS',3,'VER',4,0),
                             v_rt_all_cols(i).sort_code,
                             'XXXX'||substr(trim(v_rt_all_cols(i).ACCOUNT_NUMBER),length(trim(v_rt_all_cols(i).ACCOUNT_NUMBER))-3,4),
                             v_rt_all_cols(i).EXT_PRD_ID_TX,
                             v_rt_all_cols(i).EXT_PRD_HLD_ID_TX,
                             v_rt_all_cols(i).EXT_SYS_ID,
                             v_rt_all_cols(i).EXT_PTY_ID_TX,
                             v_rt_all_cols(i).ACCOUNT_TYPE_CD,
                             v_rt_all_cols(i).COM_PFR_TYP_TX,
                             v_rt_all_cols(i).COM_PFR_OPT_TX,
                             v_rt_all_cols(i).COM_PFR_RSN_CD,
                             NULL);
                  vstep_no  := '4.3';
                  vtable_nm := 'after insert corres';
        else
              select COM_SEQ.nextval into id_val from dual;
                  vstep_no  := '6';
                  vtable_nm := 'before insertcomm';
          if (upper(v_rt_all_cols(i).event_type) = upper('REMINDER')) then
                vstep_no  := '6.01';
                  vtable_nm := 'after if insertcomm';
              insert into parent_tab
                 (ID ,
                 CTEM_CODE,
                 CHA_CODE,            
                 CT_CODE,                           
                 CONTACT_POINT_ID,             
                 SOURCE,
                 RECEIVED_DATE,                             
                 SEND_DATE,
                 RETRY_COUNT)
              values
                 (id_val,
                  lower(v_rt_all_cols(i).event_type), 
                  decode(v_rt_all_cols(i).product_brand,'LTB',2,'HLX',1,'HAL',1,'BOS',3,'VER',4,0),
                  'Email',
                  v_rt_all_cols(i).email_id,
                  'IADAREMINDER',
                  systimestamp,
                  systimestamp,
                  0);  
         else
                vstep_no  := '6.02';
                  vtable_nm := 'after else insertcomm';
              insert into parent_tab
                 (ID ,
                 CTEM_CODE,
                 CHA_CODE,            
                 CT_CODE,                           
                 CONTACT_POINT_ID,             
                 SOURCE,
                 RECEIVED_DATE,                             
                 SEND_DATE,
                 RETRY_COUNT)
              values
                 (id_val,
                  lower(v_rt_all_cols(i).event_type), 
                  decode(v_rt_all_cols(i).product_brand,'LTB',2,'HLX',1,'HAL',1,'BOS',3,'VER',4,0),
                  'Email',
                  v_rt_all_cols(i).email_id,
                  'CORRESPONDENCE',
                  systimestamp,
                  systimestamp,
                  0); 
            END if; 
                  vstep_no  := '6.11';
                  vtable_nm := 'before chop';
             if (v_rt_all_cols(i).ACCOUNT_NUMBER is not null) then 
                      v_rt_all_cols(i).ACCOUNT_NUMBER := 'XXXX'||substr(trim(v_rt_all_cols(i).ACCOUNT_NUMBER),length(trim(v_rt_all_cols(i).ACCOUNT_NUMBER))-3,4);
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)
              values
                (id_val,
                 'IB.Correspondence.AccountNumberMasked',
                 v_rt_all_cols(i).ACCOUNT_NUMBER);
             end if;
                  vstep_no  := '6.1';
                  vtable_nm := 'before stateday';
             if (v_rt_all_cols(i).crr_day is not null) then 
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)
              values
                (id_val,
                 --'IB.Correspondence.Date.Day',
                 'IB.Crsp.Date.Day',
                 v_rt_all_cols(i).crr_day);
             end if;
                  vstep_no  := '6.2';
                  vtable_nm := 'before statemth';
             if (v_rt_all_cols(i).crr_month is not null) then 
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)
              values
                (id_val,
                 --'IB.Correspondence.Date.Month',
                 'IB.Crsp.Date.Month',
                 v_rt_all_cols(i).crr_month);
             end if;
                  vstep_no  := '6.3';
                  vtable_nm := 'before stateyear';
             if (v_rt_all_cols(i).crr_year is not null) then 
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)
              values
                (id_val,
                 --'IB.Correspondence.Date.Year',
                 'IB.Crsp.Date.Year',
                 v_rt_all_cols(i).crr_year);
             end if;
                  vstep_no  := '7';
                  vtable_nm := 'before type';
               if (v_rt_all_cols(i).product_type is not null) then
                  insert into child_tab
                     (COM_ID,                                            
                     KEY,                                                                                                                                        
                     VALUE)
                  values
                    (id_val,
                     'IB.Product.ProductName',
                   v_rt_all_cols(i).product_type);
                end if;
                  vstep_no  := '9';
                  vtable_nm := 'before title';         
              if (trim(v_rt_all_cols(i).title) is not null) then
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE )
              values
                (id_val,
                 'IB.Customer.Title',
                 trim(v_rt_all_cols(i).title));
              end if;
                  vstep_no  := '10';
                  vtable_nm := 'before surname';
              if (v_rt_all_cols(i).surname is not null) then
                insert into child_tab
                   (COM_ID,                                            
                   KEY,                                                                                                                                          
                   VALUE)
                values
                  (id_val,
                  'IB.Customer.LastName',
                  v_rt_all_cols(i).surname);
              end if;
                            vstep_no  := '12';
                            vtable_nm := 'before postcd';
              if (trim(v_rt_all_cols(i).POSTCODE) is not null) then
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)                              
               values
                (id_val,
                 'IB.Customer.Addr.PostCodeMasked',
                  substr(replace(v_rt_all_cols(i).POSTCODE,' ',''),length(replace(v_rt_all_cols(i).POSTCODE,' ',''))-2,3));
              end if;
                            vstep_no  := '13';
                            vtable_nm := 'before subject';
              if (trim(v_rt_all_cols(i).SUBJECT) is not null) then
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)                              
               values
                (id_val,
                 'IB.Correspondence.Subject',
                  v_rt_all_cols(i).subject);
              end if;
                            vstep_no  := '14';
                            vtable_nm := 'before inactivity';
              if (trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) is null or
                  trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) = '3' or
                  trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) = '6' or
                  trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) = '9') then
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)                              
               values
                (id_val,
                 'IB.Correspondence.Inactivity',
                  v_rt_all_cols(i).UNREAD_CORRES_PERIOD);
              end if;
                          vstep_no  := '14.1';
                          vtable_nm := 'after notfound';
        end if;
                          vstep_no  := '15';
                          vtable_nm := 'after notfound';
        END LOOP;
        end loop;
                          vstep_no  := '16';
                          vtable_nm := 'before closecur';
        CLOSE stg_cursor;
                          vstep_no  := '17';
                          vtable_nm := 'before commit';
        DELETE FROM table_stg;
      COMMIT;
                          vstep_no  := '18';
                          vtable_nm := 'after commit';
    EXCEPTION
    WHEN OTHERS THEN
      ROLLBACK;
      success_flag := 1;
      vsql_code := SQLCODE;
      vsql_errm := SUBSTR(sqlerrm,1,200);
      error_logging_pkg.inserterrorlog('samp',vsql_code,vsql_errm, vtable_nm,vstep_no);
      RAISE_APPLICATION_ERROR (-20011, 'samp '||vstep_no||' SQLERRM:'||SQLERRM);
    end;
    Thanks

    Its bit urgent
    NO - it is NOT urgent. Not to us.
    If you have an urgent problem you need to hire a consultant.
    I have a performance issue in the below code,
    Maybe you do and maybe you don't. How are we to really know? You haven't posted ANYTHING indicating that a performance issue exists. Please read the FAQ for how to post a tuning request and the info you need to provide. First and foremost you have to post SOMETHING that actually shows that a performance issue exists. Troubleshooting requires FACTS not just a subjective opinion.
    where i am trying to insert the data from table_stg into target_tab and in parent_tab tables and then to child tables via cursor with bulk collect .the target_tab and parent_tab are huge tables and have a row wise trigger enabled on it .the trigger is mandatory . This timetaken for this block to execute is 5000 seconds.Now my requirement is to reduce it to 5 to 10 mins.
    Personally I think 5000 seconds (about 1 hr 20 minutes) is very fast for processing 800 trillion rows of data into parent and child tables. Why do you think that is slow?
    Your code has several major flaws that need to be corrected before you can even determine what, if anything, needs to be tuned.
    This code has the EXIT statement at the beginning of the loop instead of at the end
        FETCH stg_cursor BULK COLLECT INTO v_rt_all_cols LIMIT limit_in;
                  vstep_no  := '4';
                  vtable_nm := 'after fetch';
    --EXIT WHEN v_rt_all_cols.COUNT = 0;
        EXIT WHEN stg_cursor%NOTFOUND;
    The correct place for the %NOTFOUND test when using BULK COLLECT is at the END of the loop; that is, the last statement in the loop.
    You can use a COUNT test at the start of the loop but ironically you have commented it out and have now done it wrong. Either move the NOTFOUND test to the end of the loop or remove it and uncomment the COUNT test.
    WHEN OTHERS THEN
      ROLLBACK;
    That basically says you don't even care what problem occurs or whether the problem is for a single record of your 10,000 in the collection. You pretty much just throw away any stack trace and substitute your own message.
    Your code also has NO exception handling for any of the individual steps or blocks of code.
    The code you posted also begs the question of why you are using NAME=VALUE pairs for child data rows? Why aren't you using a standard relational table for this data?
    As others have noted you are using slow-by-slow (row by row processing). Let's assume that PL/SQL, the bulk collect and row-by-row is actually necessary.
    Then you should be constructing the parent and child records into collections and then inserting them in BULK using FORALL.
    1. Create a collection for the new parent rows
    2. Create a collection for the new child rows
    3. For each set of LIMIT source row data
      a. empty the parent and child collections
      b. populate those collections with new parent/child data
      c. bulk insert the parent collection into the parent table
      d. bulk insert the child collection into the child table
    And unless you really want to either load EVERYTHING or abandon everything you should use bulk exception handling so that the clean data gets processed and only the dirty data gets rejected.

  • How can I create a universe with the BO repository tables?

    Hi. I need make a universe with the BO repository tables, in order to get user information .
    But, when I try to insert tables in designer, using a new conecction to BO repository. I can't see tables.
    Someone can help me?

    The CMS repository is organized into both physical and virtual tables. Only the CMS can access the virtual tables, therefore you cannot create a universe on the CMS repository. You can access the CMS repository information through the Enterprise SDK.
    https://www.sdn.sap.com/irj/boc/businessobjects-sdklibrary

  • XML file validation with XSD and loading to database relational table

    Hi all,
    I have some xml files coming to my unix directory. I will be having an XSD for those. My task is to validate those xml against given xsd and load the corresponding data into oracle relational tables with sqlloader only.
    Please help me to accomplish. and let me know the contents of control file ( for SQLLOADER) if i want to load the xml directly to database.
    Unix and/or PLSQL suggestions both are welcome.

    My problem area is loading the XML to Oracle relational tables using sqlloader.
    suppose, the xml is <?xml version="1.0"?>
    <Customers>
    <Customer>
    <CustID>1</CustID>
    <Company>Bell South</Company>
    <City>New York</City>
    </Customer>
    <Customer>
    <CustID>2</CustID>
    <Company>Barnes &amp; Noble</Company>
    <City>New York</City>
    </Customer>
    <Customer>
    <CustID>3</CustID>
    <Company>Comp USA</Company>
    <City>Tampa</City>
    </Customer>
    <Customer>
    <CustID>4</CustID>
    <Company>Borders</Company>
    <City>Charlotte</City>
    </Customer>
    </Customers>
    and I have a relational table
    CREATE TABLE CUSTOMERS
    CUSTID NUMBER,
    COMPANY VARCHAR2(100 BYTE),
    CITY VARCHAR2(100 BYTE)
    how to insert the xml data into the table???
    please help..
    Edited by: nuon on Oct 25, 2010 6:25 AM

  • How can build BMM with multiple fact tables

    HI Gurus,
    I have 4 fact tables and 18 Dimension table. Dimension tables have links with multiple fact tables. i have created physical joins in Physical layer. Now my questions is how can i create Business Model with multiple fact tables.
    i mean should i create 4 fact tables as logical tables and logical keys ? Then i have to move all dimension tables in to Business model?
    i am new to OBIEE. i gone through tutorial it is showing with one fact and multi dimension table. Should i do follow same style with multi fact tables.
    Please help me. Thanks in advance for your support.

    Thanks for your response.
    I had drag all tables from the phisical layer to Business Model. then i have deleted all links and recreated complex joins with default values.
    now i have some revenue amont columns in fact tables.
    my question is should i should i create aggregation ( like Sum..) for those columns? is it must ?
    please let me know thank you very much

  • Joins with multiple fact tables

    Hi Experts,
    i have one doubt in joins
    we have two dimensions D1 and D2,
    D1 is having A1 and A2 columns
    D2 is having B1 and B2 columns
    two facts F1 and F2 these are joined like D1 to F1 D1 to F2 and D2 to F1, D2 to F2
    D1----->F1
    D1------>F2
    D2-------->F1
    D2-------->F2
    if i selected A1 and B1 in a request from which FACT table will get the data and why can you please explain
    please help me
    reg,
    Jell

    Hi All,
    I have a similar requirement where I have 4 multiple fact tables and we can't combine all those facts into one single fact table. In that case how can a query work with multiple common and uncommon dimensions and measures from multiple fact tables, if it doesn't work that way - can you please explain how can we expect a query to work with multiple fact tables.
    For eg: D1– Dim
    D2 – Dim
    D3 – Dim
    D4 – Dim
    F1 –Fact
    F2 – Fact
    F3 – Fact
    D1 -> F1
    D2 -> F1,F2
    D3 -> F2
    D4 -> F1, F3
    In this case if we want to query from D1,D2,D3, F1, F2 or D1,D2,D3,D4,F1,F2,F3. Kindly please explain how it can be modeled in BMM or what are the limitations. I have done with two fact tables in past and didn't had issues but this is kind of a vast implementation. Your help is appreciated.

  • Mapping with xml-schema XML-data to relational tables

    Hello,
    is it possible to map data from xml documents to relational tables with xml-schema?
    I mean not in nested tables but in relational tables with primary and foreign keys!
    With SQL Server 2005 it is very easy, I dont believe that Oracle couldn't do this!
    I searched but i cant find anything about that!
    Thx
    user445232

    indeed, oracle does this for xml schema based xmltype data, however, these underlying tables are not accessable to the application. Maybe It should for next version, so folks who like to use relational model can use it without mapping it manually.
    Actually, nested tables, are the same, their underlying tables (segments) are indeed relational tables, oracle manages them internally and not visiable to the application. You can find them in the user_segments, user_objects views though.

Maybe you are looking for

  • HP Officejet 4630 Printer....how do change from the default setting when printing from the web?

    HP Officejet 4630.....Windows 8, 64-bit When printing from the web I am not able to change the print size. 1. Click File on Menu bar 2. Click Print open dialog box 3. Click Properties open printing shortcuts Everything in Printing Shortcuts have a lo

  • How to display a description in fact table from an unrelated DIM table in powerpivot?

    Hello, I have two tables in powerpivot 2010: 1 that is my fact and the is unrelated. I'm relatively new to SQL and powerpivot. What I need to do is display a description from my DIM table based on a column in my fact. Is this possible? In my fact, I

  • Chart Axis Title

    When a title is added, Flex selects a title which is oriented vertically and pointing downward. How can I set the orientation of the title, for examle, to be 180 degrees rotated?

  • Reinstalling Adobe Acrobat pro 9

    Adobe Acrobat 9 Pro was never re- installed on the new computer after being rebuilt.  Found the program disc, went to install it, got message on computer if I want to run Autoplay.exe to install.  Tried that, got the following error messages in a dis

  • HRFORMS Workplace Infotype 0008 in generated print program

    Hi folks We have a problem with generated print programs for time sheets. Generated by the HRFORMS workplace. Even when the workplace generate the printprogram for the SmartForm, accordingly a code line is generated as the 1st in the PrintProg. INFOT