How to import a CSV file into the Oracle table

This topic describes how to import data from a CSV file.

Note

Data Import Wizard pages can slightly differ due to the product you have been using.

  1. Decide what table to import the data to:

    For a new table:

    • On the Database menu, click Import Data.

    For an existing table:

    • In Database Explorer, right-click a table and select Import Data on the shortcut menu. The Data Import wizard opens with predefined parameters: a Oracle connection, a database, and a table to import the data to.

      -or-

    • On the Database menu, click Import Data, and select a required table on the Destination table wizard tab.

  2. In the Data Import wizard, select a CSV import format, specify a location of the Source data, and click Next.
  3. On the Data Import > Destination tab, specify the Oracle connection, select the database, and table to import the data to, and then click Next.

    Note:

    If you selected a table in Database Explorer before opening the Data Import wizard, the wizard will open with the predefined connection parameters of the selected table. To add a new connection or edit the Oracle connection, use the corresponding options.

  4. On the Data Import > Options tab, set import options for the file format you have selected and then click Next:
    • Set a quantity of lines to skip during the import. Lines are counted from the top.
    • Select the line number where the table header is located. It will be highlighted with blue in the Preview section. If you don’t specify the header position, the imported columns will get default names - column1, column2, etc.
    • Specify a column delimiter. See the result in the Preview section.

    Set Oracle csv import options

  5. On the Data Import > Data Formats tab, specify data formats for the Source data and click Next.
  6. On the Data Import > Mapping tab, map the columns to the Target table columns.

    Note:

    If you are importing the data into a new table, dbForge Studio will automatically create and map all the columns.

    If you are importing into an existing table, only columns with the same names will be mapped, the rest should be mapped manually. (If no columns with the same name are found, they are mapped in succession - the 1st column in Source with the 1st column in Target, etc.) The Target columns are displayed on the top while the Source columns - at the bottom of the wizard page. Click the Source column fields and select required columns from the drop-down list.

    To cancel mapping of all the columns, click Clear Mappings on the toolbar. To restore mapping of columns, click Fill Mapping.

    Oracle load data from csv - Column mapping

    If you are importing to a new table, you can edit the Target column properties by double-clicking them in the top grid. Select the Key check box for a column with a primary key and click Next.

    Note

    You should select at least one column with a primary key; otherwise, some of import modes on the Modes wizard page will be disabled.

  7. On the Data Import > Modes tab, choose an import mode for the data, and then click Next.
  8. On the Data Import > Output tab, select one of the following import options to manage the data import script, and then click Next:

    • Open the data import script in the internal editor
    • Save the data import script to a file
    • Import data directly to the database
  9. On the Data Import > Errors Handling tab, select the way to handle errors during import and specify whether you want to get a log file with details about the import session.
  10. To start importing, click Import and view the import progress. dbForge Studio will notify you whether the import completed successfully or failed.
  11. Click Finish to close the wizard.

    Note

    You can save the import settings as a template for future uses. Click Save on any wizard page to save the selected settings. Next time you should only select a template and specify a location of the Source data - all the settings will be already set. For more information, go to Saving and Using Templates topic.

You can download a trial version of dbForge Studio for Oracle as well as learn more about its feature-rich Data Export/Import utilities on the Devart website.