Using the Data Workshop to Manage Data

The Data Load/Unload wizards in Oracle Application Express enable you to easily load and unload delimited text data to and from the database. The step-by-step wizards have the following features:

  • You can load or unload XML files or delimited-field text files (such as comma-delimited (.csv) or tab-delimited files).

  • You can load by copying and pasting from a spreadsheet.

  • You can omit (skip) columns when loading or unloading.

  • You can load into an existing table or create a new table from the loaded data.

  • When loading into a new table, the primary key can be taken from the data or generated from a new or existing Oracle sequence.

  • When loading into a new table, column names can be taken from the loaded data.

  • Each time that you load from a file, file details are saved in a Text Data Load Repository. You can access these files from within the repository at any time.

Limitations include the following:

  • The wizards load and unload table data only. They do not load or unload other kinds of schema objects.

  • You can load and unload to and from your own schema only. This is also true for users with administrator privileges.

  • You can load or unload only a single table at a time.

  • There are no data type limitations for unloading to text or XML files, or for loading from XML files. However, when loading from spreadsheets (through copy and paste) or from text files, only the following data types are supported: NUMBER, DATE, VARCHAR2, CLOB, BINARY_FLOAT, and BINARY_DOUBLE.

Supported unload formats include:

  • Text such as comma-delimited or tab-delimited data

  • XML documents

Topics:

About Importing, Exporting, Loading, and Unloading Data

You have several options when copying data between Oracle databases or between an Oracle database and external files. Data copying is accomplished by exporting and importing data, and by unloading and loading data. The following table defines these terms.


Term Definition

Exporting

Copying database data to external files for import into another Oracle database only. The files are in a proprietary binary format.

Importing

Copying data into the database from external files that were created by exporting from another Oracle database.

Unloading

Copying database data to external text files for consumption by another Oracle database or another application (such as a spreadsheet application). The text files are in an industry-standard format such as tab-delimited or comma-delimited (CSV).

Loading

Copying data into the database from external text files that are in either a standard delimited format or in any of the formats that are supported by the Oracle SQL*Loader utility.


You can export data from any Oracle Database edition (Express Edition, Standard Edition, and Enterprise Edition) into any other edition.

Topics:

Choosing the Right Import/Export/Load/Unload Option

The Oracle Database and Oracle Application Express provide several powerful options for importing, exporting, loading, and unloading data. Table 4-2 provides a summary of these options.


Table 4-2 Summary of Oracle Application Express Import/Export Options

Feature or Utility Description

Data Load/Unload wizards in Oracle Application Express

  • Easy to use graphical interface

  • Loads/unloads from and to external text files (delimited fields) or XML files

  • Loads/unloads tables only, one table at a time

  • Access only to schema of logged-in user

  • No data filtering on upload

SQL*Loader utility

  • Command-line interface, invoked with sqlldr command

  • Bulk-loads data into the database from external files

  • Supports numerous input formats, including delimited, fixed record, variable record, and stream

  • Loads multiple tables simultaneously

  • Powerful data filtering capabilities

Data Pump Export and Data Pump Import utilities

  • Command-line interface, invoked with expdp and impdp commands

  • Exports and imports from one Oracle database to another (proprietary binary format)

  • Imports/exports all schema object types

  • Imports/exports entire database, entire schema, multiple schemas, multiple tablespaces, or multiple tables

  • Powerful data filtering capabilities

  • High speed

Export and Import utilities

  • Command-line interface, invoked with exp and imp commands

  • Exports and imports from one Oracle database to another (proprietary binary format)

  • Supports XMLType data

  • Does not support the FLOAT and DOUBLE data types

  • Capabilities similar to Data Pump; Data Pump is preferred


Table 4-3 provides several load, unload, import, and export scenarios and suggests the appropriate option to use for each.


Table 4-3 Import/Export Scenarios and Recommended Options

Import/Export Scenario Recommended Option

You have fewer than 10 tables to load, the data is in spreadsheets or tab-delimited or comma-delimited text files, and there are no complex data types (such as objects or multivalued fields).

