Home » SQL & PL/SQL » SQL & PL/SQL » ORA-00001: unique constraint On Merge Insert (Oracle11g)
ORA-00001: unique constraint On Merge Insert [message #677204] Fri, 30 August 2019 06:42 Go to next message
ssyr
Messages: 65
Registered: January 2017
Member
Hello Team,


I have MERGE insert query that will do insertion if not matched and do updating the rows when row matched.But now I am getting "ORA-00001: unique constraint "

Could you please help me how can I get resolve this error?


Re: ORA-00001: unique constraint On Merge Insert [message #677205 is a reply to message #677204] Fri, 30 August 2019 06:52 Go to previous messageGo to next message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
Well, on the face of it this is trivial: you have to adjust your code such that you do not update or insert a value that already exists. Or is there something more complicated going on?
Re: ORA-00001: unique constraint On Merge Insert [message #677206 is a reply to message #677205] Fri, 30 August 2019 07:07 Go to previous messageGo to next message
ssyr
Messages: 65
Registered: January 2017
Member
Thank you for your prompt reply.

How can I adjust the code so that it will do insertion or updating the records.
Re: ORA-00001: unique constraint On Merge Insert [message #677207 is a reply to message #677206] Fri, 30 August 2019 08:17 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Do it in the way that makes it work.
Also feed back in your previous topics.

Re: ORA-00001: unique constraint On Merge Insert [message #677208 is a reply to message #677206] Fri, 30 August 2019 08:33 Go to previous messageGo to next message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
ssyr wrote on Fri, 30 August 2019 13:07
Thank you for your prompt reply.

How can I adjust the code so that it will do insertion or updating the records.
Do you understand the concept of unique and primary key constraints? That duplicate keys are not permitted? If you think that through and relate it to the rows in the table and the rows you are inserting or updating then all become clear. Perhaps.
Re: ORA-00001: unique constraint On Merge Insert [message #677223 is a reply to message #677208] Mon, 02 September 2019 05:07 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
And to be clear - if you want a more specific answer you'll need to supply the code and table details, including all the keys.
Re: ORA-00001: unique constraint On Merge Insert [message #677224 is a reply to message #677223] Mon, 02 September 2019 05:10 Go to previous messageGo to next message
ssyr
Messages: 65
Registered: January 2017
Member
Thank you all for help.

But I resolved this issue.
Re: ORA-00001: unique constraint On Merge Insert [message #677289 is a reply to message #677224] Tue, 10 September 2019 00:19 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
ssyr wrote on Mon, 02 September 2019 12:10
Thank you all for help.

But I resolved this issue.

OraFAQ Forum Guide
#12. If you found an answer yourself, post it. That way we know the issue is resolved and we might learn from it.

[Updated on: Tue, 10 September 2019 00:19]

Report message to a moderator

Previous Topic: Procedure SendMail Gmail
Next Topic: display data in new column
Goto Forum:
  


Current Time: Thu Mar 28 15:15:07 CDT 2024