Default: EXECUTE
Purpose
The EXTERNAL_TABLE
parameter instructs SQL*Loader whether to load data using the external tables option.
Syntax and Description
EXTERNAL_TABLE=[NOT_USED | GENERATE_ONLY | EXECUTE]
There are three possible values:
NOT_USED
- the default value. It means the load is performed using either conventional or direct path mode.
GENERATE_ONLY
- places all the SQL statements needed to do the load using external tables in the SQL*Loader log file. These SQL statements can be edited and customized. The actual load can be done later without the use of SQL*Loader by executing these statements in SQL*Plus.
EXECUTE
- attempts to execute the SQL statements that are needed to do the load using external tables. However, if any of the SQL statements returns an error, then the attempt to load stops. Statements are placed in the log file as they are executed. This means that if a SQL statement returns an error, then the remaining SQL statements required for the load will not be placed in the log file.
Note that the external table option uses directory objects in the database to indicate where all data files are stored and to indicate where output files, such as bad files and discard files, are created. You must have READ
access to the directory objects containing the data files, and you must have WRITE
access to the directory objects where the output files are created. If there are no existing directory objects for the location of a data file or output file, then SQL*Loader will generate the SQL statement to create one. Therefore, when the EXECUTE
option is specified, you must have the CREATE
ANY
DIRECTORY
privilege. If you want the directory object to be deleted at the end of the load, then you must also have the DROP
ANY
DIRECTORY
privilege.
The EXTERNAL_TABLE=
EXECUTE
qualifier tells SQL*Loader to create an external table that can be used to load data and then execute the INSERT
statement to load the data. All files in the external table must be identified as being in a directory object. SQL*Loader attempts to use directory objects that already exist and that you have privileges to access. However, if SQL*Loader does not find the matching directory object, then it attempts to create a temporary directory object. If you do not have privileges to create new directory objects, then the operation fails.
To work around this, use EXTERNAL_TABLE=
GENERATE_ONLY
to create the SQL statements that SQL*Loader would try to execute. Extract those SQL statements and change references to directory objects to be the directory object that you have privileges to access. Then, execute those SQL statements.
Restrictions
None
Example
sqlldr hr TABLE=employees EXTERNAL_TABLE=NOT_USED