How to insert only new registrations in GR 11, 1 material

Hi friends,

Every hour, I have a few records in a table that has a unique primary key.

I want to insert only new records up to and ignore duplicate keys (meaning it shouldn't fail with "forced to uniqueness (TEST.) TEST_PK) violated" . Is there an easy way to do it? (I read that we can use MERGE, but did not understand how to rewrite my request accordingly)

Note: DB is on 11 GR 1 material so I can't use IGNORE_ROW_ON_DUPKEY_INDEX (introduced in 11 GR 2).

Query : for example hard-coded Date

Insert / * + append parallel(TEST12,8) * / into TEST TEST12

SELECT

/*+

Leading (a.c)

Full (a.c) parallel (a.c, 2)

parallel of full (a.m.) (a.m., 2)

Full (a.d) parallel (a.d, 2)

Full (a.n) parallel (a.n, 2)

PQ_DISTRIBUTE (hash of hash a.n)

*/ *

OF DATA_VIEW one

WHERE the st_date BETWEEN TO_DATE (16 March 14 00:00:00 ',' DD-MON-RR HH24:MI:SS')

AND TO_DATE (16 MARCH 14 23:59 ',' DD-MON-RR HH24:MI:SS');

What did I try?

DBMS_ERRLOG.create_error_log, but still it gives the same error.

The ERRORS IN err LOG $ _dest2 ('1 comment') REJECTS LIMIT UNLIMITED;

Insert / * + append parallel(TEST12,8) * / into TEST TEST12

*

ERROR on line 1:

ORA-12801: error reported in the parallel query P005 Server

ORA-00001: unique constraint (TEST.) TEST_PK) violated

Can you please suggest what is the effective way to do it?

This should work for you (change column lists to match the column names in your version of these tables):

SQL> create table test12(
  2          st_id number not null,
  3          st_stuff varchar2(40),
  4          st_date date);

Table created.

SQL>
SQL> create table test1(
  2          st_id number not null,
  3          st_stuff varchar2(40),
  4          st_date date);

Table created.

SQL>
SQL> create view data_view as select * from test1;

View created.

SQL>
SQL> begin
  2          for i in 1..100 loop
  3                  insert into test1
  4                  values(i,'Stuff '||i, sysdate-mod(i,9));
  5          end loop;
  6
  7          commit;
  8  end;
  9  /

PL/SQL procedure successfully completed.

SQL>
SQL> merge into test12 t12
  2  using (SELECT
  3    /*+
  4      leading(a.c)
  5      full(a.c) parallel (a.c,2)
  6      full(a.m) parallel (a.m,2)
  7      full(a.d) parallel (a.d,2)
  8      full(a.n) parallel (a.n,2)
  9      pq_distribute(a.n hash hash)
 10    */ *
 11  FROM DATA_VIEW a
 12  WHERE st_date BETWEEN TO_DATE('16-MAR-14 00:00:00','DD-MON-RR HH24:MI:SS')
 13                      AND TO_DATE('16-MAR-14 23:59:00','DD-MON-RR HH24:MI:SS')) dv
 14  on (dv.st_id = t12.st_id)
 15  when not matched then
 16          insert (t12.st_id, t12.st_stuff, t12.st_date)
 17          values (dv.st_id, dv.st_stuff, dv.st_date);

12 rows merged.

SQL>
SQL> select count(*) from test12;

  COUNT(*)
----------
        12

SQL>SQL> begin
  2          for i in 101..200 loop
  3                  insert into test1
  4                  values(i,'Stuff '||i, sysdate-mod(i,9));
  5          end loop;
  6
  7          commit;
  8  end;
  9  /

PL/SQL procedure successfully completed.

SQL>
SQL> merge into test12 t12
  2  using (SELECT
  3    /*+
  4      leading(a.c)
  5      full(a.c) parallel (a.c,2)
  6      full(a.m) parallel (a.m,2)
  7      full(a.d) parallel (a.d,2)
  8      full(a.n) parallel (a.n,2)
  9      pq_distribute(a.n hash hash)
 10    */ *
 11  FROM DATA_VIEW a
 12  WHERE st_date BETWEEN TO_DATE('16-MAR-14 00:00:00','DD-MON-RR HH24:MI:SS')
 13                      AND TO_DATE('16-MAR-14 23:59:00','DD-MON-RR HH24:MI:SS')) dv
 14  on (dv.st_id = t12.st_id)
 15  when not matched then
 16          insert (t12.st_id, t12.st_stuff, t12.st_date)
 17          values (dv.st_id, dv.st_stuff, dv.st_date);

11 rows merged.

SQL>
SQL> select count(*) from test12;

  COUNT(*)
----------
        23

SQL>
David Fitzjarrell

Tags: Database

Similar Questions

  • Hello. I just know that the muse and I need an organization of customers in alphabetical order. The problem is that you will always get new clients. I need to know how to insert a new customer (square), and it is already in alphabetical order on the page.

    Hello.

    I just know that the muse and I need guests alphabetical organization. The problem is that you will always get new clients. I need to know how to insert a new customer (square), and it is already in alphabetical order on the page. The site will be as in the link below, and each customer will have a window of these: http://www.connary.com/. I look back.

    A hug, Murilo.

    I believe you are referring to the rectangles of tile as visitors on the page? not exactly customer database?

    You can add rectangle with different effects with rollover State of mouse and about adding new, you must do this manually in design mode.

    Thank you

    Sanjit

  • How to insert the new line char in sticky c# code?

    Hi all

    I paste the code complete c# on a line of string as follows.

    int _intUserID = 0; string _strUserName = string. Empty; string _strEmployeeID = string.empty;
     
    c# VS2005 .cs file code should stick as follows.

    int _intUserID = 0;
    String _strUserName = string. Empty;
    String _strEmployeeID = string. Empty;

    So how do you achieve this. by inserting the new line char in c#?

    Hi Murthy,

    Thanks for posting your query in Microsoft Community.

    I understand that you have problems with the code in Visual studio.

    The question you posted corresponds to the coding software, it would be better suited to the MSDN Community.

    Please visit the link below to find a community that will provide the support you want.

    http://social.msdn.Microsoft.com/forums/en-us/category/VisualStudio

    Hope it will be useful. If you still have questions, please reply and we will be happy to help you.

  • How to insert a new accessory through java code

    Hello world

    I need to add a new accessory through java code. I found the service EDIT_RENDITIONS in the add attachments page. But this service is not documented. Does anyone have an example how to add attachments?

    Thank you

    Martin

    Martin,

    Try the following code:

    final IdcClientManager clientManager = new IdcClientManager();

    Customer IdcClient;

    try {}

    client = clientManager.createClient (IDC_PROTOCOL + RIDC_SERVER + ":" + RIDC_PORT);

    final String username = 'sysadmin ';

    final DataBinder dataBinderReq = client.createBinder ();

    ServiceResponse severiceResponse = null;

    dataBinderReq.putLocal ("IdcService", "EDIT_RENDITIONS");

    dataBinderReq.putLocal ("a", '1560'); as integer

    dataBinderReq.putLocal ("dDocName", "DEV2_001509"); AsString

    dataBinderReq.putLocal ("renditionKeys", "addRendition0"); AsString

    dataBinderReq.putLocal ("addRendition0.name", "theFileName");

    dataBinderReq.putLocal ("addRendition0.description", "theFileDescription");

    dataBinderReq.putLocal ("addRendition0.action", "modify");

    final String fileName = "c:\\test.txt";

    final file = new File (fileName);

    final TransferFile tf = new TransferFile (queue);

    dataBinderReq.addFile ("addRendition0.file", tf); as bytes

    severiceResponse = client.sendRequest (new IdcContext ("username"), dataBinderReq);

    final DataBinder dataBinderResp = severiceResponse.getResponseAsBinder ();

    DataBinder resultado = severiceResponse.getResponseAsBinder ();

    System.out.println (dataBinderResp.ToString ());

    } catch (final IdcClientException e) {}

    System.out.println (e.getMessage ());

    e.printStackTrace (System.out);

    }

    Jonathan

    http://jonathanhult.com

  • How to insert a new record or update existing record by using a view complex?

    Currently, I created this screen, there is no problem on display data, on the update feature (average TI insert / update / delete on the table for which the view is based on).

    I have a table and a view complex in order to display the information in the table in a form of tabellar (IE up to 70 record in same "record" in the form, one for each article)

    The view is like this



    Select a.f1, a.f2, get_value(a.pk1,1) a1, a2 get_value(a.pk1,2), get_value(a.pk1,3) a3...

    from my_table a

    where a.proj_id = user





    and I want to allow the update of the field a1, a2, a3 in a multiplace (tabellar) canvas.

    I created a TRIGGER INSTEAD.

    But it works not only in the form. I get FRM-40654 error when I try to change the existing value in the form running based on this point of view.

    The view is woking and editable using sql-plus.

    If I have question
    Select * from ALL_UPDATABLE_COLUMNS where table_name = 'SPV_BOQ_BOM_POS_ACTIVITIES ';

    where "SPV_BOQ_BOM_POS_ACTIVITIES" is the name of my point of view.

    The question is: why if the view is updatable using SQL * Plus, is not editable using the Oracle 10 g 2 form?

    Could someone help me ASAP?

    Thank you

    Forms to lock the record when you start editing. It is is by a statement of the type

    SELECT 
      FROM 
     WHERE =
       FOR UPDATE NOWAIT;
    

    If this attempt fails, the error you are getting is displayed. As solution to create a trigger-LOCK-ON on the block and with which replace standard logic.

  • How to insert a new line with text()

    I have a piece of text on the stage and I want to insert text that contain more line with text(). Is this possible?

    Something like:

    SYM. $('myTextElement') .text ("text string of the first line" + "string of text from second line");

    I just tried this

    SYM. $('_58Txt') .html ("|" + r1.toString () + "|")<  |"="" +="" r2.tostring()="" +="" "|="">
    numerator<>

    and I got what I wanted:

    | 3.<>

    numerator<>

    Thank you. It worked

  • How to insert a new line in a table?

    I have a table of basic bit of lines and columns.

    In excel if I want to insert a blank line in the Middle, I just click right and do it.

    In DW, I am at a loss what to do. Thank you.

    It is very similar to the DW.  Right-click in a cell, and then click Table-> Insert a row or a column.  There is options to add several lines above or below.

  • I lost my password to a family environment on the Xbox. How can insert a new

    Could someone help me please. My son installed a password on Xbox and he forgot it.we cannot access the Xbox for more than 16 games

    Hello Conorcannon,

    This question of fact in the game's forum:

    http://answers.Microsoft.com/en-us/Windows/Forum/gaming

    (1) go to the system settings recover gamertag reset the endings of survey for the console and it should have your gamer tag back

    (2) disconnect all your logged in then press the x in the middle of your controller that you tells your reader 1,2,3,4 then go recover gamertag your info and the happy game

    3) turn on your Xbox console to access the menu "Account Management." Make sure that there is no disc in the status bar.

    Type an expression in the password field. Basically, you want to appear the guest with two options: "Try Again" and "I forgot my Access Code," with a CLEAR"" button.

    Select the 'CLEAR' option, then press the ' - A '. When you are prompted, type the last four digits of the credit card that you used to sign up for xbox live, and then send it.

    Reset your password.

    http://www.ehow.com/how_6116969_reset-Xbox-Live-password.html

    I hope this helps.

  • Help! How do you keep objects in the same order in a doc page 20, when inserting a new object?

    I created a catalog of photos only, as objects.

    They are organized in alphabetical order, 4 images per page as a 2 x 2 grid, 20 pages.

    I want to insert a NEW object (image) in the middle of these 20 pages, and you want all objects after the move more than a place to make room.


    How can I get the objects after those inserted to shift, such that the text would be the case if you have inserted a text more in the middle of a paragraph?

    I can't understand how this (without just putting the images in a text box and online, but then I lose all the controls of the space)...

    Thank you!

    Laurent

    The only possibility would be a script. Scripting InDesign

  • How to complete the implementation of process after inserting the new sim card to unlock the phone

    Try to unlock the phone more 6s with ATT, but do not know how to perform the implementation of process after inserting the new sim card. I got the unlock code confirmed att.

    After the unlock code is confirmed, you will have to restore the unit to the factory via iTunes settings.  He must inform you that the device is unlocked, THEN you change sim cards.

  • How to buy only a few songs, without registering for the new service? It seems compulsory now, and I DON'T want TO.

    How to buy only a few songs, without registering for the new service? It seems compulsory now, and I DON'T want TO. Could someone tell me just for the selection of the menu where I can search for a song by keyword and buy it?

    If it's on your iPad, then go to the app Store in iTunes, you can buy music from there

    If you do not want to use Apple music then turn it off on your iPad via the settings > music > Music Show Apple 'off '.

  • We moved and we lost the record to go with the microsoft download number modules to our new computer and it will not let us download micro Word &#62; how do we get this registration?

    We moved and we lost the record to go with the microsoft download number modules to our new computer and it will not let us download micro Word > how do we get this registration?

    Unfortunately, if you have lost the product keys for Microsoft software, you will need to buy new software.  Visit the Microsoft store on genuine Microsoft software.

  • How to only new and updated backup files to update the

    When I backup by using the backup and Restore Center it backup all my files each time, taking up a huge amount of space and take ages to complete. How can I put it to back up only new files or files that have changed since the previous backup?

    Use a third-party software. If you want a straight file copy program, second copy is excellent and inexpensive. If you want the imagery with imagery of incremental backup, try the version of Acronis True Image Home . MS - MVP - Elephant Boy computers - don't panic!

  • How to insert new records into master and detail forms.

    Hello

    I cannot have values are inserted in the main view and details at the same time. Scenarios is I a Dept Table (view object-VO1) and employee Table (View Object-VO2) both related to a foreign key, according to HR in Oracle DB XE default schema.

    Now, I want to insert the new record into a table Dept (VO1) and the EMP (VO2) by a new say on page (page 2). There is a button on page 1 with button INSERT. I can only drag "CreateInsert" operation on this button for VO1 and VO2. So only text box for records Dept are allow to insert data, but not the Emp records. Is there a way I can insert data into the tables at the sametime?

    Thank you
    MB

    Hi MuradRabbani,

    You can call programmatically two createInsert operations,

    Add to your pageDef two CreateInsert operations.
    Create a button tha will be master (VO1) insert method call and then call insert for details (VO2) method

    Here is an example of code to call the operations:

    DCBindingContainer dcb = ADFUtils.getDCBindingContainer (); you need the ADFUtils.java and JSFUtils.java classes. You can find them in the sample applications in your JDeveloper.

    OperationBinding oper = dcb.getOperationBinding("CreateInsertVO1");

    Oper.Execute ();

    -NOTE: at this point, you must set the values that compine the ViewLink on the master in the order detail will know where to link the new record there are many ways to do it.
    As solution try to overrdi the method to create on the in the your master vo (VO1) ViewRowImpl
    for example
    @Override
    protected void create (AttributeList attributeList) {}
    front
    attributeList.setAttribute ("NameOfAttribute", valueHere);
    Super.Create (AttributeList);
    }

    ------------------

    After that, you must call the operation for your VO2 detail

    for example

    DCBindingContainer dcb = ADFUtils.getDCBindingContainer ();

    OperationBinding oper = dcb.getOperationBinding("CreateInsertVO2");

    Oper.Execute ();

    The detail record will now automatically have the values of your master.

    Kind regards
    Dimitris.

  • How to make a new paragraph in a message? Whenever I hit the button "enter/return" the message is sent and I want only to go down in a new paragraph in the message?

    How to make a new paragraph in a message? Whenever I hit the button "enter/return" the message is sent and all I want to do is make a new paragraph! Which button I hit to make a new paragraph?

    Option-return.

