Merge for bulk data

Hi all,
I want to insert bulk data from external table to database ..Program compiled successfully bt after executing the data doesn't insert to database..plz help me..
External table:-bck_hotel
HOTEL_CODE     NUMBER
HOTEL_NAME     VARCHAR2(100)
HOTEL_TYPE     VARCHAR2(100)
HOTEL_ADDRESS VARCHAR2(100)
HOTEL_NUMBER     NUMBER
HOTEL_FACILITY     VARCHAR2(100)
HOTEL1     VARCHAR2(100)
LATITUDE     NUMBER
LONGITUDE     NUMBER
Database table:-hotel
HOTEL_CODE     NUMBER
HOTEL_NAME     VARCHAR2(100)
HOTEL_TYPE     VARCHAR2(100)
HOTEL_ADDRESS     VARCHAR2(100)
HOTEL_NUMBER     NUMBER
HOTEL_FACILITY      VARCHAR2(100)
Code:
CURSOR cur_hotels IS
SELECT hotel_code, hotel_name, hotel_type, hotel_address, hotel_number,
hotel_facility
FROM bck_hotels;
BEGIN
OPEN cur_hotels;
LOOP
FETCH cur_hotels BULK COLLECT
INTO v_hotel_code, v_hotel_name, v_hotel_type, v_hotel_address, v_hotel_number, v_hotel_facility LIMIT 1000;
FORALL i IN 1 .. v_hotel_code.COUNT MERGE INTO hotels tgt USING (
SELECT v_hotel_code(i) AS hotel_code, v_hotel_name(i) AS hotel_name,
v_hotel_type(i) AS hotel_type,
v_hotel_address(i) AS hotel_address,
v_hotel_number(i) AS hotel_number,
v_hotel_facility(i) AS hotel_facility
FROM dual) src
ON (src.hotel_code = tgt.hotel_code)
WHEN MATCHED THEN UPDATE SET
tgt.hotel_name = src.hotel_name, tgt.hotel_type = src.hotel_type, tgt.hotel_address = src.hotel_address, tgt.hotel_number = src.hotel_number, tgt.hotel_facility = src.hotel_facility
WHEN NOT MATCHED THEN
INSERT(tgt.hotel_code, tgt.hotel_name, tgt.hotel_type, tgt.hotel_address, tgt.hotel_number, tgt.hotel_facility)
VALUES(src.hotel_code, src.hotel_name, src.hotel_type, src.hotel_address, src.hotel_number, src.hotel_facility);

Hello,
I wonder why are you using Bulk Collect, when the same can be accomplished by a simple Merge statement.
Below can help:
MERGE INTO hotels tgt USING
(SELECT hotel_code,
  hotel_name,
  hotel_type,
  hotel_address,
  hotel_number,
  hotel_facility
FROM bck_hotel
) src ON (src.hotel_code = tgt.hotel_code)
WHEN MATCHED THEN
  UPDATE
  SET tgt.hotel_name   = src.hotel_name,
    tgt.hotel_type     = src.hotel_type,
    tgt.hotel_address  = src.hotel_address,
    tgt.hotel_number   = src.hotel_number,
    tgt.hotel_facility = src.hotel_facility WHEN NOT MATCHED THEN
  INSERT
      tgt.hotel_code,
      tgt.hotel_name,
      tgt.hotel_type,
      tgt.hotel_address,
      tgt.hotel_number,
      tgt.hotel_facility
    VALUES
      src.hotel_code,
      src.hotel_name,
      src.hotel_type,
      src.hotel_address,
      src.hotel_number,
      src.hotel_facility
    );Is it not true?
Regards,
P.