Data Load/Unload wizards in Oracle Application Express

You have to load data that is not delimited. The records are fixed length, and field definitions depend on column positions.

SQL*Loader

You have tab-delimited text data to load, and there are more than 10 tables.

SQL*Loader

You have text data to load, and you want to load only records that meet certain selection criteria (for example, only records for employees in department number 3001).

SQL*Loader

You want to import or export an entire schema from or to another Oracle database. There is no XMLType data in any of the data.

Data Pump Export and Data Pump Import

You want to import or export data from or to another Oracle database. The data contains XMLType data and contains no FLOAT or DOUBLE data types.

Import (imp) and Export (exp)


See Also:

Oracle Database Utilities for more information on Data Pump, the Import and Export utilities, and SQL*Loader

Accessing the Data Load/Unload Page

To access the Data Load/Unload page:

  1. On the Workspace home page, click the SQL Workshop icon.

  2. Click Utilities.

  3. Click Data Workshop.

    The Data workshop page appears.

  4. Click the appropriate icon to load data, unload data, or view the repository.

Loading Data

You can load data into the Oracle Application Express database in the following ways:

  • Copy and paste data from a spreadsheet.

  • Upload a spreadsheet file in a delimited format (such as comma-delimited (.csv) or tab-delimited).

  • Upload a text file containing comma-delimited or tab-delimited data.

  • Upload an XML document.

Topics:

Loading a Text File or Spreadsheet Data

You can upload a Text file or copy and paste tab-delimited data directly into the Load Data Wizard.

To load data from a text file:

  1. On the Workspace home page, click the SQL Workshop icon.

  2. Click Utilities.

  3. Click Data Workshop.

  4. Under Data Load, click Text Data.

    The Load Data Wizard appears.

  5. Under Load To, select either Existing table or New table.

  6. Under Load From, select either Upload file or Copy and paste.

    • Upload file - Select to specify an existing text file to upload.

    • Copy and paste - Select to create a text file to upload by performing a copy and paste.

  7. Click Next.

  8. If you selected Upload file, under Load Data, make the following changes:

    • Text File - Browse for or enter the name of the Text File to load.

    • Separator - Enter the column separator character. See Item Help for more details.

    • Optionally Enclosed By - If your data contains a delimiter character, enter it here. See Item Help for more details.

    • First row contains column names - Check this box if the first row of your data contains column names.

    • File Character Set - Select the character set in which your text file is encoded. See Item Help for more details.

  9. If you selected Copy and paste, under Data make these changes:

    • Data - Enter the text file to upload.

    • First row contains column names - Check this box if the first row of your data contains column names.

  10. Under Globalization, make the following changes:

    • Currency Symbol - If your data contains an international currency symbol, enter it here. See Item Help for more details.

    • Group Separator - If your data contains a character that separates integer groups, for example to show thousands and millions, enter it here. See item Help for more details.

    • Decimal Character - If your data contains a character that separates the integer and decimal parts of a number, enter it here. See item Help for more details.

  11. Click Next.

    The table Properties page appears. Before performing the data upload, this page allows you to optionally customize the data.

  12. For Table Properties, make the following changes and click Next:

    • Schema - Select the schema containing the table to load.

    • Table Name - Identify the table name you want to create. By default, all table names are converted to upper case. Select Preserve Case to override this default behavior.

    • Column Names - Enter the names of the columns.

    • Data Type - Select the data type for this column.

    • Column Length - Enter the length of the data in this column.

    • Upload - Select Yes to upload data for this column. Select No to not upload data for this column and skip to the next column.

  13. For Primary Key, make the following changes:

    • Primary Key From - Define the primary key column by choosing either an existing column or creating a new column. Options include:

      • Use an existing column - If you choose an existing column you must select the column from the columns being loaded.

      • Create new column - If you choose to create a new column, you must specify the name of the new column.

    • Constraint Name - The constraint name defaults to the table name appended with _PK. You can update the name if desired.

    • Primary Key Population - You must decide how your primary key is populated. You either generate it from a new sequence, from a new sequence or not at all. Options include:

      • Generated from a new sequence - If you choose a new sequence, you can use the sequence name given or update it as necessary. The sequence is created for you.

      • Generated from an existing sequence - If you choose an existing sequence, you must select the sequence from those currently defined in your schema.

        If you generate the primary key from a sequence, either new or existing, the wizard creates a trigger on the table to retrieve the next sequence value and populate the primary key when a record is inserted.

      • Not generated

  14. Click Load Data.

