2012. 1. 30. 13:26
반응형
a 테이블의 내용을 b테이블의 내용으로 update 치기 위한 방법
1.  키가 보증되는 경우 사용
     update
       (select a.1, b.1 from a, b)
   set a.1 = b.1 
2. 키가 보증되지 않은 경우 사용 (ORA-01779 에러남)
     update /*+ bypass_ujvc */
         (select a.1, b.1 from a, b)
      set a.1 = b.1  
3. oracle 11 부터 bypass_ujvc를 지원하지 않는다고 함..
때문에 merge 문을 사용
   merge into a using (select 1 from b) b
    on (a.1 = b.1)
     when matched then
     update set a.1 = b.1
      where a.2 = '2'
 
반응형

'Db > Oracle' 카테고리의 다른 글

oracle server character set 변경  (0) 2012.02.16
백업및 복구  (1) 2012.02.16
create global temporary table 문  (1) 2011.05.23
like와 escape의 사용 예제  (1) 2011.03.29
toad 한글깨짐 처리  (2) 2011.02.11
Posted by seongsland