5.9 Executing a SQL Script

You can execute scripts stored in the Script Repository. You can submit a script for execution either from the Script Editor or from the SQL Scripts page.

When you submit a script for execution, the Run Script page appears. It displays the script name, when it was created and by whom, when it was last updated and by whom, the number of statements it contains, and its size in bytes. It also lists unknown statements such as SQL*Plus commands that are ignored during execution.

If a script does not contain any runnable statements, the Run control does not display.

5.9.1 Executing a SQL Script in the Script Editor

Learn how to execute a script in the Script Editor.

To execute a script in the Script Editor:

  1. Open the script you want to execute in the Script Editor.
  2. Click Run in the Script Editor.

    The Run Script page appears. This page displays information about the script and lists statements in error preventing execution, or statements such as SQL*Plus commands that are ignored when the script is executed.

    Available options on the Run Script page include:

    • Cancel - returns you to the SQL Scripts page without executing the script.

    • Run Now - to submit the script for execution.

    • Run in Background - runs the script using DBMS_SCHEDULER rather than submitting for execution. This option is useful for long running scripts.

  3. Click Run Now to submit the script for execution.

    The Manage Script Results page appears listing script results.

  4. To view script results, click View Results.

5.9.2 Executing a SQL Script from the SQL Scripts Page

Learn how to execute a script from the SQL Scripts page.

To execute a script from the SQL Scripts page:

  1. On the Workspace home page, click SQL Workshop and then SQL Scripts.

    The SQL Scripts page appears.

  2. Click the View Report icon.

    Reports view appears.

  3. In the far right column, click the Run icon for the script you want to execute.

    Tip:

    If the script does not contain any runnable statements, an error icon displays.

    The Run Script page appears. This page displays information about the script and lists statements in error preventing execution, or statements such as SQL*Plus commands that are ignored when the script is executed.

    Available options on the Run Script page include:

    • Cancel - returns you to the SQL Scripts page without executing the script.

    • Run Now - to submit the script for execution.

  4. Click Run Now to submit the script for execution.

    The Manage Script Results page appears listing available results for the script.

  5. Click the View Results icon in the far right column.