Similar Messages

  • Optimization for bulk data upload

    Hi everyone!
    I've got the following issue:
    I have to do a bulk data upload using JMS deploy in a glassfish 2.1, to process and validate data in a Oracle 10g DB System before it is insert.
    I have my web interface that loads a file and then delegates the process to a Stateless Session Bean which read a N number of lines and after that send a message to a JMS Queue. The JMS has to parse the each line, validate them with the data already in the DB, and finally persist the new data.
    This process is high process consuming, and I need to improve the performance time. I tried to change glassfish default JMS and JDBC pool size, but I have no a huge difference.
    Do you have any advice that could help me?
    Thanks in advance!

    Hi! thank you for you answer!
    High process consuming is in the MDB
    I'm grouping each N number of read lines in the EJB and then send the message to the JMS. The MDB process the persists each line as info in different related tables.
    Thanks again!

  • Clob is not working for bulk data files in PL/SQL XML program

    Hi Odie,
    we took your help to fix the our issue before
    "https://forums.oracle.com/forums/thread.jspa?threadID=2238458&tstart=105"
    working fine for : program is working for smaller size data.
    Issue : now we have problem with the largr size data .
    getting the below error:
    Arguments
    P_dir_name='/tmp'
    P_file_name='CCBGO.COLO_CNG.RESPONSES.20120802.00054131826'
    Environment will now switch to UTF-8 code-set.
    Parts of this log file may not display correctly
    as a result. This is an expected behavior.
    XML_REPORTS_XENVIRONMENT is :
    /apps/applmgr/product/OFDEV/ofdevora/806/guicommon6/tk60/admin/Tk2Motif_UTF8.rgb
    XENVIRONMENT is set to /apps/applmgr/product/OFDEV/ofdevora/806/guicommon6/tk60/admin/Tk2Motif_UTF8.rgb
    Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
    American_America.UTF8
    stat_low = 8B
    stat_high = 0
    emsg:was terminated by signal 11
    Appreciated for your earlier support.
    Kindly suggest .
    Many Thanks,
    Ramesh.

    Thanks ALex,
    your are true it is concurrent program error ,
    but it is working for small amount of data and generating the output and it is not working for larger data.
    i have placed the code which i have used kindly suggest where i am going wrong.
    i am calling the .rdf through the concurrent program, i've used the below query in RDF
    select
    BATCHHEADER
    ,BATCHTRAILER
    ,RqUID
    ,Severity
    ,PmtRefId
    ,StatusDesc
    ,ErrorDesc
    ,AsOfDate
    ,AsOfTime
    ,RqUID1
    ,SPRefId
    from table(CL_CXFRFXFH_PKG.rcacknowledgments(:P_dir_name,:P_file_name));
    kindly find the below code for the package CL_CXFRFXFH_PKG.
    ==========================
    CREATE OR REPLACE package body APPS.CL_CXFRFXFH_PKG is
    function rcacknowledgments (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);
    rec.BATCHHEADER := regexp_replace(tmp_file, '.*<BATCHHEADER>(.*)</BATCHHEADER>.*', '\1', 1, 1, 'n');
    rec.BATCHTRAILER := regexp_replace(tmp_file, '.*<BATCHTRAILER>(.*)</BATCHTRAILER>.*', '\1', 1, 1, 'n');
    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 RqUID, Severity, PmtRefId, StatusDesc, ErrorDesc, AsOfDate, AsOfTime, RqUID1, SPRefId
    into rec.RqUID
    , rec.Severity
    , rec.PmtRefId
    , rec.StatusDesc
    , rec.ErrorDesc
    , rec.AsOfDate
    , rec.AsOfTime
    , rec.RqUID1
    , rec.SPRefId
    from xmltable(
    '/CMA/BankSvcRq' passing xmltype(tmp_xml)
    columns RqUID varchar2(3000) path 'RqUID'
    , Severity varchar2(3000) path 'XferAddRs/Status/Severity'
    , PmtRefId varchar2(3000) path 'XferAddRs/Status/PmtRefId'
    , StatusDesc varchar2(3000) path 'XferAddRs/Status/StatusDesc'
    , ErrorDesc varchar2(3000) path 'XferAddRs/Status/ErrorDesc'
    , AsOfDate varchar2(3000) path 'XferAddRs/Status/AsOfDate'
    , AsOfTime varchar2(3000) path 'XferAddRs/Status/AsOfTime'
    , RqUID1 varchar2(3000) path 'XferAddRs/RqUID'
    , SPRefId varchar2(3000) path 'XferAddRs/SPRefId'
    pipe row ( rec );
    end loop;
    dbms_lob.freetemporary(tmp_file);
    return;
    end;
    end;
    ============================================
    Many Thanks,
    Ramesh.

  • Creation of SO based on the input in table format  for bulk data : urgent

    Hi,
    The data from an external system will be sent to SAP in a bulk format and also as a Table. i.e. they are going to send around 30 Purchase orders from external system . I need to fetch all of them at a time and create SO for each one .
    Hence, anyone please provide a work around for the same.
    shyam

    HI Shyam
    Proceed as below:
    1. Identify the file layout like how it is going to be for multiple items.
    2. Upload the data to an internal table:
    3. Loop at internal table
    4. Populate the data required for BAPI structures
    5. AT END of PO number call a BAPI to create a Sales Order.
    Make sure you are clearing/refreshing the structures/internal tables for BAPI.
    Regards
    Eswar

  • How to improve performance for bulk data load in Dynamics CRM 2013 Online

    Hi all,
    We need to bulk update (or create) contacts into Dynamics CRM 2013 online every night due to data updated from another external data source.  The data size is around 100,000 and the data loading duration was around 6 hours.
    We are already using ExecuteMultiple web services to handle the integration, however, the 6 hours integraton duration is still not acceptable and we are seeking for any advise for further improvement. 
    Any help is highly appreciated.  Many thanks.
    Gary

    I think Andrii's referring to running multiple threads in parallel (see
    http://www.mscrmuk.blogspot.co.uk/2012/02/data-migration-performance-to-crm.html - it's a bit dated, but should still be relevant).
    Microsoft do have some throttling limits applied in Crm Online, and it is worth contacting them to see if you can get those raised.
    100 000 records per night seems a large number. Are all these records new or updated records, or are there some that are unchanged, in which case you could filter them out before uploading ? Or are there useful ways to summarise the data before loading
    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

  • Partition merge for huge data

    The application has a very large table with more than 5 billion data , using that table it is planned to have only some years data by doing this it is expected to reduce 20 to 25 % data reduced.
    The problem here is as it is very large table we plan to get the required data in partition and plan to have this partition merged in to single partition then exchange partition to one table which is not having partition.
    My question is how efficiently this partition merge is with huge data volume ?

    Hello,
    I wonder why are you using Bulk Collect, when the same can be accomplished by a simple Merge statement.
    Below can help:
    MERGE INTO hotels tgt USING
    (SELECT hotel_code,
      hotel_name,
      hotel_type,
      hotel_address,
      hotel_number,
      hotel_facility
    FROM bck_hotel
    ) src ON (src.hotel_code = tgt.hotel_code)
    WHEN MATCHED THEN
      UPDATE
      SET tgt.hotel_name   = src.hotel_name,
        tgt.hotel_type     = src.hotel_type,
        tgt.hotel_address  = src.hotel_address,
        tgt.hotel_number   = src.hotel_number,
        tgt.hotel_facility = src.hotel_facility WHEN NOT MATCHED THEN
      INSERT
          tgt.hotel_code,
          tgt.hotel_name,
          tgt.hotel_type,
          tgt.hotel_address,
          tgt.hotel_number,
          tgt.hotel_facility
        VALUES
          src.hotel_code,
          src.hotel_name,
          src.hotel_type,
          src.hotel_address,
          src.hotel_number,
          src.hotel_facility
        );Is it not true?
    Regards,
    P.

  • When I tried to Mail Merge for Data is is not exporting any data.

    HI,
    EBS-12.1.3
    DB-11gR1
    OS - RHEL 5.6
    [With my Login User and SysAdmin Login User] When I enter into to the "People -> Enter and Maintain" Form and then I press the "Export Button", there is error Alert
    Function is not available to this responsibility. Change Responsibilities or Connect to the System Administrator
    I Added the Function "HR ADI Seeded Integrator Form Functions" into the "AE HRMS Manager" Responsiblity. It is also working and Export Data icon is enable.
    Problem:
    But Problem is when I tried to Mail Merge for Data is is not exporting any data.
    ====================================================================
    Steps
    1.Move to the "People -> Recruirment" and then "Request Recruitment Letter" .
    2. Enter the New Request. as
    Letter Name "App. Letter Contract Site",
    Automatic or Manual = Manual.
    Select the Name from the LOVs for the Request for Detail Block.
    3. Press the "Export Data" icon.
    4. Integrator Page Appear with my Custom Integrator Name as "Appointment Letter - Contact Site".
    5. Select the "Word 2003" from the View List. and Reporting is Checked.
    6. Review the Folowing Enteries as:
    Integrator Appointment Letter - Contact Site
    Viewer Word 2003
    Reporting Yes
    Layout App. Letter Contract Site
    Content XXHR_MBE_APP_LET_CONT_SITE_V
    Session Date 2011/08/02
    Mapping XXHR_MBE_APP_LET_CONT_SITE_V Mapping
    7. Press "Create Document" Button.
    8. It will open the Excel 2003 and then Word 2003. But no data down download from the Form.
    9. It open the Mail Merge Letter but no Data is Display.
    ===========================================================
    Note:
    a. I am following the Steps from the Link:"http://apps2fusion.com/at/38-ss/351-generate-recruitment-letters-web-adi".
    b. From the "Desktop Integrator Manager", "Oracle Web ADI", "HRMS Web ADI", it is working fine and Dowload the Data.
    ===========================================================
    Thanks
    Vishwa

    Please try the solution in ("Function not available to this responsibility" Error While Cliclking On Forms Personalisation [ID 1263970.1]) and see if it helps.
    Thanks,
    Hussein

  • Error while running bulk load utility for account data with CSV file

    Hi All,
    I'm trying to run the bulk load utility for account data using CSV but i'm getting following error...
    ERROR ==> The number of CSV files provided as input does not match with the number of account tables.
    Thanks in advance........

    Please check your child table.
    http://docs.oracle.com/cd/E28389_01/doc.1111/e14309/bulkload.htm#CHDCGGDA
    -kuldeep

  • How to use LSMW on CRM for bulk master data creation?

    Hello Experts,
    I need your help to able to use LSMW on CRM for bulk master data creation. Below is described my detailed requirement; -
    We have CRM 2007 integrated with SAP ISU (ECC6.0). As per business process all Business Master Data (BP details, Business Agreement details etc) and Technical Master Data (Connection Object, PoD etc.) is created in CRM and then it is replicated in ISU. We are going to start Assembly Test soon. Now we need to have all master data in place. Tool we want to use is LSMW.
    Now can you help me right from scratch on how to use LSMW for bulk master data creation in CRM?
    Please give me documents / links etc that is relevant.
    Regards,
    Rohit

    Hi,
    I have looked into your query.
    These are some information which might be useful to you.
    What is LSMW?
    Legacy System Migration Workbench or LSMW is SAP standard program that can be used to easily load / change master data or transactions in SAP without any programming at all. It can be used to upload data at cutover, such as: open orders, contracts, materials, vendors, stock on hand. It can also be used in a production system to make changes to existing data. Very limited authorization checks are available on the transaction, so the use of it must be very well controlled.
    One input file can be used to create all the views of the material master. For all the material types. Even if different views and fields are used for the different materials.
    Steps to take
    1. Create text file with data to be loaded
    2. Set up and run LSMW
    The following link will provide good information on LSMW Idoc method:
    [http://help.sap.com/saphelp_nw04/helpdata/en/ad/2d54a41d7011d2b42e006094b944c8/frameset.htm]
    I hope this helps.
    Regards,
    Venkat

  • AppleScript for mail merge with Excel data?

    Is there any approach for an AppleScript that lets you use Excel data as source for some kind of mail merge operations? If not, would anyone here be interested if someone (I?) would take a closer look at some kind of a (AppleScript Studio) solution for this?

    I'm not sure I get the question.
    If it is "could you use AppleScript to create mail merge for Pages with Excel?", the answer is, Yes. Both Pages and Excel are scriptable.
    If the question is "has anyone done it yet?", I don't know, but it could be a fun exercise.
    If the question is "would there be a market, if someone (you?) wrote and released such a script?", I cannot tell, but personally I would probably write a hack that worked only for my own needs - if I had them. The overhead with usability, testing, different address formats, languages, different Excel sheet formats, and so on, makes me guess that the investment wouldn't pay off for a generic solution. Especially considering both Pages and MS Office already have their own mail merge functions.

  • How to use "Mail Merge for Word" to include only Account fields?

    We're attempting to use the Mail Merge for Word template to create a document containing several fields from the Account object. We do not need any fields from the Contact object, and there are many contacts linked to each account.
    When choosing "Get On Demand Data > Accounts", removing all the [Contacts] fields, selecting the necessary [Accounts] fields, then clicking "OK", a "List Download in Progress" window appears, followed by one that says "Microsoft Word - Subscript out of range". None of the [Accounts] fields are available in the downloaded data.
    Can anyone tell me how to include the appropriate Account fields without any Contact fields (which pulls a separate Merge record for every Contact linked with the selected Account)?
    Thanks.

    Thanks for trying to help with this.
    So far, we've been unable to pull even a SINGLE account record. So the problem is not related to data volume limitations. The tool seems to require that Contacts are selected, but for this application we only want a single merge document per Account.
    If anyone else has had success using the Mail Merge for Word tool to pull only Account data, please give us your guidance. Thanks.

  • How can I transfer/merge the backup-data of one iphone onto another iphone?

    I have two iphones and want to merge the backup-data from one to the other without destroying any data on the new one. How can I do it and will this data be replaced automatically or merged?
    Thanks for your help!
    Toni

    As long as you use the same account, you can sync the same apps, contacts, music and other media content. Set up at least one contact and event on your new phone, to be able to merge your contacts and calendars. You can't transfer settings of your 3rd party apps, because this data is stored in your backup, and restoring from your backup will erase your new phone's data.
    See also: "About backups" http://support.apple.com/kb/HT1766
    You can also transfer your mail account settings using the option in the info pane in itunes, as well as the option to replace contacts, calendars, bookmarks and notes during the following sync.

  • Error while retrieving bulk data from mdm in staging server

    I am getting an error while retrieving bulk data from MDM. The error goes like this "NiRawReadError: An error occured when reading data from socket.".
    Could anyone please suggest me about the possible cause of this error. Please reply soon.
    Moderator message: network error, relation to ABAP development unclear, please search for available answers, check with system administrators, consult SAP service marketplace.
    Edited by: Thomas Zloch on Nov 22, 2010 5:16 PM

    Can you elaborate the thing... I don't think  /*+ APPEND */ this is working for me ,still I am getting same error.
    If you have any other suggestion,I would like to hear.
    Should i not put commit after some 500 records inserted ? As i am putting commit once after whole data gets inserted.

  • Performance problems on bulk data importing

    Hello,
    We are importing 3.500.000 customers and 9.000.000 sales orders from an
    external system to CRM system initialy. We developed abap programs
    those use standart "bapi" functions to import bulk data.
    We have seen that this process will take a lot of time to finish
    approximately in 1,5 months. It is a very long time for us to wait it
    to be finished. We want to complete this job about in a week.
    Have we done something wrong? For example, are there another fast and
    sap standard ways to import bulk partners and sales orders without
    developing abap programs?
    best regards,
    Cuneyt Tektas

    Hi Cuneyt,
    SAP standard supports import from external source. You can use XIF adapter or you can also use ECATT.
    Thanks,
    Vikash.

  • Which is better for bulk message scenario in sap xi RFC or Proxy

    which is better for bulk message scenario in ( RFC or Proxy ) ?
    Edited by: prabhatxi on Aug 6, 2010 4:44 PM

    Proxy will alwaays be better option in this case, as it is adapter less framework, and communication happens directly with XI central integration engine. So it is always fast communication and gives good performance.
    But still you should consider other factors, you may consider using RFC as well, as sometime we go for RFC/IDOC as this are the standard interfaces already available rather than creating structure...
    May be you can share more info on what type/volume data are you planning to send via XI?
    Hope this cleart your doubt..
    Divyesh

Maybe you are looking for

  • What type of files can we create in Java?

    In general what type of files can we create in Java? For example, we can create .dat and .txt files as follows: DataOutputStream ostream; ostream = new DataOutputStream(new FileOutputStream("myfile1.dat")); or ostream = new DataOutputStream(new FileO

  • Java WD table attributes

    Hello all, I'll explain the issue first: I made a screen where I can search some Business Partners (via RFC). Each time I push the "Search" button I get a result table with my Business Partners. But when I go to the next pages of my result table and

  • Change the format of addresses and phone numbers in iphone

    Plz help me out, Im not able format my contacts. I do not want any hyfans in the contact number, I tried with i cloud but it's just waste of time, there is an article in Apple community which I followed but no use, how to delete those bloody hyfans i

  • WCS not working

    After having some server issue (firmware update needed for the chassis it was sitting in) I'm now having a problem starting the WCS (version 6.0.132.0) When I run it, it just says: Starting WCS DbMonitor.sendAdminCommand: shutdown force - [Solid JDBC

  • Elements 4 Slide Show Ordering Prints Online

    The PDF slide show can be stopped by pressing ESC. This takes Adobe Viewer out of Full Screen mode, letting people look at the slides one-by-one. Select and copy slides or areas of slides to the clipboard, etc. Nice. (It doesn't stop the music, thoug