COPY : Skipping Rows,bytes while
loading data.
The COPY
statement has two options to skip input data.
The SKIP BYTES option is only for fixed-width data loads:
SKIP
BYTES total
|
Skips
the total number (integer) of bytes from the input data.
|
SKIP
records
|
Skips
the number (integer) of records you specify.
SKIP
works with both delimited and fixed width files.
|
Following
examples shows how to skip 1st record in the file.
<> /home/sukul1 $ cat employeedet3.dat
rahul,dravID ***2010-01-01100000
SAURAV,GANGULY ***2010-10-01200000
sukul1=> COPY USER_30_DAY_TABLES.EMPLOYEE_1
sukul1-> (
sukul1(> NAME,
sukul1(> AGE NULL '***',
sukul1(> JOINING_DATE FILLER VARCHAR(10),
sukul1(> JOINING_YEAR AS
TO_NUMBER(TO_CHAR(TO_DATE(JOINING_DATE,'YYYY-MM-DD'),'YYYY')),
sukul1(> SALARY
sukul1(> )
sukul1-> FROM LOCAL
'/home/sukul1/employeedet3.dat'
sukul1-> FIXEDWIDTH COLSIZES(19,3,10,6)
sukul1-> SKIP 1
sukul1-> DIRECT;
Rows
Loaded
-------------
1
(1 row)
sukul1=> select * from
USER_30_DAY_TABLES.EMPLOYEE_1;
NAME | AGE | JOINING_YEAR
| SALARY
---------------------+-----+--------------+--------
SAURAV,GANGULY |
| 2010 | 200000
(1 row)
No comments:
Post a Comment