Description: You can use the Derby import procedures to import all of the data from table or query, or to import LOB data separately from the other data.
Keywords: import and export procedures, bulk import, importing data, system procedures, import using

# Importing data using the built-in procedures

You can use the Derby import procedures to import all of the data from table or query, or to import LOB data separately from the other data.

Choose the correct procedure for the type of import that you want to perform. For examples of these procedures, see Examples of bulk import and export.

Type of import | Procedure to use
--- | ---
To import all the data to a table, where the import file contains the LOB data |
    SYSCS_UTIL.SYSCS_IMPORT_TABLE
     (IN SCHEMANAME VARCHAR(128),
      IN TABLENAME VARCHAR(128),
      IN FILENAME VARCHAR(32672),
      IN COLUMNDELIMITER CHAR(1),
      IN CHARACTERDELIMITER  CHAR(1),
      IN CODESET VARCHAR(128),
      IN REPLACE SMALLINT)
To import the data to a table, where the LOB data is stored in a separate file and the main import file contains all of the other data with a reference to the LOB data |
    SYSCS_UTIL.SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE
     (IN SCHEMANAME VARCHAR(128),
      IN TABLENAME VARCHAR(128),
      IN FILENAME VARCHAR(32672),
      IN COLUMNDELIMITER CHAR(1),
      IN CHARACTERDELIMITER CHAR(1),
      IN CODESET VARCHAR(128),
      IN REPLACE SMALLINT)
The import utility looks in the main import file for a reference to the location of the LOB data. The format of the reference to the LOB stored in the main import file must be `lobsFileName.Offset.length/`.
To import data from a file to a subset of columns in a table, where the import file contains the LOB data |
    SYSCS_UTIL.SYSCS_IMPORT_DATA
     (IN SCHEMANAME VARCHAR(128),
      IN TABLENAME VARCHAR(128),
      IN INSERTCOLUMNS VARCHAR(32672),
      IN COLUMNINDEXES VARCHAR(32672),
      IN FILENAME VARCHAR(32672),
      IN COLUMNDELIMITER CHAR(1),
      IN CHARACTERDELIMITER CHAR(1),
      IN CODESET VARCHAR(128),
      IN REPLACE SMALLINT)
You must specify the insertColumns parameter on the table into which data will be imported. You must specify the columnIndex parameter to import data fields from a file to column in a table.
To import data to a subset of columns in a table, where the LOB data is stored in a separate file and the main import file contains all of the other data with a reference to the LOB data |
    SYSCS_UTIL.SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE
     (IN SCHEMANAME VARCHAR(128),
      IN TABLENAME VARCHAR(128),
      IN INSERTCOLUMNS VARCHAR(32672),
      IN COLUMNINDEXES VARCHAR(32672),
      IN FILENAME VARCHAR(32672),
      IN COLUMNDELIMITER CHAR(1),
      IN CHARACTERDELIMITER CHAR(1),
      IN CODESET VARCHAR(128),
      IN REPLACE SMALLINT)
The import utility looks in the main import file for a reference to the location of the LOB data. The format of the reference to the LOB stored in the main import file must be `lobsFileName.Offset.length/`.

- Parameters for the import procedures
  The Derby import procedures use specific parameters.
- Import into tables that contain identity columns
  You can use the either the SYSCS_UTIL.SYSCS_IMPORT_DATA procedure or the SYSCS_UTIL.SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE procedure to import data into a table that contains an identity column.

Parent topic: Using the bulk import and export procedures
Related concepts
Methods for running the import and export procedures
Bulk import and export of large objects
File format for input and output
Import and export procedures from JDBC
How the Import and export procedures process NULL values
Bulk import and export requirements and considerations
Related tasks
Exporting data using the built-in procedures
Related reference
CODESET values for import and export procedures
Examples of bulk import and export
Parameters for the import procedures