ORA-30926: unable to get a stable set of rows in the source tables

VijayaTech Labs Blog
We will get this when we are trying to update a row in a table, for which there will be two or more corresponding records.

Table 1:

tc11tcl2
t1a
t2b
t3c
t4d

Table 2:

tc21tc22
b1a
b2b
b3c
b4d

Table 3:

tc31tc32
t1b1
t2b2
t2b3
t4b4

We will get error, when we try to update TABLE1 by using TABLE3 as follows:

MERGE INTO table1 t1

USING table3

ON (t1.tc11=t3.t31)

WHEN MATCHED THEN

UPDATE SET tc12=tc32;

Analysis:
It is because, for one record in TABLE1, we are getting multiple corresponding values in TABLE3 (i.e. for value “t2”, we are getting “b2” and “b3”).
So when the above query try to update TABLE1 based on “t2”, it cannot decide which value should be updated either “b2” or “b3”, there it will throw the “ORA-30926 unable to get a stable set of rows in the source tables” error.
Solution:
Add few more conditions in WHERE clause, so that you can avoid such ambiguous situations.

Share this post with your friends

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top