ORA-30926:을 얻을 수 없는 안정적인 설정에서 행의 원본 테이블

StackOverflow https://stackoverflow.com/questions/2337271

  •  22-09-2019
  •  | 
  •  

문제

나는

ORA-30926:을 얻을 수 없는 안정적인 설정에서 행의 원본 테이블

에서 다음과 같은 쿼리:

  MERGE INTO table_1 a
      USING 
      (SELECT a.ROWID row_id, 'Y'
              FROM table_1 a ,table_2 b ,table_3 c
              WHERE a.mbr = c.mbr
              AND b.head = c.head
              AND b.type_of_action <> '6') src
              ON ( a.ROWID = src.row_id )
  WHEN MATCHED THEN UPDATE SET in_correct = 'Y';

실행 했 table_1 그것은 데이터와도는 내부 쿼리(src 도)또한 데이터이다.

왜 이러는 와서 어떻게 할 수 있는 해결됩니까?

도움이 되었습니까?

해결책

This is usually caused by duplicates in the query specified in USING clause. This probably means that TABLE_A is a parent table and the same ROWID is returned several times.

You could quickly solve the problem by using a DISTINCT in your query (in fact, if 'Y' is a constant value you don't even need to put it in the query).

Assuming your query is correct (don't know your tables) you could do something like this:

  MERGE INTO table_1 a
      USING 
      (SELECT distinct ta.ROWID row_id
              FROM table_1 a ,table_2 b ,table_3 c
              WHERE a.mbr = c.mbr
              AND b.head = c.head
              AND b.type_of_action <> '6') src
              ON ( a.ROWID = src.row_id )
  WHEN MATCHED THEN UPDATE SET in_correct = 'Y';

다른 팁

You're probably trying to to update the same row of the target table multiple times. I just encountered the very same problem in a merge statement I developed. Make sure your update does not touch the same record more than once in the execution of the merge.

사이트 워크 플로를 만드는 경우 특정 시간에 실행되도록 예약하고 목록의 항목을 삭제할 수 있습니다.

목록 기반 워크 플로는 일정 시간까지 일시 중지 한 다음 일시적으로 일시 중지해야합니다.

또는 특정 연령보다 오래된 항목을 삭제하려면 목록에 정책을 설정할 수 있습니까?

Had the error today on a 12c and none of the existing answers fit (no duplicates, no non-deterministic expressions in the WHERE clause). My case was related to that other possible cause of the error, according to Oracle's message text (emphasis below):

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.

The merge was part of a larger batch, and was executed on a live database with many concurrent users. There was no need to change the statement. I just committed the transaction before the merge, then ran the merge separately, and committed again. So the solution was found in the suggested action of the message:

Action: Remove any non-deterministic where clauses and reissue the dml.

SQL Error: ORA-30926: unable to get a stable set of rows in the source tables
30926. 00000 -  "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.

이 오류가 발생한 나 때문에 중복된 레코드(16K)

도 독특한 일 .

그 때 내가 다시 시도 없이 병합한 독특한 동과 존경을 얻을 것이라고 생생 두 번째로 그 때문이었 commit

후에 병합하는 경우 투입하지 않 같은 오류가 표시됩니다.

지 않고 독특한 쿼리를 작업하는 경우 투입된 후에는 각 병합 작업입니다.

A further clarification to the use of DISTINCT to resolve error ORA-30926 in the general case:

You need to ensure that the set of data specified by the USING() clause has no duplicate values of the join columns, i.e. the columns in the ON() clause.

In OP's example where the USING clause only selects a key, it was sufficient to add DISTINCT to the USING clause. However, in the general case the USING clause may select a combination of key columns to match on and attribute columns to be used in the UPDATE ... SET clause. Therefore in the general case, adding DISTINCT to the USING clause will still allow different update rows for the same keys, in which case you will still get the ORA-30926 error.

This is an elaboration of DCookie's answer and point 3.1 in Tagar's answer, which from my experience may not be immediately obvious.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top