SQL 4 Oracle 오라클용 sql 실무

SQL4Oracle

insert 스타일

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

 

2011-08-03 13:22:25


SQL 4 Oracle 오라클용 sql 실무

▒ insert 스타일

 

▒ 개별등록 방법
insert into 목적_Table (고객ID,고객명,고객상태,취득일자,점수)
 values ('8105121******','홍길동','활동중','20110701',10000) ;
commit;

 

▒ 선택항목 일괄등록 방법
insert into 목적_Table (고객ID,고객명,고객상태,취득일자,점수 )
   select 고객ID,고객명,고객상태,취득일자,점수
   from 목적1_Table
   where 고객상태='활동중' ;
commit;

 

▒ 전체항목 일괄등록 방법
insert into 목적_Table
   select 고객ID,고객명,고객상태,취득일자,점수,취득종류,원장생성일,변경일자,등록자
   from 목적1_Table
   where 고객상태='활동중' ;
commit;


▒ 선택항목 일괄등록 방법
insert into 목적_Table  (고객ID,고객명,고객상태,취득일자,점수,취득종류,원장생성일,변경일자,등록자)
(
   select 고객ID,고객명,고객상태,취득일자,점수,취득종류,원장생성일,변경일자,등록자
   from 목적1_Table
   where 고객상태='활동중'
union all
   select 고객ID,고객명,고객상태,취득일자,점수,취득종류,원장생성일,변경일자,등록자
   from 목적2_Table
   where 고객상태='활동중'
) ;
commit;

'SQL4Oracle' 카테고리의 다른 글

PLSQL cursor 선언  (0) 2023.03.10
update 스타일  (0) 2023.03.10
minus 처리  (0) 2023.03.10
like 와 substr()  (0) 2023.03.10
합계점수 구간 추출  (0) 2023.03.10