【发布时间】:2017-09-04 09:42:02
【问题描述】:
我尝试按顺序运行接下来的 2 个查询。第一个完美运行,第二个抛出
ORA-30926: 无法在源表中获得一组稳定的行
我在网上搜索了一个解决方案,但我无法为我的查询复制它。谁能帮帮我?
查询 1:
merge into sdc_compare_person dcip
using (
select anumber, position, character
from sdc_diakrietposities_cip
where kind = 'Surname'
) x
on (dcip.sourcekey = x.anumber)
when matched then update set
dcip.GESVOR = substr(dcip.GESVOR, 1, x.position - 1) ||
x.character ||
substr(dcip.GESVOR, x.position + 1, length(dcip.GESVOR)-x.position)
;
188 rows merged.
查询 2:
merge into sdc_compare_person dcip
using (
select anumber, position, character
from sdc_diakrietposities_cip
where kind = 'Lastname'
) x
on (dcip.sourcekey = x.anumber)
when matched then update set
dcip.GESNAM_D = substr(dcip.GESNAM_D, 1, x.position - 1) ||
x.character ||
substr(dcip.GESNAM_D, x.position + 1, length(dcip.GESNAM_D) - x.position)
;
SQL Error: ORA-30926: Unable to get a stable set of rows in the source tables
【问题讨论】:
-
添加:此查询使用特殊字符更新列“dcip.gesnam_d”(来自列“x.character”)。所以 X 包含几个重复的 'anumber' 值,因为一些 'dcip_gesnam_d' 值可能有超过 1 个特殊字符。
-
是的,这是正确的,但是根据给定的答案,我无法产生有效的解决方案。它不断抛出 ORA-30926 错误。查询 2 和查询 1 是同一个查询,我不明白为什么 2 有效而 1 无效。
-
在您的查询 2 中,使用子查询会产生两条具有相同数字的记录
-
一个查询有效,另一个无效。但是两个查询都有子查询产生两个或多个相同数量的记录。