Unique constraint is not thrown when used MERGE INSERT (alone) via dblink.

We found some interesting behaviour of unique constraint on Merge query when we use Merge When Not Matched Insert (no update query) via a dblink.
In one Schema S1, on Table A1(c1,c2,c3) there is a unique constraint on column (c1,c2).
Column c2 is nullable and has null for some records.
Now i have a table A2 with same defintion as A1 in Schema S2.In S2 , i have a dblink of S1 as S1 itself.
I have data in S2.A2. Here also i have some records with c2 as null and c1 matching with the data of S1.A1.
Now from schema S2,
I am using the following Merge Query,
MERGE INTO S1.A1 target
USING S2.A2 source
ON (target.c1 = source.c1 and target.c2 = source.c2)
WHEN NOT MATCHED
INSERT (c1,c2,c3) values (source.c1, source.c2,source.c3)
WHEN MATCHED
UPDATE c3 = source.c3;
Now when i execute this merge in schema S2,
if i have some data in S1.A1 and S2.A2 having c1 as same and c2 as null, as oracle does not treat two nulls same, it goes for an insert, i have got unique constraint violated error.
But if i execute MERGE INSERT alone, though that record is getting inserted , i am not getting unique constraint violated error.
Oracle version we are using is 10g (10.2...).
Is it a bug in oracle or what could have caused this behaviour.

Dear,
ERROR at line 1:
ORA-00001: unique constraint (SYS_C00137508) violatedYou need to think about two things
(a) read consistency : what was the situation of table_1 when the maching clause has been initially evaluated ; there were 0 rows matching which means the merge operation will be all insert
(b) your matching clause has a problem : the join column must be unique in both tables otherwise the merge will be ambigous. You don't have a unique key on the source table
(c) think that the merge operation will never insert id =1 and then update id = 1 within the same operation. This will never happen
Hope this helps
Mohamed Houri