Loading an XML Document

Oracle Application Express supports XML documents in Oracle's canonical XML format.

In Oracle's canonical XML format, each element represents a column value, each element is named after the column, all elements that are part of the same row are children of a <ROW> element, and all <ROW> elements are children of a <ROWSET> element.

To load an XML document:

  1. On the Workspace home page, click the SQL Workshop icon.

  2. Click Utilities.

  3. Click Data Workshop.

  4. Click XML Data.

    The Load XML Data Wizard appears.

  5. Select the appropriate schema for your data and click Next.

  6. Select the table to load the data into and click Next.

  7. Follow the on-screen instructions.

Unloading Data

You can use the Unload page to export the contents of a table to a text file or XML document.

Topics:

Unloading a Text File

Use the Unload to Text Wizard to export the contents of a table to a text file. For example, you could export an entire table to a comma-delimited file (.csv).

To unload a table to a text file:

  1. On the Workspace home page, click the SQL Workshop icon.

  2. Click Utilities.

  3. Click Data Workshop.

  4. Under Data Unload, click To Text.

    The Unload to Text Wizard appears.

  5. Select the appropriate schema and click Next.

  6. Select the table to unload and click Next.

  7. Highlight the columns to include, optionally enter a Where Clause to limit the records unloaded and click Next.

  8. For Options, enter the following:

    • Separator - Enter the type of separator used to separate column values.

    • Optionally Enclosed By - If your data contains a delimiter character, enter it here. See item Help for more details.

    • Include Column Names - Check this box to include the name of each column in the text file. See item Help for more details.

    • File Format - Select the appropriate file format. See item Help for more details.

    • File Character Set - Select the character set in which your text file is encoded. See item Help for more details.

  9. Click Unload Data.

    The File Download window appears.

  10. Click Save to download the file.

Unloading to an XML Document

Use the Unload to XML Wizard to export the contents of a table to an XML document adhering to the Canonical XML specification.

To unload a table to an XML document:

  1. On the Workspace home page, click the Utilities icon.

  2. Click Data Workshop.

  3. Under data Unload, click to XML.

    The Unload to XML Wizard appears.

  4. Select the appropriate schema and click Next.

  5. Select the table to unload and click Next.

  6. Highlight the columns to include.

  7. Check Export as File to save the output directly to a file.

    If you do not check Export as File, the XML document is displayed in your browser and can be saved to a file or cut and pasted as necessary.

  8. Optionally enter a Where Clause to limit the records unloaded, and click Unload Data.

    A browser displays the XML data.

Using Repository

Loaded text data files and spreadsheets are stored in the Repository.

To access the different repositories:

  1. On the Workspace home page, click the Utilities icon.

  2. Click Data Workshop.

  3. Make one of the following selections:

    • Import Repository - Displays the status of loaded Text data. Details include file name, imported by, imported on, schema, table, bytes, and the number of rows that were loaded successfully and the number were not.

      By clicking the details magnifying glass you can review the failed rows.

    • Spreadsheet Imports - Displays the status of loaded spreadsheet data. Details include file name, imported by, imported on, schema, table, and the number of rows that were loaded successfully and the number were not.

      By clicking the details magnifying glass you can review the failed rows.

  4. To filter the display, make a selection from the Show list and click Go.

  5. To view information about a specific file, click the View icon.

  6. To delete an imported file, select it and click Delete Checked.