Maybe you are looking for

  • HP C309g: Problems printing with photo paper and not A4 paper

    My HP 309 g perfectly print a picture on A4 paper without flaws. However, whenever it prints the exact image even on HP Premium Plus photo paper, the colors are weird - not black, but the yellow blues and roses. I removed the print head and carefully

  • Cannot match Vaio to Jambone Jambox

    Hello, I just got a Jambone Jambox bluetooth speaker, and it cannot associate with my Sony Vaio Z. It matches everything just great for Apple Macbook, a friend and pairs of my Samsung Galaxy IIIs, it is not pair with the Vaio. Support Jambone think I

  • WTF is Vista by hiding my save game file?

    Had to solve problems with a game program by reinstalling.  First of all, I uninstalled the game using "remove a program" and then for good measure, made sure I deleted the remaining game folder and save all the files, including the old folder.  Tota

  • Windows XP tells me that my software may be counterfeit.

    WHEN WILL I RECEIVE A RESPONSE FROM MICROSOFT? WAITING SINCE 5TH MARCH 2012 I HAVE XP PRO THAT I USE NOW FOR OVER A YEAR WITH REGULAR UPDATES.  NOW everything to IT IT TELLS ME that I "CAN" REPEAT "MAYBE" VICTIM SOFTWARE COUNTERFEITING.  I THINK EVEN

  • Cartrtridges do not move

    I have a hpc3180 and cartridges don' t move. they are housed in the right side. What can I do?