AS SALAMO ALAIKUM
TABLE STRUCTURE
=================
create table XXX_EMP_STG
(
EMPNO NUMBER(4) PRIMARY KEY,
ENAME VARCHAR2(20) NOT NULL,
JOB VARCHAR(20) NOT NULL,
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(8,3),
COMM NUMBER(8,3),
DEPTNO NUMBER(2)
)
=====================
CONTROL FILE
=====================
OPTIONS (SKIP=1)
LOAD DATA
INFILE 'D:\ORACLEDEMO\SQLLOADER\emp.csv'
BADFILE 'D:\ORACLEDEMO\SQLLOADER\EMP_BAD.bad'
DISCARDFILE 'D:\ORACLEDEMO\SQLLOADER\EMP_DISCARD.dis'
APPEND INTO TABLE XXX_EMP_STG
WHEN COMM!='NULL'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO)
TABLE STRUCTURE
=================
create table XXX_EMP_STG
(
EMPNO NUMBER(4) PRIMARY KEY,
ENAME VARCHAR2(20) NOT NULL,
JOB VARCHAR(20) NOT NULL,
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(8,3),
COMM NUMBER(8,3),
DEPTNO NUMBER(2)
)
=====================
CONTROL FILE
=====================
OPTIONS (SKIP=1)
LOAD DATA
INFILE 'D:\ORACLEDEMO\SQLLOADER\emp.csv'
BADFILE 'D:\ORACLEDEMO\SQLLOADER\EMP_BAD.bad'
DISCARDFILE 'D:\ORACLEDEMO\SQLLOADER\EMP_DISCARD.dis'
APPEND INTO TABLE XXX_EMP_STG
WHEN COMM!='NULL'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO)
NOTE -
RECORD WANTED TO INSERT INTO XXX_EMP_STG TABLE WHERE AL READY SOME RECORD IS EXISTING.
==============
EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO
7370,SHAHNAWAZ,ENGG,7902,17-Dec-1980,8000,100,20
======================
MA ASALAAM
-----
PASSION FOR ORACLE
No comments:
Post a Comment