## IMPORT COLUMNS Command

You can use the Loader’s IMPORT COLUMNS command to control the import of application data into a table.

### Prerequisites

The table exists in the database. Otherwise, it must be created before the IMPORT COLUMNS command is executed.

You have either exported the required data with the corresponding EXPORT command or the data is available in the specified data format.

### Syntax

<import_columns_command > ::= IMPORT COLUMNS TABLE <table_name>
[<if_condition>] [<duplicates_clause>]
<import_column_spec> ...
<data_instream_column_spec>

<table_name> ::= table name

<if_condition> ::= selecting data records
<duplicates_clause> ::= REJECT DUPLICATES
| IGNORE DUPLICATES
| UPDATE DUPLICATES

<import_column_spec> ::= column description

<data_instream_column_spec> ::= DATA <instream_columnformat_spec>
[<import_lobcolumn_spec> ...]
<instream_columnformat_spec> ::= data stream
<import_lobcolumn_spec> ::= exporting and importing LONG values

### Examples

Loader Tutorial, IMPORT COLUMNS

### Explanation

The Loader generates an internal mass INSERT statement from the IMPORT COLUMNS command and then executes it.

During the import operation, all of the tables modified by this IMPORT COLUMNS command can also be read and changed by other database users.

#### <duplicates_clause>

You use the DUPLICATES rule to specify how to proceed when importing data from a data stream if a row with the same key as the new row already exists in the table. This rule is only evaluated if the data is not imported into the database in the PAGES data format.

REJECT DUPLICATES | The new line is rejected with an error message. Default value: REJECT DUPLICATES
IGNORE DUPLICATES | The new line is not inserted.
UPDATE DUPLICATES | The new line overwrites the existing line.

### Result

The data in the data stream has been imported to the target table(s). All of the changes made to the target table(s) as a result have also been written to the log area of the database instance.

You use either the command IMPORT COLUMNS TABLE * ... DATA ... or the command IMPORT TABLE ... DATA ... to import all the application data of a table. The corresponding data stream must contain data for all the table’s columns. If not, the Loader reports an error.

### Errors

If the import operation cannot be completed successfully, the Loader logs the last row that was successfully inserted in the table, the number of rows inserted, and the number of rows rejected in the log file.

See also:

Importing: Commands

EXPORT COLUMNS Command

Log File