Skip Headers

Oracle® HTML DB User's Guide
Release 1.5

Part Number B10992-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

5 Using SQL Workshop to Manage Database Objects

This section provides information on how to use SQL Workshop to view and manage database objects as well as browse the data dictionary.

This section contains the following sections:


See Also:


About SQL Workshop

You can use SQL Workshop to view and manage database objects from a Web browser. SQL Workshop includes the following navigation tabs:

To access SQL Workshop:

  1. Click the SQL icon. (See Figure 5-1).

  2. Under SQL Workshop, select the appropriate link, or click the SQL, Scripts, or Browse tabs at the top of the page.

About Transaction Support

Oracle HTML DB is a browser based development environment which communicates over HTTP. Because HTTP is a stateless protocol, any command you issue using SQL Workshop is automatically followed by a database COMMIT. There is no support for transactions that span multiple pages in the SQL Workshop. For example, it not possible issue an UPDATE statement on one page in the SQL Workshop and then revert it on a subsequent page using a ROLLBACK command.

Since the commands COMMIT, ROLLBACK and SAVEPOINT are executed as one transaction, you can include these commands in SQL Workshop by using scripts


See Also:

Using the SQL Script Repository for information on running scripts

About Support for SQL*Plus Commands

SQL Workshop does not support SQL*Plus commands. If you attempt to enter a SQL*Plus command in SQL Workshop an error message displays. The following are examples of unsupported SQL*Plus commands:

SET ECHO OFF
SET ECHO ON
SET VERIFY ON
SET LONG 600
COLUMN dummy NOPRINT
COLUMN name FORMAT A20
DEFINE
ACCEPT
PROMPT
REMARK
SHOW

Viewing Database Objects

You can use SQL Workshop to view database objects. For example, you can view details about database objects by querying the Oracle dictionary. You can also run SQL commands and SQL scripts in the SQL Command Processor or view database objects in the Database Browser.

Topics in this section include:

Using the SQL Command Processor

You can use the SQL Command Processor to run SQL commands and SQL scripts on any Oracle database schema for which you have privileges.

To use the SQL Command Processor:

  1. Click the SQL icon and select the SQL tab.

    The SQL Command Processor appears.

  2. Select a schema from the list and follow the on-screen instructions.

  3. To run entered commands, click Run SQL.

  4. To save entered commands, click Save.


See Also:

"Accessing Saved Commands in the SQL Archive" for more information on viewing saved commands and queries

About Command Termination

You can terminate commands in the Command Processor using either a semicolon (;) or forward slash (/). Consider the following examples:

INSERT INTO emp
      (50,'John Doe','Developer',10,SYSDATE,1000,10);

INSERT INTO emp
      (50,'John Doe','Developer',10,SYSDATE,1000,10)
/

The first example demonstrates the use of a semicolon (;). The second example demonstrates the use of forward slash (/).

Using Explain Plan

Use the Explain Plan link to view the plan the Oracle Optimizer uses to run your SQL Command.

To view the Explain Plan:

  1. Click the SQL icon.

  2. Select the SQL tab and then Plan.

    Explain Plan appears.

  3. Enter a command in the field provided and click Explain Plan.

Browsing Database Objects

You can use the Data Browser to view database objects. To find a database object, select the schema you would like to view. The values available in the schema depend upon your resource privileges.

To browse database objects:

  1. Click the SQL icon and select the Browse tab.

    The Data Browser appears.

  2. To view details about a specific object, click the view icon.

To search for database objects:

  1. Click the SQL icon.

  2. Select the Browse tab and then Search Objects.

  3. Enter search criteria in the fields provided and click Go.

You can search for columns within tables or text within source code by entering a search string in the Search field and selecting a Search Option at the top of the page. Searches are case insensitive and no wildcards or quotes are necessary.

Querying by Example

Once you have located a specific table you can query the Oracle data dictionary to discover more details.

