Database Reference
In-Depth Information
Now we invoke SQLLDR from the OS command line in express mode:
$ sqlldr eoda table=dept
Password:
SQL*Loader: Release 12.1.0.1.0 - Production on Sat Mar 8 14:45:53 2014
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
Express Mode Load, Table: DEPT
Path used: External Table, DEGREE_OF_PARALLELISM=AUTO
Table DEPT:
4 Rows successfully loaded.
Check the log files:
dept.log
dept_%p.log_xt
for more information about the load.
Since express mode was able to create a directory object, an external table using
dept.dat
as its data source is
accessed by an
INSERT
statement to load the data into the
DEPT
table. After the load is finished, the external table
is dropped.
All of the code required to perform the prior steps is generated and recorded in the
dept.log
file. This file is
automatically populated for you when running SQLLDR in express mode. If you only want SQL*Loader to generate
the log file and not execute its contents, then specify the
EXTERNAL_TABLE=GENERATE_ONLY
option. For example:
$ sqlldr eoda table=dept external_table=generate_only
If you inspect the
dept.log
file, you'll see the code that was generated. First, there's a SQLLDR control file
(SQLLDR control files are described in detail in the SQLLDR section of this chapter):
OPTIONS(EXTERNAL_TABLE=EXECUTE, TRIM=LRTRIM)
LOAD DATA
INFILE 'dept'
APPEND
INTO TABLE DEPT
FIELDS TERMINATED BY ","
(
DEPTNO,
DNAME,
LOC
)
Next is the SQL that will create an external table:
CREATE TABLE "SYS_SQLLDR_X_EXT_DEPT"
(
"DEPTNO" NUMBER(2),
"DNAME" VARCHAR2(14),
"LOC" VARCHAR2(13)
)
ORGANIZATION external
(
TYPE oracle_loader
DEFAULT DIRECTORY SYS_SQLLDR_XT_TMPDIR_00000
ACCESS PARAMETERS