Loading Data from a Local File to a New Table

Note

This feature is not available for MySQL database services.

To load data from a local file to a new table:

Note

You can also follow the steps in Loading Data from Multiple Local Files into Mutiple Tables to load data to a new table.
  1. You can start in one of the following ways:

    • In the Navigator tab, in the left pane, click Object submenu (""), select Data Loading, and then select Upload Data into New Table.

      This image depicts the Data Loading option in the left pane in SQL Worksheet.

    • In the Navigator tab, drag and drop the local file into the left pane. When you drag a file into the pane, the following message is displayed Drop the file here to start.

    The Upload Data into New Table is displayed. A preview of the data is displayed in a grid format.

  2. Click Show/Hide options "" to display options that you can modify for data preview:

    • Column names: Select Get from file to display column headers in the first row.

    • Encoding: An option to select the encoding type is visible when the loaded file is in plain text format (CSV, TSV, or TXT). The default encoding type is UTF-8.
    • Text enclosure and Field delimiter: These options are visible only when the selected file is in plain text format (CSV, TSV, or TXT). Select or enter the character used in the source file for text enclosure and field delimiter.

    • Rows to skip: Enter or use the up and down arrows to select the number of rows to skip.

    • Preview size: Enter or use the up and down arrows to select the number of rows to preview.

    • Limit rows to upload: If you select this option, you need to specify the rows to load. Use the up and down arrows to select the number of rows to load.

    To remove the options selected and the data preview, click Clear.

    After selecting the required options, click Apply, and then click Next.

  3. In Table Definition, do the following:

    • In the Table Name field, enter a name for the target table.

    • Select the check box at the beginning of a row to add the column to the target table.

    • Select or enter values for column attributes such as Column Name, Column Type, Precision, Scale, Default, Primary Key and Nullable.

    • The Format Mask column appears for date, timestamp and numeric types of data. For date and timestamp types, you must select a value from the drop-down list or type the value in the Format Mask field. For numeric types, the format mask is optional.

      For a date and timestamp column, you need to supply a compatible format mask that describes the data being uploaded. For example, if the date data looks like 12-FEB-2021 12.21.30, you need to supply a date mask of DD-MON-YYYY HH.MI.SS. The format mask is automatically determined based on the data in the file. You need to review the suggested format mask and if needed, modify it by entering the format directly into the target cell.

    This image depicts the Table Definition step when loading data into a new table in SQL Worksheet.

    Click Next.

  4. Review the generated DDL code based on the selections made in the previous screens. The mapping of the source to target columns are also displayed.

    Click Finish. After the data is successfully loaded, the new table is displayed in the Navigator tab.

  5. For a detailed report of the total rows loaded and failed, do one of the following:
    • Right-click the table in the Navigator tab, select Data Loading, and then select History. This displays the report for a specific table.

    • In the Navigator tab, select Object submenu "", select Data Loading, and then select History. This displays the report for all tables in the schema that is selected in the Navigator tab.

    • In the worksheet output pane, select the Data Loading tab. This displays the report for all visible tables (including tables from other schemas).

    A summary of the data loaded is displayed in the History dialog. If any data failed to load, you can view the number of failed rows in the Failed Rows column. Click the failed rows column to open a dialog showing the failed rows.

    In the History dialog, you can also search for files loaded by schema name, table name, or file name. To remove the loaded files, click Remove all history "".