RelationalDBDesign RelationalDBDesign


SQL*Loader   «Prev  Next»
Lesson 2 SQL*Loader improvements
Objective List improvements to SQL*Loader.

SQL*Loader Improvements

SQL*Loader, Oracle's data loading tool, has been enhanced for Oracle. The improvements are significant because they open up the capabilities of SQL*Loader to a wider variety of uses. The following Slide Show illustrates the SQL*Loader enhancements.

  1. Load data directly into large objects. You can load individual data files into LOB columns in the database. The data files can be images, documents, or any other kind of data, up to the 4GB maximum size for a LOB column.
  2. Load data into Oracle objects and collections. The control file can specify how to load data into a collection or object data types such as a REF data type.
  3. Use (API) Application Programmer Interface to access SQL*Loader. You can create a customized application that reads in data and uses the SQL*Loader engine to load the data into the databse. No control file is used.

SQL Loader New Features
These new features go a long way to making SQL*Loader more effective for databases that are used for Web applications.

SQL*Loader Parameters

SQL*Loader is invoked when you specify the sqlldr command and, optionally, parameters that establish session characteristics. In situations where you always use the same parameters for which the values seldom change, it can be more efficient to specify parameters using the following methods, rather than on the command line:
  1. Parameters can be grouped together in a parameter file. You could then specify the name of the parameter file on the command line using the PARFILE parameter.
  2. Certain parameters can also be specified within the SQL*Loader control file by using the OPTIONS clause.
Parameters specified on the command line override any parameter values specified in a parameter file or OPTIONS clause.

SQL*Loader Control File

The control file is a text file written in a language that SQL*Loader understands. The control file tells SQL*Loader where to find the data, how to parse and interpret the data, where to insert the data, and more. Although not precisely defined, a control file can be said to have three sections. The first section contains session-wide information, for example:
  1. Global options such as bindsize, rows, records to skip, and so on
  2. INFILE clauses to specify where the input data is located
  3. Data to be loaded

The second section consists of one or more INTO TABLE blocks. Each of these blocks contains information about the table into which the data is to be loaded, such as the table name and the columns of the table. The third section is optional and, if present, contains input data. Some control file syntax considerations to keep in mind are:
  1. The syntax is free-format (statements can extend over multiple lines).
  2. It is case insensitive; however, strings enclosed in single or double quotation marks are taken literally, including case.
  3. In control file syntax, comments extend from the two hyphens (--) that mark the beginning of the comment to the end of the line. The optional third section of the control file is interpreted as data rather than as control file syntax; consequently, comments in this section are not supported.
  4. The keywords CONSTANT and ZONE have special meaning to SQL*Loader and are therefore reserved. To avoid potential conflicts, Oracle recommends that you do not use either CONSTANT or ZONE as a name for any tables or columns.
The next lesson demonstrates two of the new features of SQL*Loader.