Using the Script Editor

You use the Script Editor to add content to a new script, to edit existing scripts, and to run and delete scripts in the script repository.

Topics:

Editing an Existing Script

To edit a SQL script:

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

    The SQL Scripts page appears.

  2. You can load a script into the editor as follows:

    • In Icons view, click the script icon.

    • In Report view, click the Edit icon.

    The Script Editor appears.

  3. Edit the script.

    Note that new lines are automatically indented to the previous line start column. Other features of the Script Editor include:

    • Search and Replace. Click Find & Replace to display the text and JavaScript regular expression find and replace options. Click Find & Replace again to hide the options. See "Searching and Replacing Text or Regular Expressions".

    • Cut, Copy, and Paste. Use standard edit controls to cut, copy and paste content in the Script Editor.

    • Undo. Use to undo the last edit.

    • Redo. Use to reapply the last undone edit.

    You can test your script during editing by running the script to reveal errors. The Run Script dialog and the Script Results pages enable you to resume editing the script. See "Executing a SQL Script" and "Viewing SQL Script Results".

  4. Click Save to save your script to the Script Repository,

    The SQL Scripts page appears.

Searching and Replacing Text or Regular Expressions

Clicking the Find & Replace button in the Script Editor displays the Find and Replace with fields at the top of the page. Use these fields to search for and replace text strings and JavaScript regular expressions within a script. To exit Find mode, click Find again.

To access Find mode in the Script Editor:

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

    The SQL Scripts page appears.

  2. Select a script.

    The Script Editor appears.

  3. Click the Find& Replace button.

    The Find and Replace fields appear.

  4. In the Find field, enter the string you want to find. In Replace with, enter the new string to be added and then click the appropriate button (Find Next, Replace, or Replace All.)

    To further refine your search, select the Match Case check box.

  5. To exit Find mode, click Find & Replace.

Summary of Script Editor Controls

Table 3-1describes the buttons and controls available within the Script Editor


Table 3-1 Buttons and Controls within the Script Editor

Button Descriptions

Cancel

Cancel the editing session and exit the Script Editor without saving changes made since the last save.

Download

Saves a copy of the current script to your local file system. Enter a name for the script on your local file system and a directory path.

Delete

Removes the current script from the Script Repository.

See Also: "Deleting a SQL Script"

Save

Save your changes to the current script to the Script Repository.

Run

Submits the script for execution.

See Also: "Executing a SQL Script"

Undo (Ctrl+Z)

Removes, or undoes, the most recent line edit made in the Script Editor.

Redo (Ctrl+Y)

Repeats the most recent line edit made in the Script Editor.

Find & Replace

Click Find & Replace to access search and replace mode. Click Find & Replace again to exit Find mode.

See Also: "Searching and Replacing Text or Regular Expressions"