SQL 4 Oracle 오라클용 sql 실무

SQL4Oracle

update 스타일

돌프1 2023. 3. 10. 13:40

2011-08-03 13:58:30


SQL 4 Oracle 오라클용 sql 실무

▒ update 스타일

 

▒ 기본 방법
update 목적_Table a
   set a.승인일='20110701',
       a.승인점수=50000
where 고객ID='8101011******'

 

▒ 집합 방법
update 목적_Table a
   set (a.승인일, a.승인점수)=('20110701', 50000)
where a.고객ID='8101011******'

 

▒ 집합 일괄 방법
update 목적_Table a
   set (a.승인일, a.승인점수)=(select b.승인일, b.승인점수
                                          from 실적_Table b
                                          where b.고객ID=a.고객ID
                                              and b.취득일자=a.취득일자 )
where a.승인일 is null

 

▒  bypass_ujvc 힌트 방법
update /*+ bypass_ujvc */
   ( select a.승인일 a_승인일, a.승인점수 a_승인점수
               b.승인일 b_승인일, b.승인점수 b_승인점수
     from 목적_Table a, 실적_Table b
     where a.승인일 is null
         and b.고객ID=a.고객ID
         and b.취득일자=a.취득일자)
SET a_승인일    =  b_승인일,
      a_승인점수  =  b_승인점수

 

'SQL4Oracle' 카테고리의 다른 글

DB LINK(원격 DB 사용)  (0) 2023.03.10
PLSQL cursor 선언  (0) 2023.03.10
insert 스타일  (0) 2023.03.10
minus 처리  (0) 2023.03.10
like 와 substr()  (0) 2023.03.10