The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

Does anyone know a way (perhaps I'm overlooking it) to make the ON EXISTING SKIP syntax check Alternate Keys?

If there isn't a 'built-in' way, I'd like to suggest this as a feature!

Thanks, Calvin

asked 10 Jan '12, 16:30

Calvin%20Allen's gravatar image

Calvin Allen
1.5k232638
accept rate: 25%


AFAIK, INSERT ON EXISTING does rely on the primary key.

However, the much more powerful MERGE statement - available with v11 and above - can be used with different key sets, cf. this FAQ. Furthermore, it's part of the SQL/2008 standard whereas the INSERT ON EXISTING clause is not.


Based on Volkers answer here an example how to use the merge statement with static values and no source table:

merge into target
using (select 'NewName' c1) as sourceData
on target.name=sourceData.c1
when matched then skip
when not matched then insert ( "Name" , "Description" ) values ('NewName','test')
permanent link

answered 10 Jan '12, 17:29

Volker%20Barth's gravatar image

Volker Barth
29.3k287438644
accept rate: 32%

edited 11 Jan '12, 03:12

Martin's gravatar image

Martin
8.6k114149237

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×113
×28
×10
×1

question asked: 10 Jan '12, 16:30

question was seen: 1,071 times

last updated: 11 Jan '12, 03:12