-
STEP 0. We will refer to the csv file found at https://raw.githubusercontent.com/socratica/data/master/earthquake.csv for this guide.
-
STEP 1. Ensure you have sqlldr added to path.
-
STEP 2. Ensure that your user has sufficient permissions to access/modify the required tables.
-
STEP 3a. We need to create a 'control' file which will instruct the SQLPLUS Loader on how it should load the data into the database. The SQLPLUS loader can parse most text based files.
-
STEP 3b. Create a file with the file extention of ".ctl". In this case, we will call it csv.ctl
-
STEP 3c. Enter the following lines into the file
LOAD DATA
INFILE 'D:\Programming\SQL\data\earthquake.csv'
TRUNCATE
INTO TABLE EARTHQUAKE
fields terminated by ","
(
earthquake_id,
occured_on,
latitude,
longitude,
depth,
magnitude,
calculation_method,
network_id,
place,
cause
)
- STEP 4. Use the following command to call sqlldr
sqlldr userid=<username>/<password> control='<full path to .ctl file>'