cancel
Showing results for 
Search instead for 
Did you mean: 

On Existing Skip & Alternate Keys

Former Member
3,133

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

Accepted Solutions (0)

Answers (1)

Answers (1)

VolkerBarth
Contributor

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')