【发布时间】:2020-06-30 14:42:56
【问题描述】:
我真的不明白为什么我在ORA-30926: unable to get a stable set of rows in the source tables 中提供了distinct 子句,因为我在merge 查询中提供了distinct 子句,并且BB_TST_HISTORY 具有适当的唯一约束。
merge into bb_tst_history h
using (select distinct r.ausuebungsbezeichnung
from bb_tst_rollup r
join ( select root, boerse, security_typ
from bb_export_filter
minus
select root, boerse, security_typ
from bb_tst_exception
) e
on r.root = e.root
and r.security_typ = e.security_typ
and r.boerse = e.boerse
) s
on (s.root = h.root and s.security_typ = h.security_typ and s.boerse = h.boerse)
when matched then
update set h.ausuebungsbezeichnung = s.ausuebungsbezeichnung
when not matched then
insert values (s.ausuebungsbezeichnung);
【问题讨论】:
-
抱歉我已经编辑了我的查询...实际上我在选择查询中使用了很多列并删除了其他部分的 coulmns..所以它的错字
-
s.root、s.security_typ和s.boerse的组合必须是唯一的。 (s只返回ausuebungsbezeichnung,所以不太清楚发生了什么。)