기술 정보
home
채널 소개
home

trigger가 포함된 테이블 내 merge into SQL 수행 시 TBR-10005: NOT NULL 발생

문서 유형
장애 해결
분야
App개발
키워드
trigger
적용 제품 버전
7FS02
1 more property

현상

참고
해당 현상은 Tibero7 FS02 버전에서 발생했습니다.
AFTER UPDATE OR DELETE OR INSERT ON 트리거 동작 시, UPDATE 문을 통해 Trigger를 호출하면 정상 동작하지만, MERGE 문을 사용해 Trigge 를 호출할 경우 아래와 같이 에러가 발생합니다.
(TBR-20000: TBR-10005: NOT NULL constraint violation ('SCH'.'SLES126L'.'BEGIN_YY')..)
재현 시나리오
SQL> drop table t1; drop table t2; SQL> create table t1 (c1 number not null, c2 number not null, c3 number not null); SQL> create table t2 (c1 number not null, c2 number not null, c3 number not null); SQL> insert into t1 values (1, 2, 3); SQL> commit; SQL> create or replace trigger trg1 after update or delete or insert on t1 for each row declare begin insert into t2 (c1, c2, c3) values (:new.c1, :new.c2, :new.c3); end; / 패치 전 에러 발생 SQL> merge into t1 using (select 1 c1 from dual) A on (t1.c1 = A.c1) when matched then update set c3 = 10; TBR-20000: TBR-10005: NOT NULL constraint violation ('SCH'.'SLES126L'.'BEGIN_YY')..TBR-15163: Unhandled exception at SCH.TR_SLES126_AR11_1, line 161. 패치 후 정상 동작 결과값 SQL> merge into t1 using (select 1 c1 from dual) A on (t1.c1 = A.c1) when matched then update set c3 = 10; 1 row merged.
SQL
복사

원인

MERGE 구문 실행 중 조건절의 값을 자신의 쿼리 블록 내에서 찾아 사용한 뒤, 서브 쿼리에서 부모 컬럼 값을 처리하던 중 잘못된 값을 참조해 에러가 발생하였습니다.

해결

패치를 적용해 해결합니다. (적용패치: FS02_295407a, FS02_293469a)
주의
티맥스티베로에서 제공하는 기술지원을 통해 패치를 적용합니다.