To Query by Example:

  1. Click the SQL icon and select the Browse tab.

    The Data Browser appears.

  2. To view details about a specific object, click the view icon.

    The Object Detail appears.

  3. Select Query by Example from the Tasks list.

  4. Follow the on-screen instructions.

Viewing Database Objects by Object Type

You can also use the Data Browser to view database objects by type.

To view database objects by object type:

  1. Click the SQL icon.

  2. Under the Data Browser, select an object type.

    The Data Browser appears.

  3. To view details about a specific object, click the view icon.

  4. Follow the on-screen instructions.

Managing Database Objects

You can use SQL Workshop to manage database objects. For example, you can create new database objects, manage script files and control files, or alter a table.

Topics in this section include:

Browsing Database Objects

You can use the Data Browser to view existing database objects.

To view or edit existing database objects:

  1. Click the SQL icon.

  2. s, select the type of database object you would like to view.

  3. To search for an object, select a schema, an object type, type a search string in the Search field, and click Go.

  4. To view object details, click the view icon adjacent to the appropriate name.

  5. Optionally, select a task from the Tasks list on the right side of the page.

Creating Database Objects

You can create new database objects using the Create Database Object Wizard.

To create new database objects in SQL Workshop:

  1. Click the SQL icon.

  2. From the Tasks list on the right side of the page, select Create a database object.

    The Create Database Object Wizard appears.

  3. Follow the on-screen instructions.

Dropping Database Objects

You can drop database objects using the Drop Database Object Wizard. When you drop a table using this wizard, you also remove all related triggers and indexes.

To drop a database object:

  1. Click the SQL icon.

  2. From the Tasks list on the right side of the page, select Drop database object.

    The Drop Database Object Wizard appears.

  3. Select a schema and then an object type.

  4. Follow the on-screen instructions.

Restoring Dropped Database Objects

If you are running Oracle HTML DB with an Oracle 10g database, 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. Oracle renames the table and places it and any associated objects in the Recycle Bin where it can be recovered at a later time.


Note:

The Recycle Bin feature is only available if you are running Oracle HTML DB with an Oracle 10g database.

To use the Recycle Bin:

  1. Click the SQL icon.

  2. Under SQL Workshop, click Recycle Bin.

    The Recycle Bin appears.

  3. To search for an object, select a schema, an object type, type a search string in the Search field, and click Go.

  4. To view object details, click the view icon adjacent to the appropriate name.

  5. On the Object Summary page you can:

    • Click Restore Object to restore the current object

    • Click Purge to permanently delete the current object

To empty the Recycle Bin without viewing the objects:

  1. Click the SQL icon.

  2. Under SQL Workshop, click Recycle Bin.

    The Recycle Bin appears.

  3. From the Tasks list on the right side of the page, select Purge Recycle Bin.

Using the SQL Script Repository

You can use the SQL Script Repository to view, edit, and run uploaded script files. For example, you can upload new script file as well as create and edit your create table, create index, and create PL/SQL package scripts.

Topics in this section include:

Managing Script Files in the SQL Script Repository

To view scripts in the SQL Script Repository:

  1. Click the SQL icon and select the Scripts tab.

    SQL Script Repository appears. Scripts are stored based on HTML DB username.

  2. To search for a script, select a username from the Show list, enter a search string in the Find field (optional), and click Go.

  3. While in the Script Repository you can:

    • Reorder a list by clicking the column heading

    • View details about a specific file by clicking the view icon

    • Edit a script by clicking the edit icon

    • Parse a script to be run by clicking Parse

    • Run a script by clicking Run in the Actions column

    • Delete a script by selecting it and clicking Delete Checked

    • Upload a script by clicking Upload

    • Create a script by clicking Create

To view script details:

  1. In the Script Repository, click the view icon.

    The Script - Files Details page appears.

  2. Under View Links, you can:

    • Click Native file format to download the file locally

    • Click View document as text to view the file in your Web Browser

    • Click Parse this script to parse the script to run

