SQLLOader2(EXCEL 또는 csv 형식의 파일 가져오기)

31023 단어 loader
1. EXCEL 파일 가져오기: 1. 먼저 EXCEL 파일을 CSV 형식 파일로 저장합니다 ---> UltraEdit 도구로 열 때 필드 사이를 쉼표로 구분하는 것을 볼 수 있습니다.
  ,EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO

1,7369,SMITH,CLERK,7902,1980/12/17,800,,20

2,7499,ALLEN,SALESMAN,7698,1981/2/20,1600,300,30

3,7521,WARD,SALESMAN,7698,1981/2/22,1250,500,30

4,7566,JONES,MANAGER,7839,1981/4/2,2975,,20

5,7654,MARTIN,SALESMAN,7698,1981/9/28,1250,1400,30

6,7698,BLAKE,MANAGER,7839,1981/5/1,2850,,30

7,7782,CLARK,MANAGER,7839,1981/6/9,2450,,10

8,7788,SCOTT,ANALYST,7566,1987/4/19,3000,,20

9,7839,KING,PRESIDENT,,1981/11/17,5000,,10

10,7844,TURNER,SALESMAN,7698,1981/9/8,1500,0,30

11,7876,ADAMS,CLERK,7788,1987/5/23,1100,,20

12,7900,JAMES,CLERK,7698,1981/12/3,950,,30

13,7902,FORD,ANALYST,7566,1981/12/3,3000,,20

14,7934,MILLER,CLERK,7782,1982/1/23,1300,,10

2. 가져오기 실행 - 제어 파일 작성:testSqlLdr2.ctl
OPTIONS(SKIP=1) -- 

LOAD DATA

INFILE 'D:\oracletest\testSqlLdr2.csv'

APPEND

INTO TABLE EMP2

FIELDS TERMINATED BY ','

(

virtual_column FILLER, -- , PL/SQL Developer  

EMPNO,ENAME,JOB,MGR,HIREDATE date 'YYYY/MM/DD',SAL,COMM,DEPTNO)

-- 명령 실행
D:\oracletest>sqlldr scott/tiger@orcl control=testSqlLdr2.ctl



SQL*Loader: Release 11.2.0.1.0 - Production on   11  30 15:35:40 2014



Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.



  -   14

-- 검증 결과 -- 가져오기 성공
SQL> select * from emp2;



EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO

---------- ---------- --------- ---------- -------------- ---------- ---------- ----------

7369 SMITH CLERK 7902 17-12 -80 800 20

7499 ALLEN SALESMAN 7698 20-2  -81 1600 300 30

7521 WARD SALESMAN 7698 22-2  -81 1250 500 30

7566 JONES MANAGER 7839 02-4  -81 2975 20

7654 MARTIN SALESMAN 7698 28-9  -81 1250 1400 30

7698 BLAKE MANAGER 7839 01-5  -81 2850 30

7782 CLARK MANAGER 7839 09-6  -81 2450 10

7788 SCOTT ANALYST 7566 19-4  -87 3000 20

7839 KING PRESIDENT 17-11 -81 5000 10

7844 TURNER SALESMAN 7698 08-9  -81 1500 0 30

7876 ADAMS CLERK 7788 23-5  -87 1100 20

7900 JAMES CLERK 7698 03-12 -81 950 30

7902 FORD ANALYST 7566 03-12 -81 3000 20

7934 MILLER CLERK 7782 23-1  -82 1300 10



 14 。

둘째, CSV 파일의 가져오기 1, 이 파일은 일반적으로 다음과 같은 형식으로 PLSQL에서 내보내는 질의 결과입니다.
" ","EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"

"1","7369","SMITH","CLERK","7902","1980/12/17","800.00","","20"

"2","7499","ALLEN","SALESMAN","7698","1981/2/20","1600.00","300.00","30"

"3","7521","WARD","SALESMAN","7698","1981/2/22","1250.00","500.00","30"

"4","7566","JONES","MANAGER","7839","1981/4/2","2975.00","","20"

"5","7654","MARTIN","SALESMAN","7698","1981/9/28","1250.00","1400.00","30"

"6","7698","BLAKE","MANAGER","7839","1981/5/1","2850.00","","30"

"7","7782","CLARK","MANAGER","7839","1981/6/9","2450.00","","10"

"8","7788","SCOTT","ANALYST","7566","1987/4/19","3000.00","","20"

"9","7839","KING","PRESIDENT","","1981/11/17","5000.00","","10"

"10","7844","TURNER","SALESMAN","7698","1981/9/8","1500.00","0.00","30"

"11","7876","ADAMS","CLERK","7788","1987/5/23","1100.00","","20"

"12","7900","JAMES","CLERK","7698","1981/12/3","950.00","","30"

"13","7902","FORD","ANALYST","7566","1981/12/3","3000.00","","20"

"14","7934","MILLER","CLERK","7782","1982/1/23","1300.00","","10"

2. 가져오기 실행 - 제어 파일 작성:testSqlLdr3.ctl
OPTIONS(SKIP=1) -- 

LOAD DATA

INFILE 'D:\oracletest\222.csv'

REPLACE

INTO TABLE EMP2

FIELDS TERMINATED BY ',' 

OPTIONALLY ENCLOSED BY '"' --   '"'  

(

virtual_column FILLER, -- , PL/SQL Developer  

EMPNO,ENAME,JOB,MGR,HIREDATE date 'YYYY/MM/DD',SAL,COMM,DEPTNO)

-- 명령 실행, 가져오기 성공
D:\oracletest>sqlldr scott/tiger@orcl control=testSqlLdr3.ctl



SQL*Loader: Release 11.2.0.1.0 - Production on   11  30 15:43:26 2014



Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.



  -   14

좋은 웹페이지 즐겨찾기