今天一个自动运行的程序报错 ORA-30926: unable to get a
stable set of rows in the source
tables,该存储过程中有用merge语句,google该错误的解释:
Oracle Error :: ORA-30926
unable to get a stable set of rows in the source
tables
Cause
A stable set of rows could not be got because of
large dml activity or a non-deterministic where clause.
Action
Remove any non-deterministic where clauses and
reissue the dml.
non-deterministic 非确定性的到底指的是什么呢?再搜
ORA-30926: unable to get a stable set of rows in the
source tables" error if there is either a many-to-one or
many-to-many relationship between the source and target tables.
This is not as serious as it sounds because you would normally have
to MERGE a one-to-one or one-to-zero relationship as your join
condition would be protected by the target's primary
key.
When performing a merge statement, the table to be merged had
multiplerecords with the same key used for matching. While this is
ok forrecords to be inserted into the target table, Oracle doesn't
like thison the update portion of the statement. The solution is to
remove the
duplicate or pick a matching key that is truely
unique.
此处说明了,merge在做update子句的时候,只能处理1对1或1对0的关系,不能处理多对1或多对多的关系,否则会导致ora-30926
错误。
找出procedure,查看source,和target,结果看到source的确有重复记录,请负责数据来源的同事删除对应的记录后问题解决。