我有两个彼此相同的表,并且t1
具有比 更多的数据。我正在使用此查询将丢失的数据从to插入。t2
t2
t1
t2
t1
insert into t1
select * from t2
where not exist ( select * from t1
where t1.key1 = t2.key1
and t1.key2 = t2.key2)
运行此查询时,我得到: ORA-00001 Unique constraint (string.string) 违反错误。
这两个表有key1
和key2
作为键。
由于唯一的约束是两个键,我不明白为什么会出现该错误。
编辑:我现在在“索引”中注意到有 2 个约束都是唯一类型的。
第一个是:key1,random_column 第二个是:key2
带来不便敬请谅解。