How do I insert/update certain records that I've identified in cursors..?

Morning gurus..
As the title asks, I have this script that loads records into a temp table then compares these with whats in the ORACLE table. When each temp table record has been identified as being either needing to be inserted or not, how do I then insert these identified records? As in, how can I do..
INSERT INTO xxxxxxxxxxx_SUPPLIERS (vendor_id, vendor_name,segment1, end_date_active) VALUES (2, 'SUPPLIER NAME 2', 100002, sysdate); ..but I'll need to put in some variable names where the values have been written in above - is this allowed..?
thanks,
E

hi,
here is a small sample for your query.... given Procedure InsertExcep is reading data from table code_master and inserting all fetched records into another table test_code_master..... before insert you can do any comparison within loop..... or even can give any Update statement....
CREATE TABLE code_master
CODE VARCHAR2(10),
CODE_DESC VARCHAR2(70)
INSERT INTO CODE_MASTER ( CODE, CODE_DESC ) VALUES (
'ORG0007', 'PARTNERSHIP FIRM');
INSERT INTO CODE_MASTER ( CODE, CODE_DESC ) VALUES (
'ORG0008', 'CONSULTANCY FIRM OR PROFESSIONAL BODY');
INSERT INTO CODE_MASTER ( CODE, CODE_DESC ) VALUES (
'ORG0009', 'SOCIAL ORGANIZATION');
INSERT INTO CODE_MASTER ( CODE, CODE_DESC ) VALUES (
'ORG0010', 'EMBASSY');
CREATE TABLE test_code_master
CODE VARCHAR2(10),
CODE_DESC VARCHAR2(70)
CREATE OR REPLACE PROCEDURE InsertExcep
AS
CURSOR insertdata
IS
SELECT code,code_desc
FROM code_master ;
BEGIN
     FOR i IN insertdata
     LOOP
               BEGIN
               INSERT INTO test_code_master (code,code_desc)
               VALUES(i.code,i.code_desc);
               EXCEPTION WHEN OTHERS THEN
               DBMS_OUTPUT.PUT_LINE ( 'Error during Insert code - '||i.code );
               END;
     END LOOP;
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ( 'Error in InsertExcep' );
END;
hope this will work...
Thanx
MB

