This section describes how to use Oracle Application Express utilities to build SQL queries, load and unload data from an Oracle database, generate DDL, view object reports, manage User Interface Defaults, restore dropped database objects, compare schemas, monitor the database, and view database details.
Data Workshop allows you to load and unload data to the database.
The Data Load and Data 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:
Limitations include the following:
Supported unload formats include:
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.
The Oracle Database and Oracle Application Express provide several powerful options for importing, exporting, loading, and unloading data. Table 5-1 provides a summary of these optio ns.
Table 5-1 Summary of Oracle Application Express Import/Export Options
Data Load/Unload wizards in Oracle Application Express
Data Pump Export and Data Pump Import utilities
Export and Import utilities
Table 5-2 provides several load, unload, import, and export scenarios and suggests the appropriate option to use for each.
Table 5-2 Import/Export Scenarios and Recommended Options
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.
You have tab-delimited text data to load, and there are more than 10 tables.
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).
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 )
Oracle Database Utilities for more information on Data Pump, the Import and Export utilities, and SQL*Loader
To access the Data Load/Unload page:
The Load Data Wizard is used to copy and paste or upload data.
You can load data into the Oracle Application Express database in the following ways:
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:
See field-level help for more details about a specific attribute.
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 element, and all elements are children of a element.
To load an XML document:
The Unload page is used to export the contents of a table to a text file or XML document.
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:
See field-level help for more details.
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:
Loaded text data files and spreadsheets are stored in the Repository.
To access the different repositories:
With Oracle Application Express, you can generate data definition language (DDL) statements from the Oracle data dictionary. You can use these scripts to create or re-create database schema objects. The scripts can be generated to display inline or saved as a script file. You can generate the create scripts for all objects for a specific schema, specific object types, or specific objects.
To generate a DDL statement:
The Managing Methods on Tables utility enables you to create an application programming interface, or package, based on a specified table.
To create a package:
Utilities includes a variety of object reports to help you better manage the objects in your database.
Use the Table reports to view specific details about the tables within your database.
To view the Table reports:
"Customizing an Interactive Report Using the Actions Menu" in Oracle Application Express End User's Guide
Use the PL/SQL reports to view program unit arguments or unit line counts and also to search PL/SQL source code.
Use the Program Unit Arguments report to view package input and output parameters.
To view the PL/SQL Unit Arguments report:
"Customizing an Interactive Report Using the Actions Menu" in Oracle Application Express End User's Guide
Use the Unit Line Counts report to view the number of lines of code for each object. Use this report to identify larger PL/SQL program units.
To view the Unit Line Counts report:
"Customizing an Interactive Report Using the Actions Menu" in Oracle Application Express End User's Guide
Use the Search PL/SQL Source code page to search the text within your PL/SQL code. Use this report to find references to tables or functions you might be thinking of deleting. You can also use this page to locate code when you can only recall a code snippet.
To search for PL/SQL source code:
"Customizing an Interactive Report Using the Actions Menu" in Oracle Application Express End User's Guide
Use the Exception Reports to view unindexed foreign keys and tables without primary keys, indexes, or triggers.
To view Exception reports:
"Customizing an Interactive Report Using the Actions Menu" in Oracle Application Express End User's Guide
Use the Security reports to view object or column privileges granted on database objects owned by other schemas. You can also use these reports to view database role and system privileges.
To view the Security reports:
"Customizing an Interactive Report Using the Actions Menu" in Oracle Application Express End User's Guide
Use the All Object reports to view objects for the selected schema.
To view the All Object reports:
"Customizing an Interactive Report Using the Actions Menu" in Oracle Application Express End User's Guide and Oracle Database Concepts for information about the data dictionary
You can run a report that compares database objects in two schemas, displaying differences between them. You can compare all objects in the schemas or limit your report to specific objects. To compare two schemas, both must be available to your workspace.
To compare schemas:
Query Builder's graphical user interface enables database developers to build SQL queries without the need for manual SQL coding. Using Query Builder, you can search and filter database objects, select objects and columns, create relationships between objects, view formatted query results, and save queries with little or no SQL knowledge.
SQL commands created in the Query Builder can be accessed from SQL Commands. See "Using SQL Commands"
The Query Builder page is divided into three sections:
To access Query Builder:
The Query Builder home page appears.
You can also access Query Builder from a code editor in many part of Oracle Application Express by clicking the Query Builder button when editing a SQL attribute.
To build a query in Query Builder, you perform the following steps:
This section describes how to use the Object Selection pane.
Use the Object Selection pane to search for and view tables, views, and materialized views within the current schema.
To search or filter objects:
You can hide the Object Selection pane by selecting the Collapse control. The Collapse control displays on the right side of the Object Selection pane. If the Object Selection pane displays, selecting this control hides it. Similarly, if the Object Selection pane is hidden, selecting this control causes the pane restores it. Select the Left Splitter (click above or below the Collapse control to manually resize the Object Selection pane.
The Design pane displays to the right of the Object Selection pane. When you select an object from the Object Selection pane, it appears in the Design pane. You use the Object Selection pane to select objects (that is, tables, views, and materialized views) and the Design pane to identify how those selected objects are used in a query.
This section describes how to use the Design pane.
Columns of all types available in Oracle Database 10 g Release (10.2) or later display as objects in the Design pane. Note the following column restrictions:
You add an object to the Design pane by selecting it from the Object Selection pane.
To add an object to the Design pane:
As you select objects, you can resize Design and Results panes by selecting the Bottom Splitter in the center of the page. The Bottom Splitter resembles a gray horizontal rule in the center of the page. Move the Bottom Splitter up and down to shrink and expand the Design pane.
You remove or hide objects in the Design pane by selecting controls at the top of the object. To remove an object, select the Remove icon in the upper right corner. To temporarily hide the columns within an object, click the Show/Hide Columns icon.
Description of the illustration query_builder_remove.png
Conditions enable you to filter and identify the data you want to work with. As you select columns within an object, you can specify conditions on the Conditions tab. You can use these attributes to modify the column alias, apply column conditions, sort columns, or apply functions.
To specify query conditions:
Condition Attribute | Description |
---|---|
Up and Down Arrows | Controls the order that the columns to be displayed in the resulting query. Click the arrow buttons to move columns up and down. See Also: "Viewing Query Results" |
Column | Displays the column name. |
Alias | Specify an optional column alias. An alias is an alternative column name. Aliases make a column name more descriptive, shorten the column name, or prevent possible ambiguous references. |
Object | Specifies table or view name. |
Condition | Specify a condition for the column. The condition you enter modifies the query's WHERE clause. When specifying a column condition, you must include the appropriate operator and operand. Consider the following examples: |
>=10 ='VA' IN (SELECT dept_no FROM dept) BETWEEN SYSDATE AND SYSDATE + 15
Enter a number (1, 2, 3, and so on) to specify the order in which selected columns should display.
Select this check box to include the column in your query results. It is not necessary to select Show to add a column to the query for filtering only.
For example, suppose you want to create following query:
SELECT ename FROM emp WHERE deptno = 10
To create this query in Query Builder:
Select an argument function. Available functions are dependent on the column type and include:
Specify columns to be used for grouping when an aggregate function is used. Only applicable for columns included in output.
Deselect the column, excluding it from the query.
As you select columns and define conditions, Query Builder writes the SQL for you.
You can create relationships between objects by creating a join. A join identifies a relationship between two or more tables, views, or materialized views.
When you write a join query, you specify a condition that conveys a relationship between two objects. This condition is called a join condition . A join condition determines how the rows from one object combine with the rows from another object.
Query Builder supports inner, outer, left, and right joins. An inner join (also called a simple join ) returns the rows that satisfy the join condition. An outer join extends the result of a simple join. An outer join returns all rows that satisfy the join condition and returns some or all of those rows from one table for which no rows from the other satisfy the join condition.
Oracle Database SQL Language Reference for information about join conditions
You can create a join manually by selecting the Join column in the Design pane.
To join two objects manually:
Click here to select column for join
Tip: You can also join two objects by dragging and dropping. Select a column in the first table and then drag and drop it onto a column in another table.
When you join objects automatically, the Query Builder suggests logical, existing parent and child relationships between existing columns.
To join objects automatically:
If using Add Parent or Add child, the selected object appears and a line connects the foreign key columns.
As you create queries, you can save them by clicking the Save button in the Design pane. Once you save a query, you can access it later in the Saved SQL view.
The Saved SQL view only displays queries saved in Query Builder. In SQL Commands you can view queries saved in both SQL Commands and Query Builder.
To save a query:
Note that Query Builder does not support duplicate query names. If you open an existing query, keep the existing name, and save it again, Query Builder over-writes the existing query. If you change the name of an existing query and save it again, Query Builder saves the query again under the new name.
Once you save a query, you can access it in the Saved SQL view.
To edit a Saved SQL query:
To delete a Saved SQL query:
The SQL view presents a read-only, formatted representation of the SQL generated by Query Builder. You can copy the SQL code that appears in the SQL View for use in other tools such as SQL Command Processor or Application Builder.
To access the SQL view:
Once you select objects and determine what columns to include in your query, you execute a query by:
The Results view appears, displaying formatted query results. To export the report as a comma-delimited file (.csv) file, click the Download link at the bottom of the page.
User Interface Defaults enable you to assign default user interface properties for regions and items. This wizard enables you to specify whether you want to use User Interface Defaults if they exist. When you create a form or report using a wizard, the wizard uses this information to create default values for region and item properties. Utilizing user interface defaults can save valuable development time and has the added benefit of providing consistency across multiple pages in an application. User Interface Defaults are divided into two categories, the Table Dictionary and the Attribute Dictionary.
When you use User Interface Defaults during creation of pages and regions, the Table Dictionary takes priority over the Attribute Dictionary. If a table and column combination exists, that is used rather than an attribute definition of the same name. This can be useful, for example, when you want to have a specific label or Help text for the CREATED_BY column in the emp table but then use more generic defaults for CREATED_BY in another table.
If no defaults have been created for a table, use the Table Dictionary Create Defaults wizard to automatically generate defaults based on the database table and column definitions. After the initial defaults are created, you can modify the individual default values.
To create the initial user interface defaults for tables:
Note: Synchronizing defaults with the database data dictionary creates table based defaults for any tables in the current schema that do not have defaults yet and adjusts those of tables that do to match the database definition.
To modify existing table defaults:
Note: A column can be removed from the Table Dictionary, thus allowing the Attribute Dictionary defaults to be used during the creation process. For example, when you have auditing columns where you may want the exact same labels and help across every instance of CREATED_BY and CREATED_ON , regardless of which table they come from, you could simply remove the column defaults from each table for those columns.
Use the Attribute Dictionary Create wizard to define and add new attributes.
To create an attribute:
To modify an existing attribute:
Note: If you select to edit a synonym, identified by having the Synonym of column populated, you are taken to the definition for the base column, because the base column and all synonyms share one definition. To delete the synonym, select the synonym within the Synonyms region. Deleting the base column deletes the column and all synonyms.
You export user interface defaults in the same way you export any related application file. Exporting user interface defaults from one development instance to another involves the following steps:
When you export user interface defaults, all user interface defaults for the selected schema are exported to a single script. The file contains an API call to create table hints by making calls to the application PL/SQL API. You can use this file to import user interface defaults to another database and Oracle Application Express instance.
If you have an account that has been granted a database administrator role, you can view details about your database on the About Database page.
To access details about your database:
The reports available on the Database Monitor page provide a database-wide view of the database sessions, system statistics, SQL statements, and longer operations. You can use these reports to identify poorly performing SQL and to better understand the workload of the database.
To access any of the icons on the Database Monitor page, you must have an account that has been granted a database administrator role.
A session is the connection of a user to an Oracle database instance. A session lasts from the time the user connects until the time the user disconnects or exits the database application.
A session is the connection of a user to an Oracle database instance. A session lasts from the time the user connects until the time the user disconnects or exits the database application.
You must have database administrator privileges to access the Sessions page.
To access reports on the Sessions page:
The Sessions Report displays information about the current sessions in the database. Use the controls at the top of page to narrow the view:
To view session details, click the Session ID (SID). The Session Details page appears. To remove the current session, navigate to the Session Details page and click Kill Session .
The Locks report displays a report of sessions which have locks that are blocking other session(s). To control the number of rows that appear, make a selection from the Rows list and click Go .
The Waits report displays the wait events for each session. Use the controls at the top of page to narrow the view:
To view session details, click the Session ID (SID). The Session Details page appears. To remove the current session, click Kill Session .
The I/0 report displays details about the I/O for each session. Use the controls at the top of page to narrow the view:
To view session details, click the Session ID (SID). The Session Details page appears. To remove the current session, click Kill Session .
The SQL report displays details about the current or last SQL statement executed for each session. Use the controls at the top of page to narrow the view:
To view session details, click the Session ID (SID). The Session Details page appears. To remove the current session, click Kill Session .
The Open Cursors report displays details about the number of open cursors for each session. Use the controls at the top of page to narrow the view:
To view details about a specific open cursor count, click the numeric link under the Open Cursor Count column.
To view session details, click the Session ID (SID). The Session Details page appears. To remove the current session, click Kill Session .
The System Statistics page displays statistics for:
To view the System Statistics page:
Additional controls on the System Statistics page include:
The top SQL statements represent the SQL statements that are executed most often, that use more system resources than other SQL statements, or that use system resources more frequently than other SQL statements. Use the Top SQL page to identify poorly performing SQL.
Use the Top SQL page to identify poorly performing SQL.
To view the Top SQL page:
The Long Operations page displays the status of various operations that run for longer than 6 seconds (in absolute time). These operations currently include many backup and recovery functions, statistics gathering, and query execution, and more operations are added for every Oracle release.
To view the Long Operations page:
You can use the Recycle Bin to view and restore dropped database objects. When you drop a table, the space associated with the table is not immediately removed. The Oracle database renames the table and places it and any associated objects in the Recycle Bin. You can recover objects in the Recycle Bin at a later time.
The Recycle Bin feature is only available if you run with an Oracle 10g or later database.
You can view objects in the Recycle Bin on the Dropped Objects page. Once you select an object and view the Object Details page, you can choose to purge the object or restore the object by clicking the appropriate button.
To view objects in the Recycle Bin:
To empty the Recycle Bin without viewing the objects: