To insert N number of values in a table for backup

Hello experts,
I need to insert N number of values in a table using
SQL or PL/SQL. Please help me to do this.
i have tried this. but not working
CREATE PROCEDURE P1
AS
-- start loop & repeat N times
INSERT INTO [T1]
    ([Value])
VALES
    (:value)
INSERT INTO [T2]
    ([valueID])
VALUES
    (:IDENTITY)
-- END LOOP
END;

>almost i got the answer.
Then is it not time to close the thread as mark it Answered ?
Or, your "almost" requires more ...!
Regards
Girish Sharma

Similar Messages

  • How to insert various number of values into a table

    Hi
    Im devoloping application using swing components..How can i insert values from JTextField to table if the form contains number of textfield(more than 30) and JRadioButtons(Radio Buttons are in button group).
    thanks in advance.

    Hi
    i designed a form with 58 Textfields. i want to get data from those fields and i have to store those into a database table. how can i do that .is there any simple way to do that?. do you have any example code? pls give me...

  • How to get the object class field value in CDHDR table for vendor

    hi
    how to get the object class field value in CDHDR table for vendor

    Try KRED/KRED_N as object class in CDHDR for Vendor.

  • Procedure inserting different number of records in GT table

    I have procedure, in the procedure a dynamic query is get created. Then query is open using OPEN for statement into refcusror. Then I'm fetching the data into record type object within a loop..end loop and inserting the records in a GT table.
    But problem is for the same data procedure is inserting less records, when i recomplie the procedure it began to insert correct number of data.
    I wonder whether is environment issue or something else? Please advise if any one faced such type problem.

    Hi upennit. Not much info to go on there.
    Have a read of Re: 2. How do I ask a question on the forums?
    then post back with some relevant info.

  • Insert value in WWWDATA  table for sending picture in body of email

    Hi
    .Requrement: Send image in the body of the email.
    I am using cl class to sending email and Function module WWW_GET_MIME_OBJECT requre values from table  WWWDATA and WWWPARAMS.
    I have image file need to be used in email body for the same i want to entry in the table  wwwdata and wwwparams so that they can be used to fetch url detail.
    I am not able to insert value in wwwdata. Anybody having idea about it.
    Thanks & Regards,
    Ravi Grover
    Edited by: Ravi Grover on Jul 27, 2011 12:34 PM

    To display the image in other systems you will have to store the image in SMWO(SAP Web Repository)
    Then call the function WWW_GET_MIME_OBJECT .
    Please check this link to [Upload|http://abap-explorer.blogspot.com/2008/10/how-to-display-picture-in-screen.html] data in SMWO.
    Regards
    Mishra

  • Insert/Update multiple checkbox values into a table

    Hi all,
              I created an interactive report with checkboxes in it.
    My application is like,
    step 1: user will give his ID in a text box and click on 'submit' which redirects to IR page which has got checkboxes
    step 2: IR report displays all the environments and access levels as two of its columns
    step 3: if user checks on some box in IR, those particular environments and access levels (may be multiple environments and access levels) for that particular ID should get inserted into a table.
    I have created a model application at http://apex.oracle.com/pls/apex/f?p=71510:20 (wokspace:test_me, username=test, paswrd: apex14gm)
    I found this forum too, https://forums.oracle.com/thread/2387391?start=0&tstart=0. But I am confused of how to implement it!
    How to achieve this??
    Pls help me out....
    Thanks in advance

    Hi Kanishkaa,
    I've taken a look at your application.
    So the things that I noticed that are wrong:
    1)Your report: You created 2 items but you gave the 2 items the same idx. This is really weird I'm not sure if APEX knows how to handle this. Don't give 2 items the same idx. Furthermore you need to create 2 additional hidden items since you also want to store the access level and the environment.
    2)The PL/SQL Process: Your PL/SQL Process: your making a type t_checkboxes, but your not actually doing anything with this type. Your not giving this any value. So obviously you get an error.
    You really should rewrite this process based on the process in my blog. Please read it again carefully, if you just use the one insert statement you are using then even if you write a correct process that doesn't give any errors, the wrong data will be inserted.
    Regards,
    Joni

  • Select on MARA resulting into # values in internal table for one field

    Hi Team,
    I have written a SELECT statement on MARA table as below.
    TRY.
            SELECT matnr zzwftag FROM mara CLIENT SPECIFIED
              INTO CORRESPONDING FIELDS OF TABLE gt_mara WHERE
              mandt = sy-mandt AND
              zzwftag NE space
              AND zzwftag IS NOT NULL
              AND zzwftag NE '#'
              AND zzwftag NE '%#%'
              AND zzwftag NE '  '
              AND zzwftag NOT LIKE '%/%'(012).
          CATCH cx_sy_dynamic_osql_error.
            MESSAGE 'Error While Fetching Data from MARA'(044) TYPE 'S'(040)  DISPLAY LIKE 'W'(041).
        ENDTRY.
        IF NOT gt_mara[] IS INITIAL.
          DELETE gt_mara[] WHERE zzwftag EQ '#'
          OR zzwftag IS INITIAL
          OR zzwftag EQ space
          OR zzwftag EQ ' '.
        ENDIF.
    Observations: 1. In
    the resulting internal table I am seeing '#' values for fields zzwftag which are actually empty when I see the record in SE11 in MARA(ALV display). It shows '#' in it in SE16 display(We can choose User parameters and hence mode of display in SE11)
    The requirement is to avoid those records where zzwftag is initial i.e. blank. I tried to delete invalid records but to no avail.
    Please suggest any way where I can get the Select correct.
    Regards,
    Amit

    Please do not use so many not conditions in one query....
    Using so many negative conditions results in bad data.
    Instead use delete statements later this would not confuse the system.
    Also if you are using sy-mandt then i think you should not use client specified system will take care of it.
    TRY.
    SELECT matnr zzwftag FROM mara CLIENT SPECIFIED
    INTO CORRESPONDING FIELDS OF TABLE gt_mara WHERE
    mandt = sy-mandt AND
    zzwftag NE space.
    CATCH cx_sy_dynamic_osql_error.
    MESSAGE 'Error While Fetching Data from MARA'(044) TYPE 'S'(040) DISPLAY LIKE 'W'(041).
    ENDTRY.
    IF NOT gt_mara[] IS INITIAL.
    DELETE gt_mara[] WHERE zzwftag EQ '#'
    OR zzwftag IS INITIAL
    OR zzwftag EQ space
    OR zzwftag EQ ' '.
    delete gt_mara[] where zzwflag eq '%#%'.
    ENDIF.

  • Dynamic value in TVARVC table for standard report

    Hello,
    I am trying to archive objects like FI_DOCUMNT. For this purpose I want to create dynamic variant for the date. ( Date not in complete format) yyyy/mm.
    So, I created an entrie in TVARVC table, and I linked it with the attribute of my variant by choosing "T" option.
    My question is, how Can I fill the dynamic value for TVARVC entry?, knowing that it a standard report that is responsible for archiving.
    Cordialy,

    Hi Merou,
    this might help:
    Create Variant for dynamic population of current date
    Check the reponses about saving dynamic variants with column "L" and follow the rest of the instructions.
    Best,
    Sander    

  • How to derive logic from values in a table

    Hi,
    I am using collection to retrieve multiple records being returned by a business rule.
    I am inserting all the returned values into a table
    T_ELIGIBLE (owner varchar2(10), eligible varchar2(1), qty number(10));
    then, I was wondering how I do this:
    if all the records (owners) in T_ELIGIBLE have value for eligible = 'Y' then, final output to be 'Y'.
    Thanks,

    Hi,
    Thanks for your response.
    By output - I meant as a parameter. What I am trying to do is to - some how loop through all the values for each owner and some up with AND logic.
    If owner1's eligibility = 'Y'
    and if owner2's eligibility = 'Y' then p_eligible = 'Y'
    else 'N'
    I would also like to know how to capture this while looping through the code.
    Here is the basic structure of my code. Thank you,
    create or replace procedure pp1
    p_item_no IN varchar2,
    p_project_no IN varchar2,
    p_entity IN varchar2,
    p_baan_id IN varchar2,
    p_eligible IN OUT varchar2,
    p_qty IN OUT number)
    is
    cursor the_owner_code is
    select t.item_type, t.dtt_limited_flag, dtt_owner_code
    from wm_item t
    where item_no in (select component_item_no
    from wm_kit_bom t
    where kit_item_no = p_item_no
    and end_date is null)
    and project_no = p_project_no
    and entity = p_entity;
    type owners_t is table of wm_item.dtt_owner_code%type
    index by binary_integer;
    v_owner_names owners_t; -- to capture owner names
    type limited_flag is table of wm_item.dtt_limited_flag%type;
    v_limited_flag limited_flag := null; -- to capture limited flag
    type item_type is table of wm_item.item_type%type;
    v_item_type item_type := null; -- to item type
    begin
    execute immediate('truncate table t_limit');
    execute immediate('truncate table t_eligible');
    open the_owner_code;
    fetch the_owner_code bulk collect into v_item_type, v_limited_flag, v_owner_names;
    for indx in v_owner_names.first .. v_owner_names.last
    loop
    select a.ownl_max_limit, a.ownl_unit into l_ownl_max_limit, l_ownl_unit
    from dtt_owner_ranking a, dtt_agency_ranking b
    where b.agr_owner_code = a.ownl_owner_code
    and b.agr_ranking_code = a.ownl_ranking_code
    and b.agr_baan_id = p_baan_id
    and b.agr_owner_code = v_owner_names(indx);
    insert into t_limit values(l_ownl_unit, l_ownl_max_limit);
    insert into t_eligible values (v_owner_names(indx), 'Y',l_remaining_qty); commit;
    end loop;
    close the_owner_code;
    end;

  • How to update this table with values from another table ?

    Hi
    I have a table "regies". I want to replace the values of the column "regies.agent" by the value of the column "regies_personnes.id"
    As you see the tables have a common values column. ie regies.agent = regies_personnes.nom
    Table "regies" :
    Insert into "regies" (AGENT) values ('Humberdot Alain');
    Insert into "regies" (AGENT) values ('Danard Patrick');
    Table "regies_personnes" :
    Insert into REGIES_PERSONNES (NOM,ID) values ('Humberdot Alain',1);
    Insert into REGIES_PERSONNES (NOM,ID) values ('Danard Patrick',2);
    Before we have this
    sql>select agent from regies ;
    Humberdot Alain
    Danard Patrick
    After the update, the result should be
    sql>select agent from regies ;
    1
    2
    Thank you for your kind answer.

    You will face error if you have duplicates
    ORA-01427 Single row subquery returns Multiple rows.Try this way
    create table regies(agent varchar2(30));
    create table regies_personnes( nom varchar2(30),id number);
    Insert into regies (AGENT) values ('Humberdot Alain');
    Insert into regies (AGENT) values ('Danard Patrick');
    Insert into REGIES_PERSONNES (NOM,ID) values ('Humberdot Alain',1);
    Insert into REGIES_PERSONNES (NOM,ID) values ('Danard Patrick',2);
    Insert into regies (AGENT) values ('Humberdot Alain');
    Insert into regies (AGENT) values ('Danard Patrick');
    Insert into REGIES_PERSONNES (NOM,ID) values ('Humberdot Alain',1);
    Insert into REGIES_PERSONNES (NOM,ID) values ('Danard Patrick',2);
    commit;
    update regies r set agent = (select id from regies_personnes p where r.agent = p.nom
    and rownum=1)
      where exists (select id from regies_personnes p where r.agent = p.nom
    commit

  • Hardcode the values in the table

    Hiii
    Iam developing a web dynpro application.With out writing the code i can able to deploy and run the application.In that i want to hardcode values in the table for demo purpose.how i can get those values.
    Is there any property in web dynpro to do that,,,,,,,, or else,,,,,,,,, we have to write the code in the application.
    If thats the case,,,,Please provide the code to get the values in the table.
    Regards
    Sushma

    Hi
    For different data,,,,,in what way i have to do.
    Like this your saying
    IPrivateEtrecEmpView.IEmployeeElement element4 = wdContext.nodeEmployee().createEmployeeElement();
                   element4.setDesignation("Software Engineer");
                   element4.setDepartment("Basis");
                   element4.setEmailID("");
                                  element4.setEmpCode("0011579");
                                  element4.setEmpName("");
                                  element4.setMobileNo("");
                                  element4.setSlno("4");
                                  element4.setLocation("Bangalore");
                        wdContext.nodeEmployee().addElement(element4);
         IPrivateEtrecEmpView.IEmployeeElement element3 = wdContext.nodeEmployee().createEmployeeElement();
                             element3.setDesignation("Software Engineer");
                             lement3.setDepartment("Web dynpro");
                             element3.setEmailID("");
                             element3.setEmpCode("0011579");
                             element3.setEmpName("");
                             element3.setMobileNo("");
                                  element3.setSlno("4");
                                  element3.setLocation("Bangalore");
                   wdContext.nodeEmployee().addElement(element3);

  • Executed  Step outcome  value  from the table

    Hi,
       How to get the Step outcome  value  from the table for the executed workitem.
    Regards,
    Rani.

    Hi Rani,
    For database tables you can refer to tables:
    SWWLOGHIST -      History of a work item
    SWWORGTASK -      Assignment of WIs to Org.Units and Tasks
    SWWUSERWI -      Current Work Items Assigned to a User
    SWWWIHEAD -      Header Table for all Work Item Types
    SWWWIAGENT -      Gets agents assigned to a workitem
    You can you FMs like SAP_WAPI_GET_WORKITEM_DETAIL, SAP_WAPI_CREATE_WORKLIST as per your requirement.
    Hope this helps!
    Regards,
    Saumya

  • Proving the Input values in a table with a dropdown and save the values

    Hi Experts,
    I have  a requirement to create a table which is empty (in BSP)and I want to enter the values in a table, for eg: Unit , RegNo, Regvalidity date, item categories. are the coulum names.But I have to display the values in the categories column  in dropdown.
    Finally I enter the values in a table and select the values in a categorie column and save the values in a ztable.
    Please provide me solution how to proceed with this requirement?.
    Thanks ,
    Regards,
    Kiran

    Hi Kiran,
    For creating blank tabel in BSP use the iterator. See the beolow  link for information on creating balnk lines using iterator,
    http://help.sap.com/saphelp_nw04/helpdata/en/2a/31b98a35a111d5992100508b6b8b11/frameset.htm
    the code in render_cell_start method of iterator class should be something like,
    initially you render all cells as blank so that the blank table is created in page.
    when a row is selected you render unit, reg no., reg validity date as inputfield and categories as dropdown listbox.
    Dropdown in Tableview
    link might help you for DDLB in tableview.
    Search the forum and blogs for more code samples.
    Regards,
    Anubhav

  • I have to insert lookup values into parent table remaining items in chiled table can you please any one explain the logic

    CREATE OR REPLACE
    PACKAGE BODY xxcsi_ib_data_ob_ecs_pkg
      v_update_date DATE := SYSDATE;
    PROCEDURE print_log(
        i_message IN VARCHAR2)
    IS
    BEGIN
      -- dbms_output.put_line('Log '||TO_CHAR(sysdate,'DD-MON-YYYY HH24:MI:SS :')||i_message);
      fnd_file.put_line(fnd_file.LOG,'Log '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS :')||i_message);
    EXCEPTION
    WHEN no_data_found THEN
      NULL;
    WHEN OTHERS THEN
      NULL;
    END;
    PROCEDURE main_prc(
        o_chr_errbuff OUT VARCHAR2 ,
        o_num_retcode OUT NUMBER ,
        i_org_id IN NUMBER)
    IS
      CURSOR cur_get_parent_ib_rec(c_from DATE ,c_to DATE)
      IS
        SELECT
          /*+ index(a CSI_ITEM_INSTANCES_X3)*/
          ---CREATE MODE ITEM
          A.creation_date ,
          A.last_update_date ,
          A.last_oe_order_line_id line_id ,
          A.inventory_item_id ,
          A.instance_id ,
          A.instance_type_code ,
          msib.segment1
        FROM csi_item_instances A ,
          mtl_system_items_b msib
        WHERE 1=1
          --      AND a.instance_id = 33371916
          --AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
        AND msib.inventory_item_id=A.inventory_item_id
        AND msib.organization_id  =
          (SELECT mp.organization_id
          FROM mtl_parameters mp
          WHERE mp.organization_code = 'IMO'
        -- AND msib.organization_id = 85
        -- and msib.segment1 like '475%'
        --AND msib.segment1 like 'TREX%'
      AND EXISTS
        (SELECT 1
        FROM fnd_lookup_values
        WHERE lookup_type = 'EMR CSI OUTBOUND INTERFACE PSG'
        AND language      = 'US'
        AND lookup_code   = msib.segment1
        --and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
      AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
      UNION
      SELECT
        /*+ index(a CSI_ITEM_INSTANCES_X3)*/
        ---CREATE MODE SEARCH
        A.creation_date ,
        A.last_update_date ,
        A.last_oe_order_line_id line_id ,
        A.inventory_item_id ,
        A.instance_id ,
        A.instance_type_code ,
        msib.segment1
      FROM csi_item_instances A ,
        mtl_system_items_b msib
      WHERE 1=1
        --AND a.instance_id = 33371916
        --AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
      AND msib.inventory_item_id=A.inventory_item_id
      AND msib.organization_id  =
        (SELECT mp.organization_id
        FROM mtl_parameters mp
        WHERE mp.organization_code = 'IMO'
        -- AND msib.organization_id = 85
        -- and msib.segment1 like '475%'
        --AND msib.segment1 like 'TREX%'
      AND EXISTS
        (SELECT 1
        FROM fnd_lookup_values
        WHERE lookup_type           = 'EMR CSI OUTBOUND INTERFACE PSG'
        AND language                = 'US'
        AND tag                     ='ALL TREX ITEMS'
        AND SUBSTR(lookup_code,1,4) = SUBSTR(msib.segment1,1,4)
        --and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
      AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
      UNION
      SELECT
        /*+ index(a CSI_ITEM_INSTANCES_X3)*/
        ---UPDATE MODE ITEM
        A.creation_date ,
        A.last_update_date ,
        A.last_oe_order_line_id line_id ,
        A.inventory_item_id ,
        A.instance_id ,
        A.instance_type_code ,
        msib.segment1
      FROM csi_item_instances A ,
        mtl_system_items_b msib
      WHERE 1=1
        --AND a.instance_id = 33371916
        --AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
      AND msib.inventory_item_id=A.inventory_item_id
      AND msib.organization_id  =
        (SELECT mp.organization_id
        FROM mtl_parameters mp
        WHERE mp.organization_code = 'IMO'
        -- AND msib.organization_id = 85
        -- and msib.segment1 like '475%'
        --AND msib.segment1 like 'TREX%'
      AND EXISTS
        (SELECT 1
        FROM fnd_lookup_values
        WHERE lookup_type = 'EMR CSI OUTBOUND INTERFACE PSG'
        AND language      = 'US'
        AND lookup_code   = msib.segment1
        --and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
      AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
      AND EXISTS
        (SELECT
          /*+ index(ct CSI_TRANSACTIONS_U01)*/
          1
        FROM csi_item_instances_h h ,
          csi_transactions ct
        WHERE 1                     =1
        AND ct.transaction_type_id IN (1)
        AND ct.transaction_id       = h.transaction_id
        AND ct.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
        AND A.instance_id =h.instance_id
      UNION
      SELECT
        /*+ index(a CSI_ITEM_INSTANCES_X3)*/
        ---UPDATE MODE SEARCH
        A.creation_date ,
        A.last_update_date ,
        A.last_oe_order_line_id line_id ,
        A.inventory_item_id ,
        A.instance_id ,
        A.instance_type_code ,
        msib.segment1
      FROM csi_item_instances A ,
        mtl_system_items_b msib
      WHERE 1=1
        --AND a.instance_id = 33371916
        --AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
      AND msib.inventory_item_id=A.inventory_item_id
      AND msib.organization_id  =
        (SELECT mp.organization_id
        FROM mtl_parameters mp
        WHERE mp.organization_code = 'IMO'
        -- AND msib.organization_id = 85
        -- and msib.segment1 like '475%'
        --AND msib.segment1 like 'TREX%'
      AND EXISTS
        (SELECT 1
        FROM fnd_lookup_values
        WHERE lookup_type           = 'EMR CSI OUTBOUND INTERFACE PSG'
        AND language                = 'US'
        AND tag                     ='ALL TREX ITEMS'
        AND SUBSTR(lookup_code,1,4) = SUBSTR(msib.segment1,1,4)
        --and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
      AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
      AND EXISTS
        (SELECT
          /*+ index(ct CSI_TRANSACTIONS_U01)*/
          1
        FROM csi_item_instances_h h ,
          csi_transactions ct
        WHERE 1                     =1
        AND ct.transaction_type_id IN (1)
        AND ct.transaction_id       = h.transaction_id
        AND ct.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
        AND A.instance_id =h.instance_id
      ORDER BY 1 DESC,
        2 ;
      CURSOR cur_get_child_ib_rec(c_instance_id NUMBER)
      IS
        SELECT cir.subject_id
        FROM csi.csi_ii_relationships cir
        WHERE cir.object_id = c_instance_id;
      CURSOR cur_get_outbound_data(c_instance_id NUMBER)
      IS
        SELECT cii.instance_id instance_id,
          cii.instance_number instance_number,
          cii.inventory_item_id inventory_item_id,
          msi.segment1 segment1,       --CONCATENATED_SEGMENTS,
          msi.description description, --DESCRIPTION,
          cii.inv_master_organization_id master_organization_id,
          cii.serial_number serial_number,
          cii.system_id system_id,
          cst.NAME system_name,
          cii.quantity quantity,
          cii.unit_of_measure uom,
          cii.active_start_date active_start_date,
          cii.active_end_date active_end_date,
          cii.install_date install_date,
          cii.object_version_number object_version_number,
          cii.last_vld_organization_id,
          hou.NAME pre_registration_location,
          looh.header_id last_header_id,
          looh.order_number emerson_order_number,
          cii.last_oe_order_line_id order_line_id,
          NVL(lool.actual_shipment_date, lool.fulfillment_date) actual_shipment_date,
          (SELECT DISTINCT pap.email_address
          FROM fnd_user fu ,
            per_all_people_f pap
          WHERE fu.employee_id = pap.person_id
          and sysdate between pap.effective_start_date and nvl(pap.effective_end_date, sysdate)
          AND fu.user_id       = NVL(wdd.created_by,lool.created_by)
          ) email_address,
        (SELECT DISTINCT hp.party_name
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "Bill_To_company_name",--------------------------CH-ID-1.1 STARTS-----------
        (SELECT DISTINCT hps.party_site_id
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "BILL_TO_party_SITE_ID",
        (SELECT DISTINCT hl.state
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "BILL_TO_STATE",
        (SELECT DISTINCT hl.country
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "BILL_TO_COUNTRY",
        (SELECT DISTINCT hl.city
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "BILL_TO_CITY",
        (SELECT DISTINCT hl.address1
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "BILL_TO_LOCATION",
        (SELECT DISTINCT hp.party_name
        FROM hz_parties hp,
          hz_party_sites hps,
          hz_party_site_uses hpsu,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.ship_to_address = hcsua.site_use_id
        ) AS "Ship_to_company_name",
        (SELECT DISTINCT hps.party_site_id
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "SHIP_TO_party_SITE_ID",
        (SELECT DISTINCT hl.state
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "SHIP_TO_STATE",
        (SELECT DISTINCT hl.country
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "SHIP_TO_COUNTRY",
        (SELECT DISTINCT hl.city
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "SHIP_TO_CITY",
        (SELECT DISTINCT hl.address1
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "SHIP_TO_LOCATION",
        (SELECT DISTINCT hl.postal_code
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "SHIP_TO_PIN_CODE",
        (SELECT DISTINCT hl.postal_code
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "BILL_TO_PIN_CODE",
        (SELECT hcsua.LOCATION
        FROM apps.hz_cust_site_uses_all hcsua
        WHERE cia.ship_to_address = hcsua.site_use_id
        ) "SHIP_TO_NUMBER",
        (SELECT hcsua.LOCATION
        FROM apps.hz_cust_site_uses_all hcsua
        WHERE cia.bill_to_address = hcsua.site_use_id
        ) "BILL_TO_NUMBER",
        (SELECT DISTINCT hca.account_number
        FROM hz_cust_accounts hca
        WHERE hca.cust_account_id =
          (SELECT hcasa.cust_account_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        )AS "CUSTOMER_NUMBER", --------------------------CH-ID-1.1 ENDS -----------
        (SELECT civ.attribute_value
        FROM csi_iea_values civ,
          csi_i_extended_attribs ciea
        WHERE civ.attribute_id  = ciea.attribute_id
        AND ciea.attribute_code = '011 LICENSE NUMBER'
        AND civ.instance_id     = cii.instance_id
        ) AS "EA_LICENSE_NUMBER",
        (SELECT civ.attribute_value
        FROM csi_iea_values civ,
          csi_i_extended_attribs ciea
        WHERE civ.attribute_id  = ciea.attribute_id
        AND ciea.attribute_code = 'VA_SALES_ORDER_NUMBER'
        AND civ.instance_id     = cii.instance_id
        ) AS "EA_VA_SALES_ORDER_NUM",
        (SELECT NAME
        FROM hr_all_organization_units
        WHERE organization_id = cii.inv_master_organization_id
        ) master_organization_name
      FROM csi_item_instances cii,
        csi_systems_tl cst,
        --    MTL_SYSTEM_ITEMS_VL MSIKFV,
        --    MTL_SYSTEM_ITEMS MSI,
        mtl_system_items_b msi,
        hr_all_organization_units hou,
        oe_order_lines lool,
        oe_order_headers looh,
        wsh_delivery_details wdd,
        csi_i_parties cip,
        csi_ip_accounts cia
      WHERE cii.last_vld_organization_id = msi.organization_id
      AND cii.inventory_item_id          = msi.inventory_item_id
        --  AND CII.LAST_VLD_ORGANIZATION_ID   = MSIKFV.ORGANIZATION_ID
        --  AND CII.INVENTORY_ITEM_ID          = MSIKFV.INVENTORY_ITEM_ID
      AND hou.organization_id(+)    = cii.last_vld_organization_id
      AND cii.last_oe_order_line_id = lool.line_id
      AND lool.header_id            = looh.header_id
      AND cii.last_oe_order_line_id = wdd.source_line_id
        --      AND WDD.SOURCE_LINE_ID             = LOOL.LINE_ID
        --      AND WDD.SOURCE_HEADER_ID           = LOOH.HEADER_ID
      AND cii.instance_id               = cip.instance_id
      AND cii.system_id                 = cst.system_id(+)
      AND cip.party_source_table        = 'HZ_PARTIES'
      AND cip.relationship_type_code    = 'OWNER'
      AND cip.instance_party_id         = cia.instance_party_id
      AND cia.relationship_type_code(+) = 'OWNER'
      AND cii.instance_status_id        = 1052
      AND cst.language(+)               = 'US'
      AND cii.instance_id               = c_instance_id;
      CURSOR cur_get_ib_warranty (c_instance_id NUMBER)
      IS
        SELECT kh.contract_number,
          kh.scs_code,
          kh.start_date,
          kh.end_date,
          (kh.end_date-kh.start_date) duration,
          clet.NAME coverage_name,
          clet.item_description coverage_desc,
          b.segment1 service_name,
          t.description service_desc
        FROM okc_k_headers_b kh,
          okc_k_lines_b kl,
          okc_k_items ki,
          csi_item_instances c,
          mtl_system_items_b i,
          okc_k_lines_b cleb,
          okc_k_lines_tl clet,
          okc_k_items ki1,
          mtl_system_items_b_kfv b,
          mtl_system_items_tl t
        WHERE kh.contract_number_modifier IS NULL
        AND kh.ID                          = kl.dnz_chr_id
        AND kh.ID                          = ki.dnz_chr_id
        AND kl.ID                          = ki.cle_id
        AND ki.jtot_object1_code          IN ('OKX_CUSTPROD')
        AND c.last_vld_organization_id     = i.organization_id
        AND ki.object1_id1                 = TO_CHAR(c.instance_id)
        AND c.inventory_item_id            = i.inventory_item_id
        AND kl.cle_id                      = cleb.cle_id
        AND cleb.ID                        = clet.ID
        AND clet.language               = userenv('LANG')
        AND cleb.lse_id                   IN (2,15,20)
        AND cleb.cle_id                    = ki1.cle_id
        AND b.inventory_item_id            = t.inventory_item_id
        AND b.organization_id              = t.organization_id
        AND t.language                     = userenv('LANG')
        AND to_number(ki1.object1_id1)     = b.inventory_item_id
        AND to_number(ki1.object1_id2)     = b.organization_id
        AND c.instance_id                  = c_instance_id;
      --v1.2 comment ends
      CURSOR cur_get_to_date( c_req_id NUMBER,c_conc_prog_id NUMBER)
      IS
        SELECT requested_start_date
        FROM fnd_concurrent_requests
        WHERE request_id          = c_req_id
        AND concurrent_program_id = c_conc_prog_id;
      /*Record Type Declaration*/
    TYPE ib_ecs_dat_record
    IS
      record
        instance_id csi_item_instances.instance_id%TYPE,
        instance_number csi_item_instances.instance_number%TYPE,
        inventory_item_id csi_item_instances.inventory_item_id%TYPE,
        segment1 mtl_system_items_b.segment1%TYPE,
        description mtl_system_items_b.description%TYPE,
        master_organization_id csi_item_instances.inv_master_organization_id%TYPE,
        serial_number csi_item_instances.serial_number%TYPE,
        system_id csi_item_instances.system_id%TYPE,
        system_name csi_systems_tl.NAME%TYPE,
        quantity csi_item_instances.quantity%TYPE,
        uom csi_item_instances.unit_of_measure%TYPE,
        active_start_date csi_item_instances.active_start_date%TYPE,
        active_end_date csi_item_instances.active_end_date%TYPE,
        install_date csi_item_instances.install_date%TYPE,
        obj_version_num csi_item_instances.object_version_number%TYPE,
        last_vld_organization_id csi_item_instances.last_vld_organization_id%TYPE,
        pre_registration_location VARCHAR2(500),
        order_header_id oe_order_headers_all.header_id%TYPE,
        order_number oe_order_headers_all.order_number%TYPE,
        order_line_id csi_item_instances.last_oe_order_line_id%TYPE,
        actual_shipment_date oe_order_lines_all.actual_shipment_date%TYPE,
        email_address per_all_people_f.email_address%TYPE,
        bill_to_company_name hz_parties.party_name%TYPE,
        bill_to_site_id hz_party_sites.party_site_id%TYPE,
        bill_to_state hz_locations.state%TYPE,
        bill_to_country hz_locations.country%TYPE,
        bill_to_city hz_locations.city%TYPE,
        bill_to_location hz_locations.address1%TYPE,
        ship_to_company_name hz_parties.party_name%TYPE,
        ship_to_site_id hz_party_sites.party_site_id%TYPE,
        ship_to_state hz_locations.state%TYPE,
        ship_to_country hz_locations.country%TYPE,
        ship_to_city hz_locations.city%TYPE,
        ship_to_location hz_locations.address1%TYPE,
        ship_to_pin_code hz_locations.postal_code%TYPE,
        bill_to_pin_code hz_locations.postal_code%TYPE,
        ship_to_number hz_cust_site_uses_all.LOCATION%TYPE,
        bill_to_number hz_cust_site_uses_all.LOCATION%TYPE,
        customer_number hz_cust_accounts.account_number%TYPE,
        ea_license_number csi_iea_values.attribute_value%TYPE,
        ea_va_sales_order_num csi_iea_values.attribute_value%TYPE,
        master_organization_name hr_all_organization_units.NAME%TYPE );
    TYPE tab_typ_ib_ecs_dat
    IS
      TABLE OF ib_ecs_dat_record INDEX BY binary_integer;
    TYPE ib_parent_dat_record
    IS
      record
        creation_date DATE,
        last_update_date DATE,
        order_line_id csi_item_instances.last_oe_order_line_id%TYPE,
        inventory_item_id csi_item_instances.inventory_item_id%TYPE,
        instance_id csi_item_instances.instance_id%TYPE,
        instance_type_code csi_item_instances.instance_type_code%TYPE,
        segment1 mtl_system_items_b.segment1%TYPE );
    TYPE tab_typ_ib_parent_dat
    IS
      TABLE OF ib_parent_dat_record INDEX BY binary_integer;
      --/*Record Type Declaration*/
      --      TYPE parent_ib_record IS RECORD (
      --         creation_date           csi_item_instances.creation_date%TYPE,
      --         last_update_date        csi_item_instances.last_update_date%TYPE,
      --         inventory_item_id       csi_item_instances.inventory_item_id%TYPE,
      --         instance_id             csi_item_instances.instance_id%TYPE,
      --         instance_type_code      csi_item_instances.instance_type_code%TYPE,
      --         segment1                mtl_system_items_b.segment1%type
      --      TYPE tab_typ_par_ib_collection IS TABLE OF parent_ib_record
      --         INDEX BY BINARY_INTEGER;
      --      tab_par_ib_rec                   tab_typ_par_ib_collection;
      v_segment1 mtl_system_items_b.segment1%TYPE;
      v_request_id        NUMBER := fnd_global.conc_request_id;
      v_conc_prog_id      NUMBER := fnd_global.conc_program_id;
      v_created_by        NUMBER := fnd_profile.VALUE('USER_ID');
      v_last_update_login NUMBER := fnd_global.login_id;
      v_to DATE                  := SYSDATE;
      v_from DATE                := SYSDATE-100;
      v_count NUMBER             := NULL;
      --       v_header_id                        NUMBER := NULL;
      --       v_line_id                          NUMBER := NULL;
      --       v_org_id                           NUMBER := NULL;
      --       v_ship_from_org_id                 NUMBER := NULL;
      --v1.2 begin
      --       v_master_org_id                    NUMBER := NULL;
      --       v_item_type                        VARCHAR2(100) := null;
      --       v_top_model_line_id                NUMBER := NULL;
      --       v_serial_tag_number                VARCHAR2(100) := null;
    TYPE tbl_req_start_date_type
    IS
      TABLE OF DATE INDEX BY pls_integer;
      tbl_req_start_date tbl_req_start_date_type;
      --v1.2 ends
      --v1.3 starts
      --      v_flow_status_code                  VARCHAR2(100) := null;
      --      v_line_number                       NUMBER        := NULL;
      --      v_shipment_number                   NUMBER        := NULL;
      --      v_option_number                     NUMBER        := NULL;
      --      v_component_number                  NUMBER        := NULL;
      --      v_service_number                    NUMBER       := NULL;
      --v1.3 ends
      --      v_model_string                      VARCHAR2(100) := NULL;
      --      v_end_cust                          NUMBER := NULL;
      --      v_end_cust_site_id                  NUMBER := NULL;
      --      v_location_type_code                VARCHAR2(100) := null;
      --      v_location_id                       NUMBER := NULL;
      --      v_tag                               VARCHAR2(100) := NULL;
      --      v_inventory_item_status             VARCHAR2(100) := NULL;
      --      v_serial_number                     VARCHAR2(100) := NULL;
      --      v_serial_return                     VARCHAR2(200) := NULL;
      --rec_ext_attr      Rec_Ext_Attr_type ;
      v_ret_error_message VARCHAR2(2000):= NULL;
      v_ret_error_flag    VARCHAR2(1)   := NULL;
      v_error_message     VARCHAR2(2000):= NULL;
      v_error_flag        VARCHAR2(1)   := NULL;
      v_error_at          VARCHAR2(100) := NULL;
      --        v_to1                               DATE   := sysdate;
      --        v_from1                             DATE   := sysdate-45;
      tab_ib_parent_dat tab_typ_ib_parent_dat;
      tab_ib_ecs_dat tab_typ_ib_ecs_dat;
      tab_ib_ecs_dat_c tab_typ_ib_ecs_dat;
    BEGIN
      print_log('*********************************************************************');
      print_log('print log message 01');
      print_log('Process Starts... : '||to_date(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
      v_error_at := 'Start of the process';
      fnd_client_info.set_org_context(i_org_id);
      --  v1.2 begins, to get from date ----==----
      BEGIN
        print_log('print log message 02');
        --OPEN  get_from_date( v_request_id,v_conc_prog_id);
        --FETCH get_from_date INTO   v_from;
        --CLOSE get_from_date;
        v_error_at := 'main Process/ before from ';
        --        v_from := Sysdate-15;
        v_from := SYSDATE-45;
        --Added v1.4 ,AND    ARGUMENT1 = i_org_id
        SELECT
          /*+ index(a FND_CONCURRENT_REQUESTS_N6) index(a FND_CONCURRENT_REQUESTS_N7)*/
          requested_start_date BULK COLLECT
        INTO tbl_req_start_date
        FROM fnd_concurrent_requests
        WHERE request_id            < v_request_id
        AND concurrent_program_id   = v_conc_prog_id
        AND argument1               = i_org_id
        AND status_code             ='C'
        AND phase_code              ='C';
        v_error_at                 := 'main Process/ after from selection ';
        IF tbl_req_start_date.count >0 THEN
          FOR i                    IN tbl_req_start_date.FIRST .. tbl_req_start_date.LAST
          LOOP
            IF v_from < tbl_req_start_date(i) THEN
              v_from := tbl_req_start_date(i);
              print_log( 'Tabel Req StartDate : '||tbl_req_start_date(i));
              print_log( 'In the Loop VFrom : '||v_from);
            END IF;
          END LOOP;
        END IF;
        v_error_at := 'main Process/ after from Loop ';
        print_log( 'Out the loop v_from is : '||v_from);
      EXCEPTION
      WHEN no_data_found THEN
        print_log('Error in  from_date process exception : '||sqlerrm);
        print_log('Error at : '||v_error_at);
        v_from := NULL;
      WHEN OTHERS THEN
        print_log('Error in  from_date process exception : '||sqlerrm);
        print_log('Error at : '||v_error_at);
        v_from := NULL;
      END;
      -- v1.2 ends---==----
      print_log('print log message 03');
      BEGIN
        OPEN cur_get_to_date ( v_request_id,v_conc_prog_id);
        FETCH cur_get_to_date INTO v_to;
        CLOSE cur_get_to_date;
        --v1.3 starts
        v_update_date := v_to -(1/86400);
        --v1.3 ends
        v_error_at := 'main Process/ after from and to date';
        print_log('v_from1... : '||TO_CHAR(v_from,'DD-MON-YYYY HH24:MI:SS'));
        print_log('v_to1  ... : '||TO_CHAR(v_to ,'DD-MON-YYYY HH24:MI:SS'));
        --v1.3 starts
        print_log('Updated v_to  ... : '||TO_CHAR(v_update_date ,'DD-MON-YYYY HH24:MI:SS'));
        --v1.3 ends
      EXCEPTION
      WHEN no_data_found THEN
        print_log('Error in  main process1 : '||sqlerrm);
        print_log('Error at : '||v_error_at);
      WHEN OTHERS THEN
        print_log('Error in  main process1 : '||sqlerrm);
        print_log('Error at : '||v_error_at);
      END;
      BEGIN
        print_log('print log message 04');
        OPEN cur_get_parent_ib_rec(v_from ,v_to);
        LOOP
          print_log('After Loop Get Records v_from... : '||TO_CHAR(v_from,'DD-MON-YYYY HH24:MI:SS'));
          print_log('After Loop Get Records v_to  ... : '||TO_CHAR(v_to ,'DD-MON-YYYY HH24:MI:SS'));
          FETCH cur_get_parent_ib_rec BULK COLLECT INTO tab_ib_parent_dat;
          print_log('Parent Instance first : ');
          --  FOR i IN 1 .. tab_ib_parent_dat.COUNT
          print_log('print log message 05');
          FOR i IN tab_ib_parent_dat.FIRST .. tab_ib_parent_dat.LAST
          LOOP
            BEGIN
              print_log('Parent Instance : '||tab_ib_parent_dat(i).instance_id);
              print_log('====================================================================');
              v_error_at       := 'main Process/ start of the loop';
              v_ret_error_flag := NULL;
              v_segment1       := NULL;
            EXCEPTION
            WHEN no_data_found THEN
              print_log('Error in  main process exception1 : '||sqlerrm);
              print_log('Error at : '||v_error_at);
            WHEN OTHERS THEN
              print_log('Error in  main process exception1 : '||sqlerrm);
              print_log('Error at : '||v_error_at);
            END;
            OPEN cur_get_outbound_data(tab_ib_parent_dat(i).instance_id);
            LOOP
              FETCH cur_get_outbound_data BULK COLLECT INTO tab_ib_ecs_dat;
              --FOR j IN 1 .. tab_ib_ecs_dat.COUNT
              FOR j IN tab_ib_ecs_dat.FIRST .. tab_ib_ecs_dat.LAST
              LOOP
                BEGIN
                BEGIN
                     SELECT COUNT(1)
                      INTO v_count
                      FROM apps.xxcsi_trex_ob_ecs_mhm
                      WHERE instance_id  = NVL(tab_ib_ecs_dat_c(j).instance_id,'');
                    EXCEPTION
                    WHEN OTHERS THEN
                      v_count := 0;
                    END;
                    print_log('v_count : '||v_count);
                    IF v_count = 0 THEN
                  --        print_log('PARENT_DAT: '||NVL(tab_ib_ecs_dat(j).instance_id);
            print_log('print log message 06');
                  INSERT
                  INTO xxcsi_trex_ob_ecs_mhm
                      instance_id,
                      instance_number,
                      inventory_item_id,
                      unit,
                      unit_name,
                      master_organization_id,
                      serial_number,
                      quantity,
                      uom,
                      active_start_date,
                      active_end_date,
                      install_date,
                      object_version_number,
                      last_vld_organization_id,
                      pre_registration_location,
                      order_header_id,
                      order_number,
                      order_line_id,
                      pre_registration_date,
                      pre_registration_operator,
                      bill_to_customer_name,
                      bill_to_site_id ,
                      bill_to_state ,
                      bill_to_country ,
                      bill_to_city ,
                      bill_to_location ,
                      ship_to_customer_name,
                      ship_to_site_id ,
                      ship_to_state ,
                      ship_to_country ,
                      ship_to_city ,
                      ship_to_location,
                      ship_to_pin_code,
                      bill_to_pin_code,
                      ship_to_number,
                      bill_to_number,
                      customer_number,
                      ea_license_number,
                      ea_va_sales_order_number,
                      parent_instance_id,
                      parent_y_n,
                      process_flag,
                      error_code,
                      error_details,
                      request_id,
                      created_by,
                      creation_date,
                      last_updated_by,
                      last_update_date,
                      last_update_login,
                      eai_process_flag,
                      master_organization_name,
                      system_id,
                      system_name
                    VALUES
                      NVL(tab_ib_ecs_dat(j).instance_id,''),
                      NVL(tab_ib_ecs_dat(j).instance_number,''),
                      NVL(tab_ib_ecs_dat(j).inventory_item_id,''),
                      NVL(tab_ib_ecs_dat(j).segment1,''),
                      NVL(tab_ib_ecs_dat(j).description,''),
                      NVL(tab_ib_ecs_dat(j).master_organization_id,''),
                      NVL(tab_ib_ecs_dat(j).serial_number,''),
                      NVL(tab_ib_ecs_dat(j).quantity,''),
                      NVL(tab_ib_ecs_dat(j).uom,''),
                      NVL(tab_ib_ecs_dat(j).active_start_date,''),
                      NVL(tab_ib_ecs_dat(j).active_end_date,''),
                      NVL(tab_ib_ecs_dat(j).install_date,''),
                      NVL(tab_ib_ecs_dat(j).obj_version_num,''),
                      NVL(tab_ib_ecs_dat(j).last_vld_organization_id,''),
                      NVL(tab_ib_ecs_dat(j).pre_registration_location,''),
                      NVL(tab_ib_ecs_dat(j).order_header_id,''),
                      NVL(tab_ib_ecs_dat(j).order_number,''),
                      NVL(tab_ib_ecs_dat(j).order_line_id,''),
                      NVL(tab_ib_ecs_dat(j).actual_shipment_date,''),
                      NVL(tab_ib_ecs_dat(j).email_address,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_company_name,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_site_id,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_state,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_country,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_city,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_location,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_company_name,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_site_id,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_state,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_country,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_city,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_location,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_pin_code,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_pin_code,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_number,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_number,''),
                      NVL(tab_ib_ecs_dat(j).customer_number,''),
                      NVL(tab_ib_ecs_dat(j).ea_license_number,''),
                      NVL(tab_ib_ecs_dat(j).ea_va_sales_order_num,''),
                      NULL,
                      'P',
                      'N',
                      NULL,
                      NULL,
                      v_request_id,
                      v_created_by,
                      SYSDATE,
                      v_created_by,
                      SYSDATE,
                      v_last_update_login,
                      'N',
                      NVL(tab_ib_ecs_dat(j).master_organization_name,''),
                      NVL(tab_ib_ecs_dat(j).system_id,''),
                      NVL(tab_ib_ecs_dat(j).system_name,'')
    ELSE
    Update apps.xxcsi_trex_ob_ecs_mhm set 
                    instance_id=NVL(tab_ib_ecs_dat_c(j).instance_id,''),
      instance_number= NVL(tab_ib_ecs_dat_c(j).instance_number,''),
                    inventory_item_id= NVL(tab_ib_ecs_dat_c(j).inventory_item_id,''),
                    unit      = NVL(tab_ib_ecs_dat_c(j).segment1,''),
                    unit_name =  NVL(tab_ib_ecs_dat_c(j).description,''),
                    master_organization_id=NVL(tab_ib_ecs_dat_c(j).master_organization_id,''),
                    --serial_number=NVL(tab_ib_ecs_dat_c(j).serial_number,''),
                    quantity= NVL(tab_ib_ecs_dat_c(j).quantity,''),
                    uom=NVL(tab_ib_ecs_dat_c(j).uom,''),
                    active_start_date= NVL(tab_ib_ecs_dat_c(j).active_start_date,''),
                    active_end_date= NVL(tab_ib_ecs_dat_c(j).active_end_date,''),
                    install_date= NVL(tab_ib_ecs_dat_c(j).install_date,''),
                    object_version_number=NVL(tab_ib_ecs_dat_c(j).obj_version_num,''),
                    last_vld_organization_id= NVL(tab_ib_ecs_dat_c(j).last_vld_organization_id,''),
                    pre_registration_location=NVL(tab_ib_ecs_dat_c(j).pre_registration_location,''),
                    order_header_id=NVL(tab_ib_ecs_dat_c(j).order_header_id,''),
                    order_number= NVL(tab_ib_ecs_dat_c(j).order_number,''),
                    order_line_id=NVL(tab_ib_ecs_dat_c(j).order_line_id,''),
                    pre_registration_date= NVL(tab_ib_ecs_dat_c(j).actual_shipment_date,''),
                    pre_registration_operator= NVL(tab_ib_ecs_dat_c(j).email_address,''),
                    bill_to_customer_name=NVL(tab_ib_ecs_dat_c(j).bill_to_company_name,''),
                    bill_to_site_id = NVL(tab_ib_ecs_dat_c(j).bill_to_site_id,''),
                    bill_to_state = NVL(tab_ib_ecs_dat_c(j).bill_to_state,''),
                    bill_to_country =NVL(tab_ib_ecs_dat_c(j).bill_to_country,''),
                    bill_to_city = NVL(tab_ib_ecs_dat_c(j).bill_to_city,''),
                    bill_to_location =  NVL(tab_ib_ecs_dat_c(j).bill_to_location,''),
                    ship_to_customer_name=NVL(tab_ib_ecs_dat_c(j).ship_to_company_name,''),
                    ship_to_site_id = NVL(tab_ib_ecs_dat_c(j).ship_to_site_id,''),
                    ship_to_state =NVL(tab_ib_ecs_dat_c(j).ship_to_state,''),
                    ship_to_country=NVL(tab_ib_ecs_dat_c(j).ship_to_country,''),
                    ship_to_city =NVL(tab_ib_ecs_dat_c(j).ship_to_city,''),
                    ship_to_location= NVL(tab_ib_ecs_dat_c(j).ship_to_location,''),
      ship_to_pin_code= NVL(tab_ib_ecs_dat_c(j).ship_to_pin_code,''),
      bill_to_pin_code=NVL(tab_ib_ecs_dat_c(j).bill_to_pin_code,''),
      ship_to_number=NVL(tab_ib_ecs_dat_c(j).ship_to_number,''),
      bill_to_number= NVL(tab_ib_ecs_dat_c(j).bill_to_number,''),
      customer_number= NVL(tab_ib_ecs_dat_c(j).customer_number,''),
      ea_license_number= NVL(tab_ib_ecs_dat_c(j).ea_license_number,''),
      ea_va_sales_order_number= NVL(tab_ib_ecs_dat_c(j).ea_va_sales_order_num,''),
      parent_instance_id=NVL(tab_ib_parent_dat(i).instance_id,''),
      parent_y_n='C',
      process_flag='N',
      error_code= NULL,
      error_details= NULL,
      request_id=v_request_id,
      created_by=v_created_by,
      creation_date= SYSDATE,
      last_updated_by=v_created_by,
      last_update_date=SYSDATE,
      last_update_login= v_last_update_login,
      eai_process_flag='Y',
      master_organization_name=NVL(tab_ib_ecs_dat_c(j).master_organization_name,''),
      system_id= NVL(tab_ib_ecs_dat_c(j).system_id,''),
      system_name= NVL(tab_ib_ecs_dat_c(j).system_name,'')
      WHERE instance_id  = NVL(tab_ib_ecs_dat_c(j).instance_id,'');
      END IF; --V_COUNT
                EXCEPTION
                WHEN no_data_found THEN
                  print_log('Error in inserting Parent Instance : '||tab_ib_ecs_dat(j).instance_id||': '||sqlerrm);
                WHEN OTHERS THEN
                  print_log('Error in inserting Parent Instance : '||tab_ib_ecs_dat(j).instance_id||': '||sqlerrm);
                END;
                --      END LOOP;
              END LOOP;
              EXIT
            WHEN cur_get_outbound_data%notfound;
            END LOOP;
            CLOSE cur_get_outbound_data;
            print_log('print log message 07');
            BEGIN
              FOR rec_get_child_ib_rec IN cur_get_child_ib_rec
                tab_ib_parent_dat(i).instance_id
              LOOP
                print_log
                  'cur_get_child_ib_rec : '||tab_ib_parent_dat(i).instance_id
                OPEN cur_get_outbound_data(rec_get_child_ib_rec.subject_id);
                LOOP
                  FETCH cur_get_outbound_data BULK COLLECT INTO tab_ib_ecs_dat_c;
                  --            tab_ib_ecs_dat_c1 := tab_ib_ecs_dat_c;
                  --            FOR k IN 1 .. tab_ib_ecs_dat_c.COUNT
                  FOR k IN tab_ib_ecs_dat_c.FIRST .. tab_ib_ecs_dat_c.LAST
                  LOOP
                    print_log('Child Instance : '||tab_ib_ecs_dat_c(k).instance_id);
                    --        BEGIN
                    BEGIN
                      SELECT COUNT(1)
                      INTO v_count
                      FROM apps.xxcsi_trex_ob_ecs_mhm
                      WHERE instance_id  = NVL(tab_ib_ecs_dat_c(k).instance_id,'');
                    EXCEPTION
                    WHEN OTHERS THEN
                      v_count := 0;
                    END;
                    print_log('v_count : '||v_count);
                    IF v_count = 0 THEN
                      BEGIN
                        INSERT
                        INTO xxcsi_trex_ob_ecs_mhm
                            instance_id,
                            instance_number,
                            inventory_item_id,
                            unit,
                            unit_name,
                            master_organization_id,
                            serial_number,
                            quantity,
                            uom,
                            active_start_date,
                            active_end_date,
                            install_date,
                            object_version_number,
                            last_vld_organization_id,
                            pre_registration_location,
                            order_header_id,
                            order_number,
                            order_line_id,
                            pre_registration_date,
                            pre_registration_operator,
                            bill_to_customer_name,
                            bill_to_site_id ,
                            bill_to_state ,
                            bill_to_country ,
                            bill_to_city ,
                            bill_to_location ,
                            ship_to_customer_name,
                            ship_to_site_id ,
                            ship_to_state ,
                            ship_to_country ,
                            ship_to_city ,
                            ship_to_location ,
                            ship_to_pin_code,
                            bill_to_pin_code,
                            ship_to_number,
                            bill_to_number,
                            customer_number,
                            ea_license_number,
                            ea_va_sales_order_number,
                            parent_instance_id,
                            parent_y_n,
                            process_flag,
                            error_code,
                            error_details,
                            request_id,
                            created_by,
                            creation_date,
                            last_updated_by,
                            last_update_date,
                            last_update_login,
                            eai_process_flag,
                            master_organization_name,
                            system_id,
                            system_name
                          VALUES
                            NVL(tab_ib_ecs_dat_c(k).instance_id,''),
                            NVL(tab_ib_ecs_dat_c(k).instance_number,''),
                            NVL(tab_ib_ecs_dat_c(k).inventory_item_id,''),
                            NVL(tab_ib_ecs_dat_c(k).segment1,''),
                            NVL(tab_ib_ecs_dat_c(k).description,''),
                            NVL(tab_ib_ecs_dat_c(k).master_organization_id,''),
                            NVL(tab_ib_ecs_dat_c(k).serial_number,''),
                            NVL(tab_ib_ecs_dat_c(k).quantity,''),
                            NVL(tab_ib_ecs_dat_c(k).uom,''),
                            NVL(tab_ib_ecs_dat_c(k).active_start_date,''),
                            NVL(tab_ib_ecs_dat_c(k).active_end_date,''),
                            NVL(tab_ib_ecs_dat_c(k).install_date,''),
                            NVL(tab_ib_ecs_dat_c(k).obj_version_num,''),
                            NVL(tab_ib_ecs_dat_c(k).last_vld_organization_id,''),
                            NVL(tab_ib_ecs_dat_c(k).pre_registration_location,''),
                            NVL(tab_ib_ecs_dat_c(k).order_header_id,''),
                            NVL(tab_ib_ecs_dat_c(k).order_number,''),
                            NVL(tab_ib_ecs_dat_c(k).order_line_id,''),
                            NVL(tab_ib_ecs_dat_c(k).actual_shipment_date,''),
                            NVL(tab_ib_ecs_dat_c(k).email_address,''),
                            NVL(tab_ib_ecs_dat_c(k).bill_to_company_name,''),
                            NVL(tab_ib_ecs_dat_c(k).bill_to_site_id,''),
                            NVL(tab_ib_ecs_dat_c(k).bill_to_state,''),
                            NVL(tab_ib_ecs_dat_c(k).bill_to_coun

    The logic is:
    1. Create any new lookup table rows that may be needed
    2. Create new data rows that reference the lookup table
    All you did was post a buch of code. You didn't post ANYTHING that shows how you executed that code or what the result was.
    You need to SHOW US (not tell us):
    1. WHAT you do
    2. HOW you do it
    3. WHAT results you get
    4. WHAT results you expected to get
    The code you posted has some SERIOUS ISSUES. Here are just three of them
    1. You are using BULK COLLECT without a LIMIT clause
    2. You are using unnecessary IF . . .COUNT statements to test collections for values. The FOR clause will simply NOT execute if the collection is empty so the IF statements add unnecessary clutter.
    3. The first loop iterates a collection but sets a single SCALAR value - making that loop totally USELESS
    LOOP
            IF v_from < tbl_req_start_date(i) THEN
              v_from := tbl_req_start_date(i);
              print_log( 'Tabel Req StartDate : '||tbl_req_start_date(i));
              print_log( 'In the Loop VFrom : '||v_from);
            END IF;
          END LOOP;
    That checks EVERY row in the collection and appears to save the MAX value of 'tbl_req_state_date' into the 'v_from' variable.
    What is the point of that?

  • Need to insert values into a table from a XML file

    Hi,
    I'm an Oracle 9i/10g DBA with quite a few years experience, but I'm new to XML and dealing with it in database terms. I've been given a project that entails pulling XML values out of a file (or 100's of them) and storing them in the database so that they are searchable by end-users. The project is classified as secret so I'm unable to upload the specific XML or any info relating to the structire of the XML or the table I will use to insert the values into - sorry!! So, I've created an XML file with a similar structure to help people understand my predicament.
    The end-users only need to search on a subset of the total amount of columns from the table I'll insert data into, although the XML file has a lot more, so I dont need to store the other values - but I will need to store the name of the XML file (or a pointer to it so I know what XML file a particular set of values belong to) in another column of the table along with its associated values.
    I've been using the XMLTABLE function with some degree of success, although I had better succes using the XMLSEQUENCE function. However, I found out this is deprecated in 10g and replaced with XMLTABLE, so I guess it's better if I use this in case we ever need to upgrade to 11g.
    The main problem I've been having is that some elements in the XML files have multiple values for the one record when all the other records are the same. In terms of storing this in the database, I guess it would mean inserting multiple rows in the table for each element where the value differs. Here is a dumbed down XML file similar to what I've got along with the other SQL I've used:
    +<?xml version="1.0" encoding="UTF-8"?>+
    +<House>+
    +<Warehouse>+
    +<WarehouseId>1</WarehouseId>+
    +<WarehouseName>+
    +<Town>Southlake</Town>+
    +<State>Texas</State>+
    +</WarehouseName>+
    +<Building>Owned</Building>+
    +<Area>25000</Area>+
    +<Docks>2</Docks>+
    +<DockType>Rear load</DockType>+
    +<WaterAccess>true</WaterAccess>+
    +<RailAccess>N</RailAccess>+
    +<Parking>Street</Parking>+
    +<VClearance>10</VClearance>+
    +</Warehouse>+
    +<Warehouse>+
    +<WarehouseId>2</WarehouseId>+
    +<WarehouseName>+
    +<Town>Poole</Town>+
    +<State>Dorset</State>+
    +</WarehouseName>+
    +<WarehouseName>+
    +<Town>Solihull</Town>+
    +<County>West Midlands</State>+
    +</WarehouseName>+
    +<Building>Owned</Building>+
    +<Area>40000</Area>+
    +<Docks>5</Docks>+
    +<DockType>Rear load</DockType>+
    +<WaterAccess>true</WaterAccess>+
    +<RailAccess>N</RailAccess>+
    +<Parking>Bay</Parking>+
    +<VClearance>10</VClearance>+
    +</Warehouse>+
    +<Warehouse>+
    +<WarehouseId>3</WarehouseId>+
    +<WarehouseName>+
    +<Town>Fleet</Town>+
    +<County>Hampshire</County>+
    +</WarehouseName>+
    +<Building>Owned</Building>+
    +<Area>10000</Area>+
    +<Docks>1</Docks>+
    +<DockType>Side load</DockType>+
    +<WaterAccess>false</WaterAccess>+
    +<RailAccess>N</RailAccess>+
    +<Parking>Bay</Parking>+
    +<VClearance>20</VClearance>+
    +</Warehouse>+
    +</House>+
    CREATE TABLE xmltest OF XMLTYPE;
    INSERT INTO xmltest
    VALUES(xmltype(bfilename('XML_DIR', 'test.xml'), nls_charset_id('AL32UTF8')));
    Consequently, I need to...
    1) Retrieve the results from the XML file for all 3 warehouses where multiple values for the same sub-element are shown as 2 rowsthe result set. (I am guessing there will be 4 rows returned as warehouse sub-2 has 2 different elements for <WarehouseName>.
    2) Build a case statement into the query so that regardless of the sub-element name (i.e State or County), it is returned into the 1 column, for instance County.
    So, if I run a query similar to the following...
    select y.WarehouseId, y.Town, y.County, y.Area
    from xmltest x, xmltable('/House/Warehouse' .......
    I would like to get results back like this...
    ID Town County Area
    1 Southlake Texas 25000
    2 Poole Dorset 40000
    2 Solihull West Midlands 40000
    3 Fleet hampshire 10000
    Sorry for the non-formatting but I hope this all makessense to someone out there with what I'm trying to do.
    I appreciate any help whatsoever because, as i said before, I'm totally new to XML and trying to read the vast amount of information there is out there on XML is all a bit daunting.
    Many thanks in advance,
    Shaun.

    Hi again,
    Thanks for keeping the post open for me. I've had a look at the post illustrating the XFileHandler package, and tried to alter it to make it fit with my XML files. To help explain things, my XML file looks like this:
    <?xml version="1.0"?>
    <!DOCTYPE  CMF_Doc SYSTEM "CMF_Doc.dtd">
    <House>
        <Warehouse>
        <WarehouseId>1</WarehouseId>
        <WarehouseName>
           <Town>Southlake</Town>
           <State>Texas</State>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>25000</Area>
        <Docks>2</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Street</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>House
        <WarehouseId>2</WarehouseId>
        <WarehouseName>
           <Town>Poole</Town>
           <State>Dorset</State>
        </WarehouseName>
        <WarehouseName>
           <Town>Solihull</Town>
           <County>West Midlands</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>40000</Area>
        <Docks>5</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>3</WarehouseId>
        <WarehouseName>
           <Town>Fleet</Town>
           <County>Hampshire</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>10000</Area>
        <Docks>1</Docks>
        <DockType>Side load</DockType>
        <WaterAccess>false</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>20</VClearance>
      </Warehouse>
    </House>
    <?xml version="1.0" encoding="UTF-8"?>
    <House>
        <Warehouse>
        <WarehouseId>4</WarehouseId>
        <WarehouseName>
           <Town>Dallas</Town>
           <State>Texas</State>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>25000</Area>
        <Docks>2</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Street</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>5</WarehouseId>
        <WarehouseName>
           <Town>Dorchester</Town>
           <State>Dorset</State>
        </WarehouseName>
        <WarehouseName>
           <Town>Solihull</Town>
           <County>West Midlands</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>40000</Area>
        <Docks>5</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>6</WarehouseId>
        <WarehouseName>
           <Town>Farnborough</Town>
           <County>Hampshire</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>10000</Area>
        <Docks>1</Docks>
        <DockType>Side load</DockType>
        <WaterAccess>false</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>20</VClearance>
      </Warehouse>
    </House>
    <?xml version="1.0" encoding="UTF-8"?>
    <House>
        <Warehouse>
        <WarehouseId>7</WarehouseId>
        <WarehouseName>
           <Town>Southlake</Town>
           <State>Texas</State>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>25000</Area>
        <Docks>2</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Street</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>8</WarehouseId>
        <WarehouseName>
           <Town>Bournemouth</Town>
           <State>Dorset</State>
        </WarehouseName>
        <WarehouseName>
           <Town>Shirley</Town>
           <County>West Midlands</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>30000</Area>
        <Docks>5</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>9</WarehouseId>
        <WarehouseName>
           <Town>Clapham</Town>
           <County>London</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>10000</Area>
        <Docks>1</Docks>
        <DockType>Side load</DockType>
        <WaterAccess>false</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>20</VClearance>
      </Warehouse>
    </House>And the XFilehandler package looks like this (I'm just trying to do a simple select only on WarehouseId & WaterAccess for the time being to keep things simple):
    create or replace package XFileHandler as
      TYPE TRECORD IS RECORD (
        WID     NUMBER(2)
      , WACCESS VARCHAR2(5)
      type TRecordTable is table of TRecord;
      function getRows (p_directory in varchar2, p_filename in varchar2) return TRecordTable pipelined;
    end;
    create or replace package body XFileHandler is
      function getRows (p_directory in varchar2, p_filename in varchar2)
       return TRecordTable pipelined
      is
        nb_rec          number := 1;
        tmp_xml        clob;
        tmp_file         clob;
        rec               TRecord;
      begin
        DBMS_LOB.CREATETEMPORARY(TMP_FILE, TRUE);
        tmp_file := dbms_xslprocessor.read2clob(p_directory, p_filename);
        LOOP
          tmp_xml := regexp_substr(tmp_file, '<\?xml[^?]+\?>\s*<([^>]+)>.*?</\1>', 1, nb_rec, 'n');
          exit when length(tmp_xml) = 0;
          --dbms_output.put_line(tmp_rec);
          nb_rec := nb_rec + 1;
        select y.WID, y.WACCESS
        into rec.WID, rec.WACCESS
        from xmltable('/House' passing xmltype(tmp_xml)
                      columns WID NUMBER(2) PATH 'Warehouse/WarehouseId',
                                  WACCESS VARCHAR2(5) PATH 'WaterAccess') y;
          pipe row ( rec );
        end loop;
        dbms_lob.freetemporary(tmp_file);
        return;
      end;
    end;Now, when I run the query:
    select * from table(XFileHandler.getRows('XML_DIR', 'XFileHandler_test.xml'));I get the error: ORA-00600: internal error code, arguments: [17285], [0x5CFE8DC8], [4], [0x45ABE1C8], [], [], [], []
    I had a look in the dump file for anything obvious, but nothing really stands out. Is there anything obvious in my code that I'm missing or something else which you may think could be causing this error, e.g in the regular expression regexp_substr?
    Many thanks,
    Shaun.

Maybe you are looking for

  • Soa Suite 11g DbAdapter invocation error message

    Hi All, Morning,...We are trying to make connection to Oracle 11g database using Db adapter in Soa 11g but getting this error message during invocation : Database platform org.eclipse.persistence.platform.database.Database Platform is not supported .

  • Very new to Flash

    Hi all. I am very very new to Flash, been thinking about usig it for all of a day! I have to come up with a website and the general idea is that a lot of 3D is to be used. Although I have been heavily involved in 3D for 14 years now, web development

  • Default Setting for Searching in Acrobat 6 - Please Help!

    Hello. We are in a bit of a bind and hoping someone can help us out. We need to know if there is any way possible to change the default setting for Searching in Acrobat 6.0 from "MATCH EXACT WORD OR PHRASE" to "MATCH ANY OF THE WORDS". We know this f

  • Transpod fails to play media HELP!!!

    I received a Transpod (ipod automobile dock) as a gift, it worked properly for a few days but then began to give me problems. Transpod is used to charge and play ones iopd while in a car. Assuming I was given a faulty one..I tried my transpod in othe

  • How to recreate the relation?

    Help me. How to recreate? kanish