To run a script in the Script Repository:

  1. In the Actions column, click Run.

    The Script - Run page appears.

    If you have parameters in your script you must define them. You can define up to ten different parameters in each script.

  2. Enter a parameter name and value in the fields provided.

  3. To view the script file, click View File.

  4. To run the script file, click Run Script.

    The Script - Run Results page appears displaying the number of success, failure and the elapsed time. RED indicates that errors occurred while executing the file.

  5. To view the script file source, click View Source.

  6. To run the file again, click Run Script in the left navigation pane.

    Once you have run a script file, you can view a history of previous executions by clicking Previous Runs on the Script - Run page.

To delete a script file from the Script Repository:

  1. In the Script Repository, select the script to be deleted.

  2. Click Delete Checked.

Uploading and Creating Script Files

To upload a script file into the Script Repository:

  1. In the Script Repository, click Upload.

    The Upload Script page appears.

  2. Follow the on-screen instructions.

If the script file you upload has a valid file extension, SQL Workshop recognizes the file as a script and automatically parses it. Table 5-1 describes the file extensions SQL Workshop considers to be valid for script files.

Table 5-1 Valid Script File Extensions

Extension Description
pkh Package headers
plb Package bodies
sql Scripts
con Constraints
ind Indexes
sqs Sequences
tab Tables
trg Triggers
pkb Package bodes
pks Package specs

To create a script file while in the Script Repository:

  1. In the Script Repository, click Create.

    The Create Script page appears.

  2. Follow the on-screen instructions.

Using Parameters in a Script