Similar Messages

  • Constraints are not created when using a cart

    Hi all,
    I have created a cart in SQL Developer with all the tables from HR schema. If I apply the cart to my database cloud service the tables and data are there but most of the constraints are missing.
    In log I can see error messages like:
    Error starting at line 5 in command:
    ALTER TABLE "EMPLOYEES" ADD CONSTRAINT "EMP_DEPT_FK" FOREIGN KEY ("DEPARTMENT_ID")
          REFERENCES "DEPARTMENTS" ("DEPARTMENT_ID") ENABLE
    Error report:
    SQL Error: ORA-02270: no matching unique or primary key for this column-list
    02270. 00000 -  "no matching unique or primary key for this column-list"
    *Cause:    A REFERENCES clause in a CREATE/ALTER TABLE statement
               gives a column-list for which there is no matching unique or primary
               key constraint in the referenced table.
    *Action:   Find the correct column names using the ALL_CONS_COLUMNS
               catalog view
    Primary key constraints are completely missing in the log.
    I have tried it with option "Disable constraints before loading data" checked and unchecked.
    How can I transfer the schema (tables, data, constraints) to my cloud service. I don't want to create the constraints manually because I have a web service which is based on the exact structure of HR schema in my local database.
    Kind regards
    Juergen

    You should actually look at the headers first, IMO. Not knowing "what is going on in there" is a very bad reason to discard that solution. The Content-Type header is meant to indicate exactly the type of content you are getting (your want the text/html mime-type).
    Not all servers report the correct content type all the time in this header so it won't be a 100% solution.
    BTW, the Aperture project is specifically intented to extract content and metadata from various sources, including websites. You might be able to use that.

  • NoSuchObjectException thrown when using exportObject

    Hello,
    while dealing with some jGuru-exercise (http://java.sun.com/developer/onlineTraining/rmi/exercises/DistributedGarbageCollector/index.html) I encountered some problems with UnicastRemoteObject.exportObject( obj, 0).
    I modified the mentioned exercise so that the server-side remote implementation classes do not extend UnicastRemoteObject anymore. Instead, the remote reference stubs will now be created by calling UnicastRemoteObject.exportObject( obj, 0) and returned to the client.
    The modified code:
    class MessageObjectImpl
    //extends UnicastRemoteObject
    implements MessageObject, Serializable, Unreferenced
       public MessageObject getMessageObject() throws RemoteException
          MessageObject mo = new MessageObjectImpl();
          //return mo;
          return (MessageObject) UnicastRemoteObject.exportObject(mo, 0);
       }Sometimes it works, sometimes it does not. In the latter case the following exception is thrown:
    java.rmi.NoSuchObjectException: no such object in tableIt seems as if the Garbage Collector finalizes the object right before the client is able to call a method on the stub.
    Can somebody help me out and tell, why it works when the remote implementation class extend UnicastRemoteObject and why it does not work when using UnicastRemoteObject.exportObject(mo, 0).
    Thanks in advance!
    MP

    See http://java.sun.com/developer/onlineTraining/rmi/exercises/DistributedGarbageCollector/index.html.
    The interface MessageObject implements Remote. The implementation class does not need to implement Serializable, but it is not wrong, because every UnicastRemoteObject has to be serializable. UnicastRemoteObject itself implements Serializable...
    I bypassed the problem by returning the instance "mo" of MessgeObjectImpl instead of the result of exportObject. Now it does work.
    Moreover if I would not have extended Remote, there would not be a NoSuchObjectException but an UnmarshallingException.

  • The volume up and down controls on my wireless keyboard show a no entry sign and do not respond when used...please help?

    The volume up and down controls on my wireless keyboard show a no entry sign and do not respond when used...please help?

    If you want to get a little more "exotic" you can try remapping the function keys.  I did a little google searching and the hits that looked promising are,
    Mapping volume and eject keys to 3rd-party keyboard Other Hardware
    Spark
    Spark is a powerful, and easy Shortcuts manager. With Spark you can create Hot Keys to launch applications and documents, execute AppleScript, control iTunes, and more...
    You can also export and import your Hot Keys library, or save it in HTML format to print it.
    Spark is free, so use it without moderation!

  • How can i set songs within a playlist, or an entire playlist, so that they are not included when using the shuffle function on IPOD Classic? Is this possible?

    How can i set songs within a playlist, or an entire playlist, so that they are not included when using the shuffle function on IPOD Classic?
    Is this possible?

    You can set any song to Skip when shuffling.
    In your iTunes Library, highlight the song and right-click/Get Info. On the Options tab is the Skip when shuffling box. Select that and then Sync the iPod with your Library.

  • Images on Facebook do not appear when using different web browsers

    Images on Facebook do not appear when using Safari on my Macbook Pro (I've tried Google Chrome too with the same result).  This makes me think it's a setting within OS Mavericks that I'm missing.  I have not seen this issue on any other computers.  This only occurs on my, and others' profile pictures on my profile page and on the news feed, not photos that are posted in albums or on walls.  and yes, i have images enabled in Safari.
    In safari the images don't appear, and in their place is a small blue "?" square >>.
    In Chrome it appears as a broken image link >>
    Has anyone encountered this?  Is there a fix?  It is very annoying.

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, by a peripheral device, or by corruption of certain system caches. 
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. Note: If FileVault is enabled on some models, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including sound output and  Wi-Fi on certain models. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

  • How do I set up a mail group on mac mail?  All the advise on line seems to refer to 'address book' and I only have 'contacts'.  The guidance does not work when using 'contacts' - can anyone help me?

    How do I set up a mail group on mac mail?  All the advise on line seems to refer to 'address book' and I only have 'contacts'.  The guidance does not work when using 'contacts' - can anyone help me?

    Create a group and send mail
    http://www.dummies.com/how-to/content/how-to-create-a-basic-contact-group-in-mac -os-x-li.html
    http://www.macworld.com/article/1165582/how_to_email_groups_with_mail.html
    Best.

  • Module borders not displaying when using Aggregator

    I am using Captivate 4.  I created a TOC for both modules in a project. Then I created an Aggregator to connect them and display both TOCs.
    The issue I am havving is that the individual modules have borders on all 4 sides, yet they do not display when using the aggregator. How do I correct this?
    Thank you.

    Lenny,
    I apologize for not having an answer to your question, but I'm envious that you've successfully configured mod_jk. I've read several different versions of how to configure this, but nothing has worked so far. I wonder if you could either point me to some correct instructions on how to integrate Apache and Tomcat so I might try to duplicate your success.
    Thanks in advance,
    Vince

  • U/tube videos open when using Safari but will not open when using Firefox.

    u/tube videos open fine when using Safari but will not open when using Firefox. With Firefox I get the unhighlighted Quicktime symbol with a question mark in the center. WHY?? Any help appreciated --- Toroya

    Hmmmm, strange you view YouTube in Safari & not FF. Which version of FF are you using?
    Try the following:
    Repair permissions & restart.
    Make sure you have the latest versions of Adobe Flash Player Software
    QuickTime Preferences > Advanced > MIME Stettings > Miscellaneous.
    Deactivate the "Flash Media" option.

  • Look for a progarm that will let me have 2 moniters but one will lock on and will not change when using spaces

    look for a progarm that will let me have 2 moniters but one will lock on and will not change when using spaces

    ok so i have one moniter to the right of me and i want to keep my google chrome on that one but still be abel to use space on the many monter. cuz when you go to spaces it movies both moniter i hope that help and i hope that you can help me.

  • Photoshop CC. Colour selection not working when using alt and brush.

    Hi, Photoshop CC. Windows 8.1 64 bit. Colour selection not working when using alt and brush. I have tried rebooting and other things like closing swatch panel etc.
    The alt key is otherwise OK.  It's not the recent upgrade from Win 8 to 8.1 (5 days ago) because the colour selection facility was working yesterday. Any ideas.

    I'd say things sound desperate enough to try resetting Preferences
    Reset Preferences
    Windows — Hold down Shift Ctrl Alt immediately after starting Photoshop
    Mac — Hold down Shift Cmd Opt immediately after starting Photoshop
    If that fails, we need to know your operating system?
    Do you have a full CC subscription, or by apps do you mean Photoshop, Bridge and Lightroom?
    Another other information that might pertain ?

  • Serial number not  accepted when using disc to download on second computer.

    Serial number not accepted when using disc ot download CS6 to second computer. Help...

    make sure you're entering the correct serial number for the correct product:  http://helpx.adobe.com/x-productkb/global/find-serial-number.html
    if you're certain that you are doing that, contact adobe support:  http://www.adobe.com/support/chat/ivrchat.html

  • Siri does not work when used for calling a contact function

    Siri does not work when used for calling a contact function

    Very strange, try to turn off/on your iPhone. Or make a reset (home+power button)...
    If it continues try to restore it.

  • HT204168 touch screen function not working when using facetime

    Why is my iPad touch screen function not working when using FaceTime?

    Hi megascones,
    I apologize, I'm a bit unclear on the exact nature or scope of the issue you are describing. If you are having issues with the touch screen on your iPad, you may find the troubleshooting steps outlined in the following article helpful:
    If the screen on your iPhone, iPad, or iPod touch doesn't respond to touch - Apple Support
    Regards,
    - Brenden

  • Why is my touch screen function not working when using facetime

    Why is my touch screen function not working when using facetime

    Hello megascones,
    After reviewing your post, it sounds like the screen is not responding to touch in one app. I would recommend that you read this article, it may be able to help the issue.
    If the screen on your iPhone, iPad, or iPod touch doesn't respond to touch - Apple Support
    Restart your device. If you can't restart, reset your device.
    Thanks for using Apple Support Communities.
    Have a nice day,
    Mario

Maybe you are looking for