Databases Reference
In-Depth Information
How to do it...
The following steps will demonstrate how to load data:
1.
Connect to the
SH
schema:
CONNECT sh@TESTDB/sh
2.
Create the table
MY_IMPORT_DATA
to store the data loaded from the text file:
CREATE TABLE MY_IMPORT_DATA (
GEO_ID VARCHAR2(12),
PLACE_NAME VARCHAR2(255),
TYPE VARCHAR2(255),
PCT_2000 NUMBER,
PCT_2010 NUMBER);
3.
Use SQL*Loader to import data from the
participationrates2010.txt
file
to the
MY_IMPORT_DATA
table:
!sqlldr userid=sh@TESTDB/sh control=loaddata.ldr
data=participationrates2010.txt SILENT=ALL errors=10
4. Inspect the log file generated by the previous operation:
!tail loaddata.log
5.
Empty the table
MY_IMPORT_DATA
:
TRUNCATE TABLE MY_IMPORT_DATA;
6.
Use SQL*Loader to import data from the
participationrates2010.txt
file
to the
MY_IMPORT_DATA
table using direct path load:
!sqlldr userid=sh@TESTDB/sh DIRECT=TRUE control=loaddata.ldr
data=participationrates2010.txt errors=10 SILENT=ALL
7. Inspect the log file generated by the previous operation:
!tail loaddata.log
8.
Drop the table
MY_IMPORT_DATA
:
DROP TABLE MY_IMPORT_DATA;