You can parameterize a script using a pound (#) or ampersand (&). The following two examples demonstrate valid parameter syntax.

CREATE TABLE #OWNER#.xyz (X INT)
/
CREATE TABLE #OWNER#.abc (Y NUMBER)
/

CREATE TABLE &OWNER.xyz (X INT)
/
CREATE TABLE &OWNER.abc (Y NUMBER)
/

Including SQL Queries in a Script

If you include SELECT statements in a script, the script will run without errors, but the result set will not display.

Exporting a Script File

You can export SQL Script Repository scripts using the Export Import Wizard in Application Builder.

To export a script from SQL Workshop:

  1. Click the Build icon.

  2. When Application Builder appears, click Export/Import.

    The Export/Import Wizard appears.

  3. Select Export and click Next.

  4. Click the Export Script tab and follow the -screen instructions.

If you export a UNIX format, the wizard generates a file with rows delimited by CHR (10) (that is, line feeds). If you export a DOS format then each row is terminated with CHR(13)||CHR(10) (that is, CR LF or carriage return line feed).

Accessing Saved Commands in the SQL Archive

When you click Save in SQL Command Processor, SQL Workshop saves entered commands and scripts to the SQL Archive.

SQL Archive is different from SQL Script Repository. By saving frequently used SQL commands in the SQL Archive, you can run the commands again without retyping. When you save a SQL command to SQL Archive, the saved command does not appear in Script Repository.

To view the SQL Archive:

  1. Click the SQL icon.

  2. Select the SQL tab and select Archive.

    The SQL Archive appears.

  3. Follow the on-screen instructions.

Accessing the SQL Command History

SQL Command History displays the 200 most recent commands and scripts run in the SQL Command Processor.

To view the SQL Command History:

  1. Click the SQL icon.

  2. Select the SQL tab and select History.

    SQL Command History appears.

  3. To run a command again, click the appropriate link.

    The SQL command or the script displays in the SQL Command Processor.

Generating DDL

You can use DDL statements to create, alter, and drop schema objects when they are no longer needed. You can also use DDL statements to grant and revoke privileges and roles, to analyze table, index, or cluster information, to establish auditing options, or to add comments to the data dictionary.

To generate DDL statement in SQL Workshop:

  1. Click the SQL icon.

  2. Under SQL Workshop, click Generate DDL.

    The Generate DDL Wizard appears.

  3. Follow the on-screen instructions.


See Also:


Managing Control Files

Control files enable you to run a series of scripts in a predefined order. From the Control Files Repository, you can create, edit, delete or run control files.

To access the Control Files Repository:

  1. Click the SQL icon.

  2. Select the Scripts tab and then Control Files.

    Control Files Repository appears.

  3. To search for a script, select a username from the Show list, enter a search string in the Find field (optional), and click Go.

  4. While in the Control Files Repository you can:

    • Reorder a list by clicking the column heading

    • Edit a file by clicking the edit icon

    • Run a file by clicking Run

    • Delete a script by selecting it and clicking Delete Checked

To create a control file:

  1. In the Control Files Repository, click Create.

    The Control File Create page appears.

  2. Enter a name for the control file, select the script files you would like to include, and click Create.

  3. Specify the execution order and click Done.

To edit a control file:

  1. In the Control Files Repository, click the edit icon.

    The Edit File page appears.

  2. On the Edit File page you can:

    • Change the order in which files are executed by clicking Edit Execution Order

    • Add additional script files by clicking Add More Files

    • Delete a script by selecting it and clicking Delete Checked

To run a control file in the Control Files Repository:

  1. In the Action Column, click Run.

    The Run File page appears.

  2. Select an Oracle Schema from the Parse As list.

    If your script files include parameters you must define them. You can define up to ten different parameters in each script.

  3. Enter a parameter name and value in the fields provided.

  4. Click Run File.

    The Run Results page appears displaying the number of success, failures, and the elapsed time. RED indicates that errors occurred while executing the file.

    If you wish to run the control file in the background, select Run in Background. Running a control file in the background means that Oracle HTML DB submits it as a job. The advantage of this approach is that you do not have to wait for it to finish to continue using SQL Workshop.

  5. To run the file again, click Run File in the left navigation pane.

Viewing the Control File Run History

Once you have run a file, you can view a history of previous executions by clicking Previous Runs on the Run File page.

To view the Control File Run History:

  1. Run the control file as described in the previous procedure.

  2. Click Run Script in the left navigation pane.

  3. On the Script - Run page, click Previous Runs.

Viewing Control File Job Status

You can view control file job status from either the Edit File or Run File page.

To view the status of a job:

  1. Run the control file as described in the previous section with the Run in Background option selected.

  2. Click Job Status in the left navigation pane.

Managing Tables

You can also use SQL Workshop to create new tables or edit existing tables.

To create a new table:

  1. Click the SQL icon.

  2. Under SQL Workshop, click Create Object.

    The Create Table Wizard appears.

  3. Select an object and click Next.

  4. Follow the on-screen instructions.

To edit an existing table, you must first navigate to it using the Data Browser.

To edit an existing table:

  1. Click the SQL icon.

  2. Under Data Browser, select Tables.

  3. To search for a table, select a schema, table type, type a search string in the Search field, and click Go.

  4. To view table details, click the view icon adjacent to the appropriate table name.

  5. Select task from the Tasks list on the right side of the page.

Managing User Interface Defaults

UI (user interface) defaults enable developers to assign default user interface properties to a table, column, or view within a specified schema. When a developer creates a form or report using a wizard, the wizard uses this information to create default values for region and item properties.

Note that UI defaults are associated with a table and can be used in an application created from a form and report wizards. This means that you cannot use shared list of values to define UI defaults, since shared list of values are associated with a single application.

Topics in this section include:


See Also:

"Application Builder Concepts" and "Using Application Builder" for more information on regions and item properties

Managing Tables Using UI Defaults

To view tables using UI Defaults:

  1. Click the SQL icon.

  2. Select the Browse tab and then UI Defaults.

  3. To edit the UI Defaults associated with a specific table, click the edit icon next to the table name.

    The following table-level UI defaults display at the top of the page:

    • Schema is the schema that owns the table.

    • Table Name is the name of the selected table.

    • Title is a modified version of Table Name in which the first letter is capitalized and any underscores are replaced with spaces.

    Column-level UI Defaults appear next. You can edit attributes for all displayed columns, by clicking Grid Edit.

  4. To edit a specific column, click the edit icon adjacent to the column name.

    The Edit Column-level UI Defaults page appears.

The top of the Column-level UI Defaults page displays the table and column name. Column Name is the name of the selected column. Use Default for Label to specify a label for reports and forms. By default, this field displays a modified version of Column Name in which the first letter is capitalized and any underscores are replaced with spaces. Default attributes for reports and forms appear next.

Available Display for Reports attributes include:

  • Display - Indicates whether the column displays in a report. The default is Yes.

  • Display Seq - Specifies the display sequence of items in a report. The default value is based on the column ID, which is based on the order of the columns in the table.

  • Mask - Indicates if a mask should be applied against the data. Not used for character based items.

  • Alignment - Specifies report alignment (Left, Center, or Right). If the column is a number, the default is Right. Otherwise, the default is Left.

  • Searchable - Indicates whether the column should be searchable in reports. If the column is VARCHAR2 or CHAR, the default is Yes. If not, the default is No.

  • Group By - Indicates whether this column should be used for Group By and then the sequence of the grouping. The default is Yes.

Available Defaults for Reports attributes include:

  • Display - Indicates whether this column displays in a form. The default is Yes.

  • Display Seq - Specifies the sequence of items in a form. The default is based on the column ID, which is based on the order of the columns in the table.

  • Display As - Indicates how items in a form display. The default selection is Text Field.

  • Mask - Indicates a mask to be applied against the data in a form. Not used for character based items.

  • LOV Query - Generates a LOV (list of values). Only valid for certain Display As types.

  • Default Value - Specifies the default value associated with this column.

  • Width - Specifies the display width.

  • maxWidth - Specifies the maximum string length a user is allowed to enter in this item.

  • Height - Specifies the display height of an item.

  • Required - Used to generate a validation in which the resulting item must not be null. If resulting item is not null, select Yes.

  • Help Text - Becomes Item help. By default, this text is pulled from the column hint (if applicable).

Applying UI Defaults to a Table or View

You can view a listing of tables without UI Defaults on the Default Table & Column-level UI Defaults page.

To view the Default Table & Column-level UI Defaults page:

  1. Click the SQL icon.

  2. Select the Browse tab and then UI Defaults.

  3. From the Tasks list, select Apply UI Defaults.

  4. Follow the on-screen instruction.

Exporting UI Defaults

When you export UI Defaults, all UI Defaults for the selected schema are exported to a single SQL*Plus script. When prompted by your browser, save this file to your hard drive. The file contains an API call to create table hints by making calls to the application PL/SQL API. All work is performed in a single transaction.

To export UI Default HInts:

  1. Click the SQL icon.

  2. Select the Browse tab and then UI Defaults.

  3. From the Tasks list, select Export UI Defaults.

  4. Follow the on-screen instruction.

Browsing the Data Dictionary

Each Oracle database has a data dictionary. An Oracle data dictionary is a set of tables and views that are used as a read-only reference about the database. For example, a data dictionary stores information about both the logical and physical structure of the database. A data dictionary also stores information about valid Oracle database users, integrity constraints for tables in the database, and the amount of space allocated for a schema object as well as how much of it is being used.

To browse the data dictionary:

  1. Click the SQL icon

  2. Select the Browse tab and then Data Dictionary Browser.

    The Data Dictionary Browser appears.

  3. Click the view icon to display the Query By Example (QBE) form. Use this form to query the Oracle data dictionary for details about database objects.


See Also:

Oracle Database Concepts for more information on the data dictionary

To view data dictionary reports:

  1. Click the SQL icon

  2. Select the Browse tab and then Dictionary Reports.

    The Data Dictionary Reports page appears.

  3. Make a selection from the list and follow the on-screen instructions.