Similar Messages

  • As i am fresher Please share the doc of ECMA script using java script in SharePoint 2013 also how we can insert,update,delete records in list using ECMA script.

    As i am fresher Please share the doc of ECMA script using java script in SharePoint 2013 step by step also how we can insert,update,delete records in list using ECMA script.
    Thanks and Regards, Rangnath Mali

    Hi,
    According to your post, my understanding is that you want to use JavaScript to work with SharePoint list.
    To create list items, we can create a ListItemCreationInformation object, set its properties, and pass it as parameter to the addItem(parameters) function
    of the List object.
    To set list item properties, we can use a column indexer to make an assignment, and call the update() function so that changes will take effect when you callexecuteQueryAsync(succeededCallback,
    failedCallback). 
    And to delete a list item, call the deleteObject() function on the object. 
    There is an MSDN article about the details steps of this topic, you can have a look at it.
    How to: Create, Update, and Delete List Items Using JavaScript
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Help for inserting/updating new record

    hi,
    i am trying to insert new data in account record in CRM OD from java using (web service v2.0 ) following methods
    AccountInsertInput accountinsert=new AccountInsertInput();
    accountinsert.setListOfAccount(accountDataList);
    Here accountDataList is object of ListOfAccountData.......i want to know how can i insert data in accountDataList that is passed as argument....what i think is that i can create object of AccountData and set required values then convert this to ListOfAccountData(which i am not sure if possible)....pls help
    there is one more problem while updating i am getting ...."No user key can be used for the Integration Component instance 'Account'."....however i have given the combination of user keys....i don't have accountid so i have just given id .....pls help

    Hi,
    there is one more problem while updating i am getting ...."No user key can be used for the Integration Component instance 'Account'."....however i have given the combination of user keys....i don't have accountid so i have just given id .....pls helpPlease ensure that a record exists in CRM On Demand corresponding to the user key values you are providing. This error indicates that no record can be found matching the specified user key.
    Thanks,
    Sean

  • What's the best way to insert/update thousands records in multiple tables

    Can anyone give an example of how to insert/update thousands records in multiple tables on performance wise? or what should I do to improve the performance?
    Thanks
    jim

    You can see a set of sample applications in various scenarious available at
    http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/content.html

  • Query (insert, update or delete) that forms fire to SQL when we click save

    I want to see the query (insert, update or delete) that forms fire to SQL when I click the save button. I am using a master-detail form.
    Could you tell me how can I do it?

    after the commit_form
    you should call a built-in :system.last-query
    :system.last_query will show the query that you have recently perform.

  • Newbie - Insert/Update Sql Records

    Is there a good overview available somewhere that I can see the code necessary to insert/ update MSSql records? The selects and data vieing is simple, just need the next step.
    Tx

    Hi there,
    I searched for information about inserting SQL records, too, but did not find a concrete example. There are code samples regarding updating records at:
    http://developers.sun.com/prodtech/javatools/jscreator/reference/codesamples/index.html
    After all I managed to create new data records using this code:
    1. In the constructor of the page:
    // User provided initialization code
    testRowSet.setAutoCommit(true);
    testRowSet.setHoldability(testRowSet.HOLD_CURSORS_OVER_COMMIT);
    testRowSet.setConcurrency(testRowSet.CONCUR_UPDATABLE);
    testRowSet.execute();
    2. Action handler of the submit button:
    public String button1_action() {
    // Add your event code here...
    try {
    String a = (String)textField1.getValue();
    String b = (String)textField2.getValue();
    System.out.println("Werte a + b: "+a+" + "+b);
    testRowSet.moveToInsertRow();
    testRowSet.updateString(1, a);
    testRowSet.updateString(2, b);
    System.out.println("inner Action");
    testRowSet.insertRow();
    return "success";
    catch ( SQLException e) {
    log("speicherfehler", e);
    throw new FacesException(e);
    Because I just worked this out 30 minutes ago, there is still some debug code in it (you noticed that probably) and I do not know if this is the somehow "official" solution for the task, furthermore there might be code that is not necessary.
    Hope this helps
    Bernd

  • How do I rename one wrongly identified photo in Faces? I seem to only be able to merge two stacks of photos to the correct name, but that is not accurate. I only have one photo in a batch under a certain name, that is wrongly identified.

    How do I rename one wrongly identified photo in Faces? I seem to only be able to merge two stacks of photos to the correct name, but that is not accurate. I only have one photo in a batch under a certain name, that is wrongly identified.

    In iPhoto '11: Select the photo in the "Faces" stack, open the "Info" panel, click on the face name in the "faces" brick and then on the name below the face to edit the name.
    Regards
    Léonie

  • How do I insert Album cover art that's missing on new iTunes 12.0?

    How do I insert Album cover art that's missing on new iTunes 12.0?

    The latest iTunes version is 11.3.1. If you have iTunes 12 beta, you will need to ask your question in the Developers Community.

  • I have installed Find My Friends app in my iPhone5 and can anyone tell me how can I insert my photo so that my friends can see me? Thank you.

    I have installed Find My Friends app in my iPhone5 and can anyone tell me how can I insert my photo so that my friends can see me? Thank you.

    I don't have Find My Friends installed but if I understand correctly, the photos that would display on your friends phones would come from the Contacts on their phone. Here is a previous discussion that may help: https://discussions.apple.com/message/25429023#25429023

  • How to delete a in place record that will not undeclare

    I have an "in-place" record that will not let me undeclare itself, not sure how it got created but here are some facts about it:
    when i first looked at it showed as checked out to (blank).  This is different from all of my other in-place records which show as checked out to "System Account".  I tried checking it out to me (and it let me) which was strange!!  When I
    try to undeclare it as a record by using the "compliance details" interface and click the undeclare record link, the reocrd status is changed from "Declared record on 1/17/2011" to "Record".  When I go back to the UI it still shows the record with the
    little lock on it.  If I try to delete the record using the library interface I get the message: "The item cannot be updated because it is locked as read-only".  I installed sharepoint manager 2010 (from codeplex) on my server and navigated to this
    item in the list and checked out the properties...
    in this tool it says "IsReadOnly" = false
    if I look at the individual properties of the item i see properties like
    ecm_ItmLockHolders  value = ecm_InPlaceRecordLock
    ecm_ItemDeleteBlockHOlders value= ecm_InPlaceRecordLock
    I suspect that this is why ic cannot get rid of the bloody record...  i don't know why undeclare doesn't take these locks off (Perhaps because someohw it got checked out to someone other than system).  I even tried going iinto the content database
    to set the CheckedOutTo column to null.  when i did this nothing happened
    i tried setting the id equal to the "system account" Id in the content database and the record vanished from the document library (although I can still see it in the content database)...
    this is a big mystery for me... all i want is to get rid of a record that somehow has been "corrupted"  we have been demoing some third party applications which upload to sharepoint and prerhaps they got the file in this state (its an email .msg format)...
    i definitely need to know the recommended way to clean a record that will not let you undeclare it... help!  my next course of action will be a ms support call...
    krd

    the record was declared as part of info mgmt policy (created +1 days, delcare record), then i have another step (declared record + 1 day, start a workflow).  I'm trying to delete the record using a workflow (because the OOTB disposition workflow doesn't
    work, i'm trying to create my own disposition workflow which undeclares the record first then deletes it).  But that is a bit of a side story (I haven't managed to get that working...)
    krd

  • How to find insert,update on schema

    Hi,
    I want to monitor insert,update or delete perform onparticular schema of the database .
    your early repsone is appriciated.
    Thanks in advance.

    user647572 wrote:
    Thanks for your kind response .. it is very useful to me ...
    sorry but i am using below query and
    EXTENDED_TIMESTAMP as timestamp with timezone data type...
    SELECT SQL_TEXT
    FROM
    DBA_COMMON_AUDIT_TRAIL
    where EXTENDED_TIMESTAMP between to_date('20101016 10:30', 'yyyymmdd hh24:mi')
    and to_date('20101016 11:00', 'yyyymmdd hh24:mi')
    AND OBJECT_SCHEMA = 'JISPBILCORBILLINGPRD501'
    AND UPPER(SQL_TEXT) LIKE UPPER('INSERT%')
    it is taking more time to display result.
    This is normal situation.Check sys.aud$ table,how much record contain this table?
    You can delete old audit records as
    DELETE FROM sys.aud$ WHERE timestamp# < SYSDATE -40;>
    Please give me suggestion on it..

  • Sync: UPDATE on records that do not exist

    I have to similar cases that occur now and then:
    1. user syncs from PDA, record ends up in EQ with "Update/delete error :: no data found". (EQ DML: UPDATE)
    2. user syncs from PDA, record ends up in EQ with "integrity constraint (MIPSS.FK_EVENT__INSPECTION) violated - parent key not found" (EQ DML: INSERT)
    Data ending up in EQ is deleted from the PDA according to the user.
    Data is not accessible for deletion by anyone on the server side or on the PDA. I know that the last time this happened, the PDA user INSERTED (created) a new record (INSPECTION) and then UPDATED (edited) it before he did the sync. Is it possible that olite/Mobile server skips an INSERT when syncing or could there be something wrong with my publication?
    Marius
    Edited by: Marius H on Mar 24, 2009 4:08 AM

    The uniqueness of the seqno$$ values is within clientid and tranid$$, so it is possible for the same seqno$$ values to be in a ceq$ table for different users and/or transactions.
    In your example (assuming they are for the same clientid), tranid$$ 258 is the first upload (the tranid$$ increased for each sync for the same user), and therefore will need to be processed first. The seqno$$ value for the record for tranid$$ 258 looks like an update, rather than an insert from the range value (higher than the type I for tranid$$ 263) did you change the U to I when trying to fix the problem?
    the version$$ values in the cfm$/ceq$ tables do not always have real values
    if the record was uploaded as dmltype$$=I, the version$$ will normally be 1 (ie: first version of the record), but when the apply is done then if the PK does not exist, the record will be created and the cvr$ table inserted with version 1. If the PK does exist, then the record will be updated and the version value in the clg$ table added to.
    if a record was downloaded to the client it would have a version number from the server, and update to this would normally include this version number so that the apply can check that the update is for that version of the record when checking for conflicts where the data has changed on both the server and the client.
    If a record was created on the client and then updated, the version would probably be null as it is likely that this update would be changed to an insert when it is applied
    the -1 is possibly a second update to the same record
    When the apply process is done, the dmltype$$ from the upload is only used as a guide. for both I and U it tests if the PK exists and if so does an update, if not does an insert. for type D it checks the PK and if it exists, deletes the record, if it does not, then it ignores the record.
    The processing order is clientid, tranid$$, seqno$$

  • How to perform insert, update and delete in a table component

    hi all,
    i am using a table component in my page. I want to retreive data from multiple tables as well as perform insertion, updation and deletion operation.The changes should be affected in the corresponding tables. can anyone provide a solution for my problem.
    Thanks in advance
    regards,
    prasant

    There is a great tutorial for insert, update and delete records in a table.
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/inserts_updates_deletes.html
    Hope it helps.
    Thanks,
    Moumita

  • How do I insert a CSV file that has blank fields? (Some  fields need to be blank) CS4

    Hi, this is the first time I have done a data merge in InDesign. I am trying to insert an address list that often has blank fields in it. The fields are blank since some fields are not relevent to some people (i.e. some of the people don't have cell phones others don't have email addresses) Therefore these people would obviously leave those field blank. The trouble is when I go to do a data merge I am told that the CSV file won't import because some fields are blank. I don't know why InDesign is telling me this, or course some fields are blank they are not relevent to that person. Can someone please tell me how I can get around this problem?

    I tried doing another data merge and I can't seem to get the "remove blank lines" feature to work anymore.
    Here is an image that has all the fields entered in:
    Yet if a field is left blank in the InDesign doc I will get this:
    Or if the blank field comes before another field on the same line I will get this:
    This seems odd to me since I thought these problems were supposed to go away when I clicked this:
    Do you know what might be going wrong? Here is what my data merge place holders look like if it is any help:

  • How can perform insert /update /delete in one single mapping.

    Hi,
    I want to is there any logic by which we can create 2-3 pipeline in a mappings like pipelines will work for insert / update /delete or storing soem rejected data according to conditional flag.
    I tried it in a mapping but problem is that when target load order is like ins then upd then delete/reject . if new rec will come then control will pass through ins target . but if rec needs to update or delete then again control is going to ins target not update / delete target.
    We have already given the all conditional flags in filter after lookup and before target .
    all possibilities we checked but didnt got success.
    last option is separate the mappings for insert / update/delete.....etc.
    Is there any solution for this type of problem.
    reply plz if any body have solutions.
    ---Umesh

    Hi Umesh,
    I understand from your query that you want to load target with insert, update and delete rows after runnng the mappping...
    If you are looking for the same then you can use one of the Oracle fetures Oracle Streams: Change Data Capture.
    the Url is:
    http://www.oracle.com/technology/products/bi/db/10g/pdf/twp_cdc_cookbook_0206.pdf
    If any other help required do reply.
    Regards
    Tarang Jain

Maybe you are looking for

  • Acknowledgement for AsynThird-party-- SOAP-- PI-- ABAP proxy-- ECC scenario

    Can someone please provide me a step-by-step for Third-party>SOAP>PI>ABAP proxy>ECC scenario. Third-part system is sending an Asynchronous HTTPS message to PI which is then routed to the ECC system to do some processing. I have read many blong and al

  • Officejet Pro L7555 - Scanned docs are not being saved to hard drive.

    I've uninstalled & reinstalled the new HP/Windows 7 compatible software twice and I still can't get scanned docs to save to the hard drive. The scanning process looks like it's going thru all the steps. Even asking where I want to save the file. Unfo

  • Xperia Z1 4.4.4 Update Issues (14.4.A.0.155 and .157)

    Well, our much anticipated 4.4.4 has join the party. But unfortunately I found a bug already in my quite new Xperia Z1 which I  bought 10 days ago & updated last night to 4.4.4 from 4.4.2.   Found a problem. I don't know whether this is only in my ph

  • Movie imported from Keynote gets much bigger in GB

    Hello ! I recorded a simple presentation in Keynote and exported it to a .mov file (800x600, 13 mintues, only 10 Mb). Then I imported it in Garage Band. Just added a short jingle at the begining, in the middle and at the end (I would have add them in

  • Error in namespace copying

    Hi, I  copied individual objects from one software component to another component. (message type) namespaces are different. while activating that object Activation of the change list canceled Check result for Message Type MT_CustomeRequest | http://w