TOAD

USER’S GUIDE

®

Version 7.6

© Copyright Quest Software, Inc. 2000-2003. All Rights Reserved. This guide contains proprietary information, which is protected by copyright. The software described in this guide is furnished under a software license or nondisclosure agreement. This software may be used or copied only in accordance with the terms of the applicable agreement. No part of this guide may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, for any purpose other than the purchaser’s personal use without the written permission of Quest Software, Inc. Warranty The information contained in this document is subject to change without notice. Quest Software makes no warranty of any kind with respect to this information. QUEST SOFTWARE SPECIFICALLY DISCLAIMS THE IMPLIED WARRANTY OF THE MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Quest Software shall not be liable for any direct, indirect, incidental, consequential, or other damage alleged in connection with the furnishing or use of this information. Trademarks Quest® and TOAD® are registered trademarks of Quest Software, Inc. Other trademarks and registered trademarks used in this guide are the property of their respective owners.

Quest Software, Inc. World Headquarters 8001 Irvine Center Drive Irvine, CA 92618 www.quest.com U.S. and Canada 949.754.8000 email: info@quest.com

TOAD User's Guide Updated November 2003 Software Version 7.6

Contents

C O N T E N T S

TOAD

User’s Guide

1 INTRODUCTION........................................................................................................................... 7 2 LOGON/LOGOFF.......................................................................................................................... 9 LOGON OPTIONS ............................................................................................................................. 11 CONNECTING TO PERSONAL ORACLE.............................................................................................. 15 END CONNECTION .......................................................................................................................... 15 3 SCHEMA PREPARATION......................................................................................................... 17 4 BASICS .......................................................................................................................................... 19 MOUSE............................................................................................................................................ 19 KEYBOARD ..................................................................................................................................... 21 HOTKEYS – ADDING/ALTERING ....................................................................................................... 23 RIGHT-CLICK MENUS ...................................................................................................................... 24 WINDOW BAR ................................................................................................................................. 24 MAIN TOOLBAR .............................................................................................................................. 25 Configure TOAD Options .......................................................................................................... 26 Save TOAD Options ................................................................................................................... 26 Offline Text Editor ..................................................................................................................... 27 Configure/Execute External Tools ............................................................................................. 27 Project Manager ........................................................................................................................ 28 Customize (toolbars and menus)................................................................................................ 30 Menu Shortcut Customization window....................................................................................... 32 5 SQL EDITOR................................................................................................................................ 33 SQL EDITOR TOOLBAR................................................................................................................... 34 SHORTCUT KEYS............................................................................................................................. 34 USING THE SQL EDITOR ................................................................................................................. 39 Selecting a table to edit.............................................................................................................. 39 Commit....................................................................................................................................... 42 Explain Plan............................................................................................................................... 44 Recall and Add SQL................................................................................................................... 49 OPTIONS FOR THE SQL EDITOR ...................................................................................................... 55 EXECUTING STATEMENTS ............................................................................................................... 60

4

Execute SQL Scripts................................................................................................................... 61 Table/View Aliases ..................................................................................................................... 63 CONFIGURING THE EDITOR ............................................................................................................. 66 EDITOR OPTIONS ............................................................................................................................. 76 General Options ......................................................................................................................... 77 Highlighting ............................................................................................................................... 85 Key Assignments......................................................................................................................... 89 Auto Replace .............................................................................................................................. 91 Code Templates.......................................................................................................................... 93 RIGHT-CLICK MENU ........................................................................................................................ 95 SQL RESULTS PANEL ..................................................................................................................... 96 Data tab ..................................................................................................................................... 96 Explain Plan tab....................................................................................................................... 101 Auto Trace tab.......................................................................................................................... 102 DBMS Output tab..................................................................................................................... 103 Script Output ............................................................................................................................ 103 SQL TEMPLATES .......................................................................................................................... 104 MAKE CODE STATEMENT AND STRIP CODE STATEMENT .............................................................. 106 OPTIONS FOR THE EDITORS ........................................................................................................... 109 SQL EDITOR TASKS...................................................................................................................... 114 6 DATA GRIDS.............................................................................................................................. 123 RIGHT-CLICK MENU ...................................................................................................................... 123 SORT OPTIONS WINDOW ............................................................................................................... 135 CALCULATOR ................................................................................................................................ 136 DATA GRIDS – DATA OPTIONS ..................................................................................................... 137 DATA GRIDS – VISUAL OPTIONS................................................................................................... 141 REPORT LINK DESIGNER ............................................................................................................... 147 7 PROCEDURE EDITOR............................................................................................................. 151 PROCEDURE EDITOR TOOLBARS ................................................................................................... 152 SHORTCUT KEYS ........................................................................................................................... 153 PARAMETER HINTS ....................................................................................................................... 155 USING THE PROCEDURE EDITOR ................................................................................................... 156 NAVIGATOR TREE BUTTONS ......................................................................................................... 162 OPTIONS FOR THE PROCEDURE EDITOR......................................................................................... 163 RIGHT-CLICK MENU ...................................................................................................................... 167 DBMS OUTPUT ............................................................................................................................ 169 UTPLSQL ..................................................................................................................................... 171 SOURCE CODE MANAGEMENT ...................................................................................................... 173 TEAM CODING .............................................................................................................................. 177 OPTIONAL PL/SQL DEBUGGER .................................................................................................... 178 Tooltip Feature for Variables .................................................................................................. 180

Contents

5

The Status Panel Indicators ..................................................................................................... 181 The Dockable Windows............................................................................................................ 181 Preparing PL/SQL Code for Production ................................................................................. 182 PROCEDURE EDITOR TASKS .......................................................................................................... 183 8 SCHEMA BROWSER................................................................................................................ 189 USING THE SCHEMA BROWSER ..................................................................................................... 190 OPTIONS FOR THE SCHEMA BROWSER .......................................................................................... 194 CUSTOM QUERIES ......................................................................................................................... 204 FOREIGN KEY LOOKUP ................................................................................................................. 205 TABLES ......................................................................................................................................... 206 VIEWS ........................................................................................................................................... 225 SYNONYMS ................................................................................................................................... 225 PROCEDURES ................................................................................................................................ 226 TRIGGERS ..................................................................................................................................... 227 INDEXES........................................................................................................................................ 228 CONSTRAINTS ............................................................................................................................... 229 SEQUENCES................................................................................................................................... 229 JAVA ........................................................................................................................................... 229 DB LINKS ..................................................................................................................................... 230 USERS ........................................................................................................................................... 230 JOBS.............................................................................................................................................. 231 TYPES ........................................................................................................................................... 231 QUEUE TABLES ............................................................................................................................. 231 QUEUES ........................................................................................................................................ 231 CLUSTERS ..................................................................................................................................... 232 FAVORITES.................................................................................................................................... 232 SCHEMA BROWSER TASKS ............................................................................................................ 233 9 OTHER TOAD OPTIONS AN D FEATURES ........................................................................ 237 QUEST SCRIPTRUNNER ................................................................................................................. 238 SQL MODELER ............................................................................................................................. 243 CODE ROAD MAP.......................................................................................................................... 257 ER DIAGRAM................................................................................................................................ 258 CREATE/ALTER TABLE ................................................................................................................. 259 TOAD REPORTS ........................................................................................................................... 261 HTML SCHEMA DOC GENERATOR ............................................................................................... 262 NETWORK UTILITIES..................................................................................................................... 265 TOAD SECURITY ......................................................................................................................... 269 SESSION BROWSER ....................................................................................................................... 271 JAVA FEATURES ............................................................................................................................ 272 OPTIONAL QUEST DBA MODULE ................................................................................................. 273 10 FREQUENTLY ASKED QU ESTIONS/SUPPORT ............................................................. 275

......................................................................................................................................................................................6 TOAD HELP .............. 276 INDEX.................................. 279 ........................................................................................................................................................... 276 CUSTOMER SUPPORT...

all through a multi-tabbed browser. complete with links and customizable for content and style . PL/SQL script writers can use the advanced editing features to save time and increase productivity. Code can be created from shortcuts and code templates. You don’t have to be a PL/SQL expert to access database objects when you’re using TOAD. extents. debug. and triggers Search for objects Find and fix database problems with constraints. browse. You can even create your own code templates. execute. views. Use TOAD to § § § § § § § Create. indexes. stored procedures. indexes. and more-. and the result is an easy to use. fast. and tune queries Edit. tables. and grants Manage your most common DB tasks from one central window Create HTML docs for any schemas.1 Introduction TOAD TOAD is a powerful low-overhead tool built around an advanced SQL and PL/SQL editor. indexes. You can view the Oracle Dictionary. functions. packages. triggers. and profile “stored procedures” including procedures. It was designed from the developer’s perspective. etc. or alter objects (tables.) including Oracle8 TYPE objects Graphically build. and effective interface. The GUI browsers provide quick access to database objects.

For details on installing and uninstalling TOAD. You can always access TOAD Help while you are in TOAD by pressing the F1 Key. so the color differences are not always distinguishable. and function. The guide does not cover every TOAD window.PDF. New or changed TOAD features since November 2003 are not reflected in this version of the guide. The guide covers the following major windows and topics: § § § SQL Editor Procedure Editor Schema Browser Once you are comfortable navigating around a few of these windows you’ll discover that the other TOAD windows have a similar design.8 This guide is a how-to and reference for new users and users already familiar with TOAD. Colors are presented in the . option. refer to the TOAD Getting Started Guide. The manual also covers the following major topics: § § Logon/logoff Navigation and shortcuts Note that this User’s Guide was prepared in November 2003. . The printed version of the TOAD User’s Guide is in black and white. Refer to TOAD Help for the latest information.

You can create a new connection to Oracle or select from a list of previous connections. the default password will be the same as the username. If you have a TOAD home set. All checked connections in the Autoconnect Column are automatically connected each time you start TOAD. and the date and time of the connection). the home that is set via Oracle's Home Selector application is loaded.ORA. .2 Logon/Logoff When you start TOAD a Login screen displays. Otherwise. When you double-click to select a previous logon from the list of previous logons. Server Login You get to this dialog via the File > New Connection menu item. or when TOAD starts up. TOAD will fill the database dropdown with the names of previous sessions and any aliases in TNSNAMES. then it is loaded into the Home Selection dropdown. user. You can create a new connection to Oracle or select from a list of previous connections. The date format comes from the workstation setting in Settings > Control Panel > Regional Settings > Date > Short date style option. The screen lists your previous connections (server.

Asterisks will display instead of characters as you type. TOAD saves the USER/DATABASE combinations between TOAD sessions.10 To create a new connection 1 Type the name of the database in the dropdown combo box labeled Database. Type the name of the USER in the textbox labeled User/Schema. 2 3 4 To use a previous connection If the View > Options > Oracle > Save passwords for Oracle Connections option is checked THEN You can double-click a previous connection from the list in the left panel to automatically logon.ORA file. Click OK OR Press <ENTER>. Otherwise. DO NOT ENABLE THE Save passwords for Oracle connections OPTION UNLESS YOU HAVE A SECURE ENVIRONMENT. follow these steps. 1 2 3 Select a previous connection from the list in the left panel. but does not save the password. . Type the PASSWORD for the user in the textbox labeled Password. Type in the Password. Click OK or press <ENTER>. If the option is unchecked then the Save Pwd? column will display in the previously used connections grid. The server name you use must have an entry in the TNSNAMES. If you check the column the password is saved for the respective connection in the Login Grid.

5 or later and receiving errors like “No Listener” try the following: 1 2 3 Open a Command Prompt. Net8 DLLs are skipped. TOAD ignores the Net8 DLLs on your system and attempts to connect to Oracle via the SQL*Net DLLs. but the new Net8 functions are ignored. Press the <DELETE> key. When checked (ON). When the Oracle Home has been found.x databases. The DLL is loaded according to the above. and the cursor is positioned to the point of error. When unchecked (OFF).5 If you are using TOAD with Personal Oracle 8. but you do get the Oracle 8 functions. you do not get the error row or column position.0. This also means that a client install with just Net8 will result in a failure. If Force SQL*Net is chosen. SQL*Net Compatible Net8 checkbox This option only applies to Oracle 8. Last Connect list. Type “lsnrctl” and <ENTER> Type the command “start” Logon Options Force SQL*Net (ignore Net8) checkbox When checked.Chapter 2 Logon/Logoff 11 To delete a previous connection 1 2 Select a connection from the Server.1. . User. The downside is that no Oracle 8 functions are supported. This option does not apply to Oracle 8i because Oracle restored the error position function. If you are having trouble running TOAD with Personal Oracle 8. It assumes that Net8 is installed.1. you get the row and character position from bad queries. the DLL with the HIGHEST revision number is loaded.

which gets prefixed with “OPS$” giving a username of “OPS$JSMITH. It also lets you see which Oracle Homes are valid installs. For example. You don’t need to type over the word EXTERNAL in the username textbox when reconnecting. and leaves Username and Password empty. Whatever you enter in Database. His NT login is “JSMITH”.ora initialization parameters file must have: remote_os_authent = true os_authent_prefix = "OPS$" or whatever prefix you select. Select the database alias and leave the Username and Password textboxes empty. . To configure this on the server side.12 Operating System Authentication TOAD can accept logins where the operating system validates the user and password. NLS_LANG. any previous logins that were O/S authentication logins will have username = “EXTERNAL”. Oracle will prefix your workstation login and attempt a login. you can click the Advice button for suggestions. Username. If the database permits default passwords. If a SQL*Net entry is not valid. Joe Smith logs onto the ORA805 database. you can connect.” Oracle attempts a login and TOAD starts up. You can use Oracle usernames without passwords in TOAD. and Password boxes are passed to the database. enters “ORA805” in the Database textbox. The next time you bring up the Server Login window. the init. and SQLPATH by double-clicking or via the right-click menu. Connect using dropdown drilldown button This button opens the Oracle Home Editor window which shows all Oracle Homes. The information can be copied to the clipboard and pasted into an email for technical support issues. You can edit SID.

TNSNames Editor link This opens the TNSNames editor preloaded with the TNSNAMES. SQLNet Editor link This lets you set SQLNET. You can click View File and manually add/edit entries.ORA file has been found for that home. . Refresh button This refreshes the previously used connection info for the left pane of the login window.ORA file for the selected home. A red lock indicates the TNSNAMES. A checkbox lets you make the changes permanent to your SQLNET. A green check next to the SQLNet Editor link indicates that a SQLNET. A red lock indicates the file (SQLNET. A red X indicates that the file cannot be found. the list of databases from the tnsnames for the database dropdown.ORA file is read only.ORA) is read only. and all of the home information from the registry/hard disk for the home selection dropdown.ORA. Unchecked. A red X indicates that the file cannot be found.Chapter 2 Logon/Logoff 13 Make this the TOAD default home checkbox Check this checkbox to make the home selected in the dropdown the TOAD default home.ORA file has been found for that home. Uncheck the checkbox to remove that home as the TOAD default home. the modified one will be used for your connection and your original will be backed up once the connection is established.ORA file will be overwritten with the modified one. A green check next to the link indicates that the TNSNAMES.ORA parameters on the SQLNet editor screen. If checked your SQLNET.

So. then the username is copied to the password box because most development schemas are created as user/user. TOAD puts in the username for the password. To turn on the Save Passwords for Oracle Connections option 1 2 3 Go to View > Options > Oracle.14 Save Passwords for Oracle Connections One of the TOAD options is Save Passwords for Oracle Connections. . the password = Username. Before you check the Save passwords for Oracle Connections box. All passwords are encrypted. The default for this option is unchecked. the password is saved in CONNECTIONS. during login. be sure you work in a secure environment where your CONNECTIONS. When unchecked. When checked. Click Save Passwords for Oracle Connections to check that option.INI file will not fall into the wrong hands. Either quit TOAD and restart OR Click the Save All Options button in the main toolbar.INI. If you do not check the Save Passwords for Oracle Connections checkbox.

accessed from the File menu. which will close all connections. Click the session you want to end. . A popup window lists one or more sessions. To close a specific connection without exiting TOAD 1 2 3 4 Go to the File > End Connection menu. If you have any Prompt to save before close options on. TOAD also has an End All Connections option. try one of the following four entries for the database name on the TOAD login window: 2: BEQ-LOCAL LOCAL TCP-LOOPBACK For Schema/Passwords try one of the following pairs: DEMO/DEMO SCOTT/TIGER SYS/CHANGE_ON_INSTALL SYSTEM/MANAGER End Connection You might want to close a connection without exiting TOAD.Chapter 2 Logon/Logoff 15 Connecting to Personal Oracle If you are having trouble connecting to Personal Oracle or creating a SQL*Net alias for PO7 or PO8. you will be prompted to save the editor contents so that they are not discarded. All windows associated with that session are closed. Click OK.

.

TOAD will not display previous Explain Plan results. The Server Side Installation wizard is discussed in detail in the Getting Started Guide.) If the user has a longer than normal user name. if you still do not execute the TOAD scripts. If you change the default setting from TOAD_PLAN_TABLE to PLAN_TABLE. TOAD will use your existing table. NOTE: On the View > Options > Oracle page. On the other hand. If you decide NOT to store previous Explain Plan results. you will not be able to recall previous Explain Plan results. . the account for the schema where you are installing them. If you do not create the tables needed for storage and retrieval of Explain Plans which you can do automatically via the Server Side Installation wizard. TOAD uses the user name plus the date and time to generate a unique statement id for the Explain Plan. or an account with the DBA role. The wizard also lets you remove or update the objects. Explain Plan will still function on the SQL Edit window providing you specify PLAN_TABLE on the options window rather than TOAD_PLAN_TABLE. You can access the wizard while in TOAD from the Tools menu. you can specify the name of the Explain Plan table that TOAD should utilize. By default. you might need to expand the Statement_ID column of the Plan table. you will need to have access to either the account for the TOAD user. (You can change the user name TOAD uses for Explain Plan via the View > Options > Oracle > User Name for Explain Plan textbox. you should disable the option Save previous Explain Plan results on the View > Options > Oracle page. In order to install server side objects. and you do not have to create the TOAD table.3 Schema Preparation During the installation you had the opportunity to install the server side objects for TOAD via the Server Side Installation wizard.

.

Right-click menus are discussed in the Right-click menu section of this chapter. and the main menu. Checkboxes You will find checkboxes throughout TOAD. and with checkboxes you control how TOAD looks and functions. In addition to left-clicking on items. right-click menus. hotkeys. The program is designed to be flexible. You can check multiple items in a checkbox list. buttons. Options you’ve set in one checkbox might affect options in another checkbox. Drill Down buttons The drill down button Drill down buttons indicate another level of information.4 Basics This section contains basic information about TOAD navigation. which is usually another window. the right-click button displays right-click menus. Mouse TOAD is designed to be used with a mouse. Click the drill down button to drill down another layer. .

20 To place a check in a checkbox or remove a check from a checkbox Click in the checkbox area or label area OR Tab to the area with the checkboxes and press the up and down arrow keys until your option is highlighted. Types of Message Boxes TOAD uses the industry standard symbols for its four types of message boxes. Press the space bar. i ? X ! This indicates an information box. . Dropdown lists Dropdown lists are used throughout the TOAD screens. This indicates an exclamation (very important) message. The down arrow activates a dropdown menu from which you can choose an item. This indicates a stop message. This indicates a question box that requires a decision from you.

You can also use the UP/DOWN arrow keys to move through the radio button choices. UP/DOWN ARROWS The UP ARROW and DOWN ARROW let you move your cursor up and down the items or list of whatever area your cursor is positioned in. . You can also activate Expand and Collapse buttons using the <+> and <-> keys on the numeric keypad. In a dropdown list the UP and DOWN ARROWS scroll through the choices in the list. and the text cursor displays ready for you to type. The UP and DOWN ARROWS are referred to as the UP and DOWN keys. For textboxes. LEFT/RIGHT ARROWS The LEFT ARROW and RIGHT ARROW let you move left and right across a list of radio button choices. For the Expand and Collapse buttons the LEFT ARROW collapses the list and the RIGHT ARROW expands the list. The first item in the area you tab to will highlight. Once you reach your choice. and your choice remains. the multiplication sign “*” expands to all levels. you can TAB to the textbox. The plus sign “+” expands the list and the minus sign “-” collapses the list. TAB to move out of the area (or click outside of the area with your mouse).Chapter 4 Basics 21 Keyboard You can use the keyboard for navigation and selection. For hierarchy lists. TAB The TAB key lets you advance the cursor forward from one area of a window to another area.

you will cancel your choices and exit the window. ESC ESC cancels most modal dialogs. you cannot tab to a drill down button. ENTER ENTER is similar to a mouse-click. For example. It activates whatever button has focus. Not Accessible by Keyboard TOAD was designed for a mouse. and some areas of TOAD can only be accessed by using the mouse. For example. .22 SPACEBAR The spacebar lets you check and uncheck checkboxes or click buttons with focus. if you <TAB> to a CANCEL button and press <ENTER>. You have to click the drill down button to bring up its associated window. Pressing <SPACEBAR> on buttons with focus also clicks the buttons.

When you highlight a command. you can alter the key assigned to that command OR add an additional key. 0 for the command "set Bookmark 0. If you click DELETE while looking at a command. 10 Your second key. 11 Click Finish. DO NOT CLICK the buttons ADD or DELETE unless the keys you just entered are in addition to the default keystrokes OR you want to remove the displayed keystrokes entirely. 0" 1 2 3 4 5 6 7 8 9 Click the Edit > Editor Options > Key Assignment item.Chapter 4 Basics 23 Hotkeys – adding/altering The Editor Options Dialog list of key assignments contains a list of the basic editing functions. 0. Control-K. Press 0. for example. Press <CTRL>K. The key sequence displays in the window. <SHIFT><INSERT>. Note that keystrokes such as <CTRL>J or <SHIFT><INSERT> are ONE stroke keys. . displays in the window. All commands allow for two-part keystrokes. Expand the Bookmarks list by clicking the expand “+” button. Click the Edit Sequence button. and cut (<CTRL>X) automatically. <CTRL><INSERT>. Click Next. and <SHIFT><DELETE> are mapped to copy (<CTRL>C). Click Set Bookmark 0. The optional Step 2 window displays." To set the command for "Bookmark0" to "Control-K. The Edit Key Pair step window displays. paste (<CTRL>V). 12 Press OK in the Editor Options window to save the setting. the hotkey for that command is removed.

To access a right-click menu Press the right mouse button (right-click) OR For the Procedure Editor. right-click over it and uncheck/check Window Bar. and SQL Modeler windows you can also press F10. check Options > Toolbars > Allow docking/hiding of read only toolbars. after unchecking Window Bar in the right-click menu. and some items are unique to the right-click menu and cannot be found anywhere else in TOAD. Options for the window bar (Show connection string on buttons and Highlight windows for current connection) appear under Options > Toolbars. . SQL Editor. check Options > Toolbars > Allow docking/hiding of read only toolbars To turn off/on the window bar.24 Right-click menus A right-click menu is specific to the window that you are in. Some items in the menu are shortcuts to commands or windows that can be found elsewhere. The tooltips on the bar display the full window caption. Click a button on the bar to navigate to a window. Window Bar A window bar displays at the bottom of the main window screen to indicate what windows are open in TOAD. If you are using a read-only toolbar configuration and you want the window bar to remain turned off. If you want to undock the window bar from the bottom of the main window.

Commit. Configure/Execute external tools. Rollback. Configure options. . You can place the mouse pointer over a button to display its title. Run Script. Schema Browser.Chapter 4 Basics 25 Main Toolbar The main toolbar buttons include buttons to open the major TOAD windows such as the SQL Editor. and SQL Modeler. New connection. Buttons also include Object Search. and more. Procedure Editor.

Double-click the option. which are basically your current TOAD settings and values. Table Name alias list. Recall Previous SQL lists. Lists of MRU (Most Recently Used) files. The Search button lets you search the options for specific text. A table displays the list of options that contain the search text you type and the corresponding tab titles. . You might want to Save TOAD Options before running such a query. etc. just as a precaution. Save TOAD Options The Save TOAD Options button saves external files. This is useful. or click the option and press <Enter> to go to that page.26 Configure TOAD Options You access the multi-tabbed TOAD Options window via the Configure TOAD Options button on the main toolbar or from the View > Options menu item. for example. if you can't remember which tab contains the option that you are trying to find. Many of the options are discussed in later chapters and in TOAD Help. Editor Options settings. It saves all TOAD options to files in your TOAD and TOAD\TEMPS folders including settings from the TOAD Options dialog. This is useful if you are about to run a query that could crash or run for a long time.

you could edit HTML files and have TOAD highlight the HTML markup tags in various colors. The Add button opens a Tool Properties window that lets you add programs. You select the programs that you want to add.Chapter 4 Basics 27 Offline Text Editor The Offline Text Editor button opens an Offline Text Editor window. JAVA . You can then execute the last program by clicking its icon on the toolbar. INI. pass in parameters to the program. For example. and establishes the working directory as the same directory where the executable resides. select icons. The View > Options > Parser Scripts dialog is where you set up the file associations for file name extension. Configure the editor options by loading a file for a language into the offline editor and choosing Edit > Editor Options. After you’ve added programs to the Tool Options window. The file language types supported are: PL/SQL. you can edit scripts without being connected to an Oracle database. they are available from the Configure/Execute External Tools dropdown list. It finds the program file. and TEXT. The icon of the last program you execute from the dropdown replaces the Configure/Execute External Tools icon. . by modifying the script files that define how the TOAD Editor should highlight keywords. Configure/Execute External Tools This opens the Tool Options window which lets you add programs that can be launched from TOAD. create shortcuts (click in the Shortcut box and enter the new keystroke). an icon. An Auto add button searches the registry for a set of preinstalled programs. and add macros. So. HTML.

By default. It also lets you configure the external associations and the DDL script inclusions. FTP folders represent connections to a remote server and are located as sub-nodes to a project folder that you create. it must exist on your hard drive. The Settings button opens the Configuration window where you can: specify the command TOAD executes when you drag a file onto another file or onto a node. . You can add a separate folder for each server directory that you want mapped. To Add a Project Node Right-click and select Add > Project OR from the Add Item dropdown select Project In order to add a folder to your project. You can add items contained in the folder to the Project Manger window so that they can be accessed directly. and database objects.28 Project Manager The Project Manager lets you manage your common DB tasks from one central window. To Add a Folder Right-click and select Add > Folder OR from the Add Item dropdown select Folder When you add a folder. and customize the pop-up (right-click) menus. double-clicking on the folder will open Windows Explorer to that folder. connection links. Project Manager maps the folder path. customize double-click operations. Project nodes let you store links to folders.

The feature applies to second-level nodes: Schemas. Click Ok. You can combine different Oracle connections and FTP connections into one project. Select the project(s) you want to copy to. or schemas. You can configure Project Manger so that it will automatically run a Schema Compare when you drag one schema node onto another schema node.Chapter 4 Basics 29 A Copy feature lets you have more than one project open at once with links to the same files. To Copy Nodes 1 2 3 4 Select the node(s) you want to copy (multi-select via <Shift> or <Ctrl>) Right-click and select Copy from the menu. Project Manager lets you access your connections. see if you are connected. and connect if the connection is not current. You can use different schemas or users in each project. Different project nodes can contain links to the same items. Folders. The Destination Projects window displays. and FTP Folders. . For more details about Project Manager refer to TOAD Help. FTP connections.

You can remove a command from the toolbar by clicking and dragging it off the toolbar. show/hide shortcuts on tooltips. moving the most used commands to the top of the list. and hiding commands that you seldom use. . Click New.30 Customize (toolbars and menus) You access the Customize window via the right-click menu Customize command on either the main toolbar or main menu. The Customize > Options tab also lets you display large icons. edit the displayed text. and select menu animations. icon and text. you can still display the rest of the menu by clicking the down arrow at the bottom of the menu. the menu lists configure themselves in response to how often you use each menu command. the remainder of the menu (the hidden menu items) displays. You must have the Customize window open in order to customize toolbars or menus. then after you select a menu and wait a few seconds. When editing text. You can right-click on an icon to change it to text display. You can also add new menus and new toolbars. Then click-and-drag commands from the Commands tab to your new toolbar. If you want your menu lists to automatically hide items that you seldom use. You change a hotkey by changing the position of the ampersand. show/hide tooltips. If you want to make a lot of changes to the main toolbar. if you want to define a hotkey (<Alt><key>) type an ampersand (&) before the letter you want underlined. This window lets you customize the main toolbar and the menu bar. you can turn this option on via the Customize window > Options tab by checking the Menus show recently used commands first option. and other options. it might be easier to create your own custom toolbar via the Customize window > Toolbars tab. You can click-and-drag New Menu from the Commands tab to add a menu to your new toolbar. name your new toolbar and click OK. If you check Show full menus after a short delay. If an icon is associated with the command the button will display the icon by default. If the Show full menus after a short delay option is unchecked. The Reset my usage data button will reset the menu usage data. If checked. Notice the commands are categorized by their associated menus.

This is the only choice that is customizable.Chapter 4 Basics 31 While the Customize window is open. you can rearrange your customizable toolbar buttons and menus via click-and-drag. Developer .Unchecked Unchecked.keeps your customized toolbar or gives you the TOAD Default toolbar (all toolbar items). Checked. or left as floating toolbars which will remain on top of all TOAD windows. The preconfigured toolbars are read-only. TOAD will have to be restarted. TOAD Default . you will not receive items that you are not licensed to receive. Regardless of the configuration you choose.excludes most of the DBA functions from the toolbar Business Analyst . You can add a separator between groups of commands by clicking on a button and dragging it slightly left or right.all toolbar items that you are licensed to receive. Toolbar Options View > Options > Toolbars lets you select or add a toolbar configuration. TOAD shows all toolbars in their default location at restart.all toolbar items The Add button adds a new toolbar using an existing template that you can later customize. Restore the default settings of a customizable toolbar through the Customize window by selecting the toolbar from the list and clicking the Reset button. Name is the name you want displayed in the options screen and INI Filename is the filename for your new configuration. Allow docking and hiding of read-only toolbars checkbox Default . The customizable toolbars (which includes the main toolbar) can be docked (via click-and-drag) to any side of the screen.designed for a user whose main priority is running queries and reports DBA (full menus) . . you can move and hide the read-only toolbars. and you cannot hide or move and dock read-only toolbars (such as the main menu toolbar). The Customize window > Toolbars tab lets you show/hide toolbars via checkboxes next to each toolbar. User Default .

vertically docked toolbar text will display vertically. The intuitive window lets you change. create. possibly resulting in a wider toolbar to accommodate the horizontal orientation of the text. and reset shortcuts.Checked If checked. docked or floating.32 Lock all toolbars Default . vertically docked toolbar text will display horizontally.Unchecked If checked. The toolbars can be locked in any position. to display the Menu shortcut customization window. Use vertical text when toolbars are vertical Default . . If unchecked. Menu Shortcut Customization window You can select Menu shortcuts from the right-click toolbar menu. this prevents the toolbars from being dragged from their current position and docked elsewhere.

execute. and Script Output.5 SQL Editor If you have never used TOAD. The bottom toolbar. cut. a tab for Code Statistics is also on the panel. step-by-step examples are provided for various SQL Edit procedures. Select menu item Database > SQL Editor. the lower panel. The SQL Edit window has two panels. and tune. 3 ways to invoke the SQL Edit window § § § Click the button in TOAD’s main toolbar. The top toolbar is for SQL Edit specific functions. displays fetched data. or edit toolbar. At the end of the chapter. DBMS Output. If you have the optional PL/Formatter. The results panel contains tabs for Data. When you first start TOAD you are in a SQL Edit window. is for common editing functions such as copy. Auto Trace. A horizontal splitter between the editor and results panel lets you size each component accordingly. Explain Plan. The SQL Editor is the top panel and the results panel. and paste. edit. The SQL Editor lets you type. the SQL Edit window is a good starting point. Set the SQL Editor to StartUp on new connection in the View > Options > Windows dialog. The window contains an editor to compose SQL statements or scripts and a results grid to display the results from SELECT SQL statements. The SQL Edit window has two toolbars. The edit toolbar is also on the Procedure Edit window. .

Save. Strip out Oracle SQL statement. procedure. Execute explain plan. function. The Object Describe windows are similar to the Schema Browser windows for the corresponding object types. procedure. or package) in a popup window. F4 Describes an object (table. Load a file. . package or view in a Procedure Editor or SQL Editor and pressing F4. Delete current row. Execute window as script. <ALT><UP> and <ALT><DOWN> will scroll through the SQL history. Update SQL Results Grid editors to database (not a commit). Tune. Create development tool code statement. view. and Change session. Shortcut Keys A few keys to note F1 You can press F1 to display the help file.34 SQL Editor Toolbar The SQL Editor toolbar buttons let you Execute the complete or highlighted statement. Insert row into editable results grid. Recall previous SQL statement. Recall personal SQL statement. You access an Object Describe window by placing the cursor on the name of a table. Execute the statement at the cursor. function. Reverse changes to the current query not yet posted.

and a popup window lists the columns in that table. goes to the first row of the column the cursor is in <END> Goes to the end of the line . <ALT><UP> Goes to the previously executed statement that you’ve run <ALT><DOWN> Goes to the most recently executed statement <HOME> Goes to the beginning of the line <CTRL><HOME> Goes to the top of the editor.Chapter 5 SQL Editor 35 F6 Toggles the cursor between the SQL Editor and the results panel F10 Displays the right-click menu for the section (Editor or results panel) that the cursor is in <CTRL>T Columns Dropdown – You put the cursor on the table name. In the data grid.

If you need to examine rows at the end of a large recordset. But with <CTRL><END> TOAD has to fetch EVERYTHING. If a table has only a hundred rows. Even in a table with a million rows the response to the initial query is almost immediate. refine your query with something like: Select * from table Where primary_key > value and re-execute it. This can be a long process. the process could be time consuming. TOAD shows queries quickly. This is because TOAD only fetches and displays what it needs. but if a table has a million rows.36 <CTRL><END> Goes to the last row of the column you are in CAUTION: You need to be careful when using <CTRL><END>. . TOAD can quickly fetch data when you press <CTRL><END>.

View. or Package in popup window Execute as script Toggle cursor between Editor and Results Panel Clear all text Recall previous SQL statement (invokes SQL Statement Recall window) Execute statement Verify statement without execution (parse) Execute current statement at cursor Display right-click menu Pass the editor contents to the specified External Editor Select all text Copy Show Procedure Arguments Execute Explain Plan on the current statement Find text (invokes Find Text window) Goto line (invokes Goto Line window) Convert text to lowercase Make Code Statement Recall Named SQL Statement (invokes SQL Statement Recall window) .Chapter 5 SQL Editor 37 KEYSTROKE F1 F2 <SHIFT>F2 F3 <SHIFT>F3 F4 F5 F6 F7 F8 F9 <CTRL>F9 <SHIFT>F9 F10 F12 <CTRL>A <CTRL>C <CTRL>D <CTRL>E <CTRL>F <CTRL>G <CTRL>L <CTRL>M <CTRL>N FUNCTION Display SQL Editor section of TOAD Help file Toggle between full screen Editor and Editor/Results Panel display Toggle full screen grid Find next occurrence Find previous occurrence Describe Table. Procedure. Function.

go to the first row of the column the cursor is in In the editors. last column of text. See CAUTION NOTE in this section. first column of text. page 36. go to the end of the recordset In the editors. (period) . go to the first row. go to the top of the recordset In the results grid. go to the last row. Activate code completion template Cycle through the collection of MDI Child windows Execute current SQL statement at cursor Auto complete tablenames <CTRL><END> <CTRL><SPACE> <CTRL><TAB> <CTRL><ENTER> <CTRL>. In the Data Grid.38 <CTRL>O <CTRL>P <CTRL>R <CTRL>S <SHIFT><CTRL>S <CTRL>T <CTRL>U <CTRL>V <CTRL>X <SHIFT><CTRL>Z <ALT><UP> <ALT><DOWN> <CTRL><HOME> Open a text file Strip Code Statement Find and Replace (invokes Find and Replace Text window) Save File Save File As Display Columns dropdown Convert text to uppercase Paste Cut Redo last Undo Display Previous Statement Display Next Statement (for use after <ALT><UP>) In the data grids.

you can edit the data. You must have Show ROWID in Data Grids checked in View > Options > Data Grids – Data in order for ROWID to display in the results. Then you can edit the data.Chapter 5 SQL Editor 39 Using the SQL Editor Selecting a table to edit To edit a table. Alternatively. you can’t simply type Select and the tablename. you can type the TOAD EDIT command to translate the command into a SELECT SQL statement with ROWID column. Table Name Select Show Tables window button . You have to include a rowid in your select statement.rowid. dept. Edit dept and press <CTRL><ENTER> or F9 to execute. Nothing will happen. if your tablename is DEPT and you type Select dept. For example.* from dept and press <CTRL><ENTER> or F9 to execute.

When the indicator is red. This indicates that the table data can be edited. the data cannot be edited. but it can still be selected and copied. and add a space. Notice the status panel indicator at the bottom of the screen turns green. Then type Edit before the name. Example: edit dept Press F9. click the Show Tables window button and the Table Names Select window displays from which you can choose the owner and the table.40 If you want to choose a table and can’t remember the title or schema. You can even click on a table name and drag and drop that name to the SQL Edit window. Status Panel Indicator: green=editable red=not editable . Your selected table displays in the Results Grid.

and post edits. Here. The arrow buttons in the window let you move up and down the columns. the location for Department 30. was changed from Chicago to New York. . and the Single Record View window displays for the record of the item you’ve selected. You can also insert records. Click the Single Record View button. delete records.Chapter 5 SQL Editor 41 Single Record View The Single Record View button is present throughout TOAD data windows and result grids. It is located on the top left of the table. Sales.

The status panel on the bottom of the window shows you the status of Commit. and Prompt for Commit when closing connection is checked. To Turn Commit ON or OFF Go to View > Options > Oracle. Other users can only see the old data until you commit. The status panel shows the status of Commit Notice a related option on the next line is Prompt for Commit when closing connection. Check or Uncheck Commit automatically after every statement. TOAD will ask you whether or not you want to perform a commit to the changes before you close a session. Rollback cancels that transaction. You can choose Commit from the Database > Commit menu item or click the Commit button from the main toolbar. Commit writes the transaction to the database. This performs a commit for all windows that are open in the current session. with Commit OFF you can make changes without affecting other users. Data is not available to other users until you choose Commit. If Commit automatically after every statement is unchecked. Commit can be ON or OFF.42 Commit Commit The Commit command executes an Oracle Commit. . So.

the data is buffered in the transaction. the data will be committed. When you edit data in a row. You can edit in the row and then. and the data is sent to the Oracle transaction buffer. you can’t change rows. then clicking the Reverse Changes button will reset col 1 and col 2 to their previous values. If autocommit is ON at the time the Update Grid Edits is activated. pressing <TAB>. the changes are not sent to the Oracle transaction buffer until you change rows (click in another row). you can make changes. if you only have one row. the Update Grid Edits button is enabled. the data is available to other users. With Commit OFF. If autocommit is OFF. Reverse Changes Next to the Update Grid Edits button is the Reverse Changes button. If Commit is ON and you type in a row and then change rows. but other users will see the old data until you choose Commit. without changing rows. If autocommit is OFF. pressing <TAB>. click the Update Grid Edits button. typing in col 2. This lets you reverse the changes you’ve made that have not yet been posted to the database. it stays in the buffer. That’s where the Update Grid Edits command is useful.Chapter 5 SQL Editor 43 Update Grid Edits As soon as you start editing a table. If autocommit is ON. . For example. The Update Grid Edits command sends the latest edits (or data) to the database. the data is committed. However. typing in col 1.

This lets you visually see the steps. or Delete. The Explain Plan function inserts a row describing each step of the execution plan into a specified plan table. Make sure the View > Options > Oracle > Save Previous Explain Plan Results option is checked. . Select SQL-Window > Explain Plan Current SQL menu item. The purpose of Explain Plan is to determine the execution plan Oracle follows to execute a specified SQL statement. If View > Options > Oracle > Save previous Explain Plan results is checked. <CTRL> E Explain Plans in the SQL Editor will work regardless. Click on a SQL statement such as Select.44 Explain Plan Explain Plan (also called Execution Plan) displays steps that will occur in the selected SQL statement. Insert. Explain Plan also determines the cost of executing the statement based on the statistics that have been stored for the table. Explain Plan results display in the results grid. To execute Explain Plan on a SQL Statement In the SQL Editor. but if you have not created the tables needed you must set the View > Options > Oracle > Explain Plan Table name option to point to your own plan table (Plan_Table). place the cursor on a SQL statement. NOTE: Viewing previous Explain Plans via View > Explain Plan will not work unless you first create the tables needed for storage and retrieval of Explain Plans which you can do automatically via the Server Side Installation wizard (see the Getting Started Guide). then Explain Plans are stored in: TOAD_PLAN_SQL and TOAD_PLAN_TABLE To run Explain Plan 1 2 3 4 Load a SQL Script into the SQL Editor. go to SQL Window > Explain Plan Current SQL (OR <CTRL>E). If you are using costbased optimization. Update.

. They let you display the details that you need to see. NOTE: You must have the View > Options > Oracle > Explain Plan Table Name menu item entered. The default entry is TOAD_PLAN_TABLE. A list of previous Explain Plans displays. You can copy the Explain Plan hierarchy to the Windows clipboard or send it to the printer with a right-click over the Explain Plan output and selecting either the Copy to Clipboard or Print Results menu item View Explain Plan View Explain Plan displays a list of the previous Explain Plans that you’ve executed. Click the Explain Plan item. To Access View Explain Plan 1 2 3 Go to the View > Explain Plan menu item. or you will not be able to view previous plans. If you attempt to activate an Explain Plan and you have not created the needed TOAD temp tables (which you can do automatically via the Server Side Installation wizard during the install or from the Tools menu (see the Getting Started Guide).Chapter 5 SQL Editor 45 Notice the Explain Plan results have expand and collapse buttons. you get an error message telling you the table or view does not exist.

Object Node This column contains the contents of the OBJECT_NODE column used to keep track of the order in which operation's output is consumed for parallel queries. or Gigabytes. or G (1000 millions. This comes from the CARDINALITY column of the plan table. Megabytes. or billions). If appropriate. M (millions). Object Name The value of the OBJECT_NAME column of the plan table. or G (1000 millions. This is the value of the BYTES column of the plan table. This column is not applicable to rule-based optimization. Operation The concatenation of the OPERATION and OPTIONS columns of the plan table. If appropriate. the number is converted to K (thousands). the number is displayed in Kilobytes. If appropriate. Bytes Number of bytes accessed. M (millions). the number is displayed in K (thousands). Cost The value of the COST column of the plan table. Rows Number of rows accessed. or billions).46 Explain Plan Treeview The Explain Plan treeview lists the contents of the TOAD_PLAN_TABLE for the given statement id. .

It indicates how this step relates to the previous and subsequent steps with regard to parallel query execution.Chapter 5 SQL Editor 47 In/Out The (abbreviated) value of the OTHER_TAG column in the plan table. Abbreviation (blank) P->S P->P PCWP S->P PCWC Meaning Serial execution Parallel to Serial Parallel to Parallel Parallel combined with Parent Parallel from Serial Parallel Combined with Child PStart This column represents the DISTRIBUTION and PARTITION_START columns of the plan table. m Meaning Row Location KEY KEY(INLIST) Partition number for first partition in range Partition and sub-partition number for first partition in range . Abbreviation for PStart ROWID KEY KEY(I) n n.

Abbreviation for PStop ROW L KEY n n. . Refer to Oracle documentation for more information on how to read and interpret an Explain Plan output. m Meaning Row Location KEY Partition number for last partition in range Partition and sub-partition number for last partition in range An operation’s location in the treeview is determined by the values of LEVEL.48 PStop This column represents the PARTITION_STOP column of the plan table. PARENT_ID and POSITION for the row containing it. ID.

. Move the mouse over the record selector and drag up or down. typing the text you want to search for. or Replace which would replace your current script with whatever SQL statement you select. the grid row height is vertically adjustable on a row-by-row basis. and clicking GO. The list will filter for statements that contain your search item. which means add the statement to your current SQL script. There are three different types of Add/Recall SQL statements: § § § Recall Previously Executed Recall Personal SQL Recall Named SQL SQL Recall Window The SQL Recall window has buttons that let you move to the Next or Previous statement. It also has buttons to Append.Chapter 5 SQL Editor 49 Recall and Add SQL You access the Add and Recall SQL dialogs items through the SQL-Window menu. There are also tabs to display All SQLs and Single SQL which show more detail of a long SQL statement. The Remove button lets you remove selected statements from your list. On the All SQLs tab. You can even search by clicking in the SQL Contains textbox. The purpose of Add/Recall SQL is to create a list of previously executed SQL statements in order to recall them at a later date instead of having to retype them. Cancel closes the window and returns you to the Editor. You can copy statements to the clipboard by clicking the Clipboard button.

The list of SQL statements is written to and read from the SQLS. The default number is 100.50 SQL Command Recall or Recall Previous SQL To Recall a SQL command Click the Recall Previous SQL button in the SQL Edit window toolbar OR Press F8 OR Select SQL Command Recall from the SQL – Window. page 55. Add to Personal SQLs Selecting this command from the SQL-Window menu adds the SQL statement that’s in the SQL Editor to your personal SQLs. The SQL Statement Recall window displays. deleting SQL statements. Running a Recalled SQL Statement After a SQL statement is recalled and placed in the SQL Editor. press <CTRL><ENTER> or <SHIFT>F9.DAT in the TOAD folder. The Recall window displays a list of the last X number of statements executed. You can later recall the statement by using the Recall Personal SQL command.DAT file from the TOAD folder. TOAD saves all statements in this list between sessions of TOAD in a file named PERSSQLS. for more details. It includes options for searching in SQL statements. See the Options for the SQL Editor topic. TOAD will search backwards one line from the current cursor position to find a SQL statement to execute. . but you can change this in the options. and displaying all or selected SQL statements.

Click menu item SQL –Window > Add to Personal SQLs. This window functions identically to SQL Statement Recall. Recall Named SQL You get to this dialog via the SQL Window > Recall Named SQL menu item (or press <CTRL>N). Add to Named SQLs This window lets you add a SQL statement to a user’s named favorite list.Chapter 5 SQL Editor 51 To Add a SQL Statement to the Personal SQL List 1 2 Select the statement by highlighting it in the editor. . Type the name you want to assign. Click OK. You have to add a Personal SQL Statement before you can Recall a Personal SQL Statement. Click menu item SQL – Window > Add to Named SQLs. To Add a SQL Statement to the Named SQL List 1 2 3 4 Select the statement by highlighting it in the editor. Recall Personal SQL only lists the ones that you’ve added to the list. Recall Personal SQL You access the window by clicking the Recall Personal SQL button in the SQL Edit toolbar or via the SQL-Window > Recall Personal SQL menu item. except that the list and order of statements is controlled by the TOAD user.

This window is a combination of SQL Command Recall. You can scroll through the previous statements directly within a SQL Editor edit panel by pressing <ALT> <UP> or <ALT> <DOWN>. The SQL statements are stored in the NAMEDSQL. More about Recall Every statement executed in a SQL Edit window is added to a most-recent-first list. Recall Personal SQLs. You can also remove statements from this list.52 The SQL Statement Recall window for Recall Named SQL Use this dialog to pick a SQL statement from your named list of SQLs. This prevents the list from containing misspelled column names. You can select/recall a statement from this list on the Statement Recall window. The Recall SQL window for Recall Named SQL lists the names on the left panel and highlights the corresponding SQL statement on the right panel.DAT in the TOAD folder.DAT file in the TOAD\TEMPS folder. All statements (to a maximum set in User Options) are saved between sessions of TOAD in the file SQLS. etc. and Recall Named SQL. You can check the Save Only Statements that are Valid checkbox in the View > Options > SQL Editor page. then copy it back to the SQL Edit window for execution. This checkbox item will only save those SQL statements that execute successfully. .

The values you enter are stored and retrieved for subsequent queries in the PARAMS. When you press F8 to recall a statement (or recall a statement via a menu item). the Append button will be the default button. Select * from employee where last_name = :NAME and TOAD will present the Variables popup window for you to input the value for the NAME bind variable. e. where a colon leads the bind variable name.g.Chapter 5 SQL Editor 53 Append versus Replace The View > Options > SQL Editor page > SQL window button on SQL Recall window Appends rather than replaces option changes the default button to be set to Append rather than Replace for the SQL Recall window.TXT file in the TOAD\TEMPS folder. Bind Variables You can execute SQL statements in the SQL Editor using bind variables.. If you select a statement in the grid and press <ENTER> it also activates the default button. If you double-click in the grid it activates the default button. but you can still select the Replace button. . if Append rather than Replace was checked.

EMPLOYEE and TOAD will present the same Variables popup window for you to enter the value for &schema.EMPLOYEE. enter DEMO.54 Substitution Variables You can also execute SQL statements with substitution variables where the ampersand leads the substitution variable name.EMPLOYEE. SELECT * FROM &schema. enter SCOTT. . If you wanted to query SCOTT. If you want to query DEMO. e.g..

Processing lengthy statements in the background frees up TOAD. The Options > SQL Editor page contains numerous options.Chapter 5 SQL Editor 55 Options for the SQL Editor You access the TOAD Options menu via the Configure TOAD Options button on the main toolbar or by selecting the View > Options menu item. the statements are actually copied to a separate background process window to provide a visual indication that the statement is running. Options > Editors. and Delete statements in background Default – Unchecked If this option is checked. Process statements in threads/allow queries to be cancelled Default – Unchecked If checked. SQL Editor Options are in three dialogs: Options > SQL Editor. UPDATE. for other tasks. Insert. The disadvantage to having this option checked is that more processing must occur. The background window contains Commit and Rollback buttons. INSERT. as well as your machine. and Edit > Editor Options. Process Update. The Cancel button will display on the SQL Edit window toolbar to the right of the Change Active Session button enabling you to cancel a long running query before any data is returned. so data retrieval is slower. When executed. . See page 76 for more information on the Edit > Editor Options Menu. TOAD will issue each query in a separate thread. and DELETE statements will be processed in the background.

This box lets you enter a custom number of SQL statements to save to your Recall Previous SQL list. Save SQL statement before statement Execution Default – Unchecked If checked. The background window contains Commit and Rollback buttons. If checked. . The list is saved to and retrieved from the SQLS. Only the most recently used SQL statements are saved. TOAD will only save the SQL statements that ran successfully for recall via F8 SQL Statement Recall dialog. When executed. PL/SQL statements will be processed in the background. the Save only statements that are valid option will not apply. Save only statements that are valid Default – Unchecked If this option is checked. the background process window will display showing the execution.DAT file. # of SQL statements to save textbox The default number is 100. then for the statement recall TOAD saves the SQL statement before executing it in case something happens during the execution.56 Process PL/SQL statements in background Default – Unchecked If checked.

you can press the F7 key to clear all text from the SQL Edit window without a confirmation dialog. If unchecked. and Perl are supported. Prompt to save contents when closing editor Default – Unchecked If checked. VB. Make Code Variable name textbox Default – SQL This lets you enter the variable name. TOAD will prompt you to save any text you typed in the editor. C++.VB This dropdown list lets you select the language syntax for TOAD to convert a SQL statement into (Make Code Statement function) and out of (Strip Code Statement function). TOAD will scan SQL statements for bound variables and ask you for the values before execution. Make Code Format dropdown list Default . Delphi. Currently. Scan statements for bound variables before execution Default – Checked If checked.Chapter 5 SQL Editor 57 Allow Clear All Text (buttons and F7 hotkey) Default – Checked If checked. . TOAD will tell you that the variables are not bound. but you can still use the Edit > Clear All menu item. If unchecked. F7 will not work. Java.

then the status panel will show the row and col location of the cursor in the editor.58 “SQL Window” button on SQL Recall window appends rather than replaces Default – Unchecked If checked. This is similar to the one Schema Browser and one Procedure Editor per connection options. TOAD will show the statement execution time until you perform further editing. this clears the query grid to Explain Plan tab whenever you clear the SQL Editor. If unchecked. Only show one SQL Editor per database connection Default – Unchecked If checked. . the default button and behavior will REPLACE the current contents of the SQL Edit window. the default button and behavior will append the selected SQL to the current contents of the SQL Edit window. Close query (grid) when clearing the SQL Editor Default – Checked If checked. TOAD will permit only one SQL Editor window to be opened per connection. If unchecked. Always show statement execution time (overrides ROW:COL display) Default – Unchecked If checked. TOAD will show the statement execution time in the status panel.

TOAD scans statements run in the SQL Editor. Script output font button This button invokes the font window where you can select the font for your script output. and then disables DBMS Output again. The default is unchecked. polls once.Unchecked If checked.PUT_LINE statement. then TOAD enables DBMS Output. If one is found.Chapter 5 SQL Editor 59 Automatically poll for DBMS Output if Output detected Default . . looking for a DBMS_OUTPUT.

TOAD will not prompt for a value. If you only want to process a portion of the edit text Highlight that portion AND : Press F9 OR Click the Execute Statement button. If & is the last character in a string.60 Executing Statements If the SQL Edit window has a single statement that you wish to execute Press F9 OR Click the Execute Statement button on the toolbar. etc. DDL statements. TOAD recognizes substitution variables in quotes as follows: If & is escaped. To execute a single statement among many statements (separated by at least one blank line) Click or place the caret/cursor within the statement you want to execute AND: Press <SHIFT> F9 OR <CTRL><ENTER> OR Click the Run Current Statement button on the toolbar. TOAD supports query statements. it is not considered a substitution variable. blocks of procedure SQL. .

you can also embed one script within another via the @ sign. 3.Chapter 5 SQL Editor 61 Execute SQL Scripts The SQL Edit window can process SQL scripts that contain DDL statements.sql insert into table values (2). TOAD uses the following priority to search for non-pathed files: 1. 4. edited. 2. Current directory in use by the editor Same path of parent script if present \TEMPS\ SQLPATH environment variable NOTE: A script that is opened in the SQL Editor. and more. Insert statements. . If a full path is not provided. and then executed via SQL*Plus is AUTOMATICALLY SAVED TO DISK before TOAD passes it to SQL*Plus for execution. insert into table values (1). As TOAD processes a SQL script. Some SQL*Plus commands are ignored as TOAD processes a SQL script. etc. For scripts that contain other SQL*Plus commands. For example. you can still execute your script using the SQL-Window > Execute SQL Window via SQL*Plus menu item. @c:\scripts\doscript. REM This is the start of my script.

Non-pathed files are created in the \TEMPS\directory. the original session is reconnected after the script terminates. SPOOL works differently in TOAD than in SQL*Plus. REM/REMARK / Slash DESCRIBE SHOW (show errors) Embedded script files are now supported using @ or RUN. SET ECHO (ON/OFF) – defaults to ON SET ESCAPE/ESC (ON/OFF) – defaults to ON SET ESCAPE/ESC ‘\’ (\ is any character) – defaults to \ SET HEADING/HEA (ON/OFF) – defaults to ON SET FEEDBACK (ON/OFF) – defaults to ON Note: Set Feedback N (N = a number) is not supported SET SERVEROUTPUT/SERVEROUT (ON/OFF) SET TERM (ON/OFF) – defaults to ON DEFINE/DEF and UNDEFINE/UNDEF PAUSE EXIT/QUIT (without parameters) PROMPT/PRO CONNECT/CON and DISCONNECT/DISC. TOAD only outputs data. The following SQL*Plus Script Execution statements are ignored: SET TAB VERIFY PAGESIZE . and the headings are not included. Following a CONNECT in a script.62 SQL*Plus Script Execution statements that are supported include: SPOOL Filename and SPOOL OFF (also SPO).

so it is recommended that you edit \TEMPS\PLSQLSUB.Chapter 5 SQL Editor 63 Table/View Aliases Setting up table or view aliases permits a shortcut for entering columns of a query. and a column list will popup for the DEPARTMENT Oracle table. It should look like this: table_name=alias such as: AAX_ACCESSGROUP_APPLICATION=aax ACA_ACTIVITY_ACTION=aca ACC_ACTIVITY_CATEGORY=acc ACD_ACTION_DESCRIPTION=acd ACP_ACTIVITY_CONTACT_PARTIC=acp ACT_ANALYSIS_CATEGORY_TYPE=act ADD_ADDENDUM=add ADT_ADDRESS_TYPE=adt AFP_ACTIVITY_FIRM_PARTIC=afp AGX_APPLICATION_GROUP_ITEM=agx DEPARTMENT=dept To use.TXT. simply type something like: select dept. However. It should look like this: . they will be presented on the SQL Modeler dialog when you select that table to build your query. The ALIASES. If you set up these table aliases in ALIASES.TXT. it would take you a long time to add a reasonably sized schema. To complete the SELECT SQL statement above. These are accessible through the Edit > Editor Options > Auto Replace tab. use Auto Replace Substitutions named similarly to the table aliases.TXT file is in the TOAD\TEMPS directory.

select dept. be sure to close and reopen TOAD to re-read the list.. string = string to replace it with You might want to use the underline _ because it is not as likely that a command will end with the underline _ symbol. then continue. select dept. Having the alias at the end keeps things tidy. the popup should appear.TXT or PLSQLSUB.64 aax_ = AAX_ACCESSGROUP_APPLICATION aax aca_ = ACA_ACTIVITY_ACTION aca acc_ = ACC_ACTIVITY_CATEGORY acc acd_ = ACD_ACTION_DESCRIPTION acd acp_ = ACP_ACTIVITY_CONTACT_PARTIC acp act_ = ACT_ANALYSIS_CATEGORY_TYPE act add_ = ADD_ADDENDUM add adt_ = ADT_ADDRESS_TYPE adt afp_ = AFP_ACTIVITY_FIRM_PARTIC afp agx_ = AGX_APPLICATION_GROUP_ITEM agx dep_ = DEPARTMENT dept i.. Select your column name.NAME from dep_ Press the spacebar and it autocompletes. If you type: select dept.e.TXT. ..NAME from DEPARTMENT dept If you edit ALIASES.

if you type dep and press <CTRL>. then press <CTRL>. (period). TOAD looks up the list of tables matching the letters. Type the first few letters of a table name in your schema. For example. the table name is automatically completed in the editor. If only one matches. (period). a popup list appears for you to select the desired table. If there is more then one match.Chapter 5 SQL Editor 65 Tablename Completion An alternative to using AutoReplace for tablenames is tablename completion. a list of all tables beginning with dep will popup. .

DCI. the following files distributed with TOAD must be located in the TOAD\TEMPS directory: PLSQLSCR.66 Configuring the Editor The editor in TOAD is used on the SQL Editor and Procedure Editor windows to edit SQL text. This section highlights some of the configurable features. In order for the editor to support syntax highlighting. . The Editor Options. If during a TOAD session you have used any window or function that retrieves the tablenames for the active Oracle session. which include some of the following options.TXT. tablenames will be colorized as well. and the list of reserved words used in each window is also customizable by editing the parser script file. The same editor is used in read-only mode on many other windows throughout TOAD. are discussed in detail in the next section. for syntax parser scripts PLSQL. § User configurable Syntax Color Highlighting The editors in the SQL Edit and Procedure Edit windows support flexible syntax highlighting. for code templates You must have the View > Options > Editors > Load view names from database at time of first editor window option checked. The highlighting is configurable in the Editor Options window. The View > Options > Procedure Editor > Highlight names of stored procedures option is checked by default.

. the default color of green for comment is being changed to light blue and italics has been unchecked.Chapter 5 SQL Editor 67 Here.

. In the offline text editor and in the Procedure Editor you can also have languages HTML. e. The list of languages and editor parser scripts shipped with TOAD is: Language HTML INI JAVA PL/SQL TEXT Editor Parser Script File HTMLSCR.TXT TEXTSCR. In the SQL Edit window editor. HTML.68 Editor Parser Scripts The primary configuration for the editor comes from an editor parser script text file that is loaded at runtime.TXT PLSQLSCR. . and is configured in the View > Options > Parser Scripts page > Language / File Extension Associations grid.TXT All editor parser script files are stored in the TOAD\TEMPS folder. JAVA.TXT JAVASCR.g. and TEXT. The language is determined from the file extension. this language is always PLSQL. This file is editable but be VERY careful if you decide to edit this file because NO technical support for altered scripts will be provided. INI.TXT INISCR. The particular editor parser script is determined from the language of the object in the editor buffer.

TXT. If you edit the PLSQLSCR. They are especially useful when you are trying to manage large files. you can copy LONGSCR.TXT. or Oracle Keywords from the lists that are syntax highlighted.TXT file.TXT or SHORTSCR. § Bookmarks Bookmarks help you manage files.TXT or SHORTSCR.TXT) to the desired file (LONGSCR. because no support will be provided for altered scripts. If you want to change your earlier choice. PL/SQL Reserved words. Bookmarks can be accessed from the right-click menu. edit the corresponding editor parser script for that language. You can set up to 10 separate bookmarks within one editor.TXT file be careful. If you want to add or remove Oracle SQL Reserved words. A small green box containing the bookmark number will appear in the editor gutter.TXT contains almost twice as many items for syntax highlighting and will give you access to over a thousand reserved words and keywords. Another way to change your selection is via the View > Options > Parser Scripts tab. Change the path for the PLSQL Parser Script File (PLSQLSCR. .Chapter 5 SQL Editor 69 Long and Short PL/SQL Editor Parser Scripts During the install process you were able to select from two flavors of the PL/SQL editor parser script: SHORTSCR.TXT and LONGSCR. then edit the PLSQLSCR. The longer list might affect performance depending on your editor contents.TXT). To set a bookmark Press <CTRL><SHIFT># where # is a number between 0 and 9.TXT over PLSQLSCR. Mark a position within the SQL Editor so that you can easily jump back to that line. LONGSCR. If you want to add or remove words from the syntax highlighting of the other languages. See the TOAD GETTING STARTED GUIDE for more details.

TXT in the TEMPS directory. Note that these keystrokes assume you have not altered the default editor keys. Once a file is closed. Select the command from the left panel. but you may edit and add to the list on the Editor Options window. NDF is automatically replaced by NO_DATA_FOUND. go to the Edit > Editor Options > Auto Replace tab.70 To jump back to a bookmark Press <CTRL># where # is a previously defined bookmark between 0 and 9. page 89. § User defined keystrokes for common editing commands Click Edit > Editor Options > Key Assignments to access the Key Assignments window. If you specify a substitution pair of NDF = NO_DATA_FOUND and you type NDF and press a delimiter. (c) = ©. the substitution pairs will be saved to an ASCII file named [Language]SUB. See the Key Assignments topic. To access Auto Replace. The TOAD parser scripts come with a handful of Substitution pairs. if you specify a substitution pair of ACT = ACTIVITY_CENTERS. The Auto Replace substitutions for each language type are stored in separate files in the TOAD\TEMPS folder. ACT is automatically replaced by ACTIVITY_CENTERS. TOAD already has a few Auto Replace Substitutions specified: teh = the. § Auto Replace Substitutions A substitution is a text phrase that corresponds to replacement text. ndf = NO_DATA_FOUND. . for more information. The Add or Edit buttons display easy-to-follow steps so that you can add new key assignments or edit existing ones. For example. The Delete button deletes the highlighted key assignment. the bookmarks are reset. when you type ACT and press <SPACE> (or other configurable word delimiters). and its associated Key Assignment displays in the right panel. Once saved from this window.

where [Language] can be HTML. you can continue to alter the substitutions in the Editor Options window or directly in the [Language]SUB. § Code Completion Templates Code templates expand upon the Auto Replace Substitution concept. the cursor will be placed at that point in the template.TXT TEXTSUB. Code templates are more than a single phrase and can contain line feeds. If a vertical pipe character is in the code template. JAVA. PLSQL. .Chapter 5 SQL Editor 71 Language HTML INI JAVA PL/SQL TEXT Auto Replace Substitution File HTMLSUB.TXT INISUB.DCI from the TOAD\TEMPS folder. INI. Code templates are loaded from the text file [Language].TXT JAVASUB.TXT file. or TEXT.TXT Thereafter.TXT PLSQLSUB. but a manual keystroke (<CTRL><SPACE>) is required to perform the substitution.

Code Templates tab. If the word or phrase under the cursor does not match an existing macro verbatim. or via text editor on the *. EXIT WHEN c1%NOTFOUND.72 Example: One of the code templates defined in PLSQL. TOAD will load the body of the template and place the cursor at the position of the vertical pipe char.DCI is: [crbl | entire cursor block] DECLARE CURSOR c1 IS SELECT | FROM BEGIN OPEN c1.DCI contains sample templates which you can alter to suit your needs. CLOSE c1. WHERE. c1rec IS c1%ROWTYPE. END LOOP.DCI files. END. a dropdown list of all macros is displayed. Where: "crbl" is the macro for the template (the text YOU type) "entire cursor block" is the description of the template everything following until the next template is the body of the template NOTE: Do not leave spaces between the end of the template description and the final right bracket! NT4. \TEMPS\PLSQL. LOOP FETCH c1 INTO c1rec. If you type "crbl" and press <CTRL><SPACE>.0 API calls to manage profile strings have a bug which will cause reading of the templates file to fail. You can edit the code completion templates directly in the Edit > Editor Options dialog. .

" Find Closing Block can only be accessed on the right-click menus of the SQL Editor and Procedure Editor.Chapter 5 SQL Editor 73 § Undo/Redo These basic editing commands are accessed from the Edit menu. This is available on the right-click menus of the editors and is also on the Main Edit menu. or "END IF" for matching "IF. "END" or "END IF. . § Uncomment Code Block This function uncomments the selected block of text by removing "--" from the beginning of each line. "END" for matching "BEGIN".” If you select/highlight a left parenthesis. Command Undo Redo Keyboard Shortcut <CTRL>Z <SHIFT><CTRL>Z § Comment Code Block This function comments the selected block of text by adding "--" before each line. or "IF". § Locate Closing Parenthesis (Find Closing Block) Finds the closing parenthesis. this function will show the matching right parenthesis. "BEGIN". This is available on the right-click menus of the editors and is also on the Main Edit menu.

Find Previous. click Edit > Show All. and Replace You access the Find and Replace editing options from the Edit menu. The lines will be removed following any change to the text in the editor. you can click Show All from the Edit menu and Show All will display wavy red lines under every occurrence of the search phrase. you can check the Regular expressions checkbox to use regular expression syntax for your search. After you use FIND to search through your text for a word or phrase. . Find Next. Function Find Find Next Find Previous Replace Keyboard Shortcut <CTRL>F F3 <SHIFT>F3 <CTRL>R On the Find and the Find and Replace dialogs (Edit > Find. you can find and replace tabs with spaces. For example. The following are some examples of regular expressions.74 § Find. Only to be used after a FIND. Edit > Replace). Regular expressions specify text by its characteristics rather than its exact characters. \r Carriage return \n New line \f Form feed \t Tab character \b Backspace \s Space § Show All following a search To get to this function.

You can check/uncheck the Syntax Highlighting option from the View > Options > General page. which means the report will print using the same colors that are displayed in the window. If you get garbage characters on your color printout.Chapter 5 SQL Editor 75 § Configurable Print Options The Edit > Editor Options > General Options tab provides printing options. So. Use Syntax Highlighting when Printing Source Code This option is checked by default. . color printing is the default for printing SQL Edit text or Stored Procedure Edit code. turn off the Use syntax highlighting when printing source code and then try to print again. If you uncheck the View > Options > General > Use syntax highlighting when printing source code option. then the SQL text or Stored Procedure Edit code will be printed in standard black and white.

Click any of these items to display its corresponding options in the right panel.BIN and [Language]OPTS.BIN PLSQLKEYS. Key Assignments. where [Language] is either HTML. The editor options are stored in the [Language]KEYS. and modified on the popup dialog window that is available either from the right-click menu of the editor (on the SQL Edit or Procedure Edit windows) or from the Edit > Editor Options menu item.BIN INIKEYS.TXT PLSQLOPTS. the appropriate OPTS. This is useful on multi-user machines. PLSQL. and Code Templates items have Load from File and Save to File buttons.BIN JAVAKEYS. .TXT files in the TOAD\TEMPS folder.BIN TEXTKEYS. Use the Editor Options dialog. When a change is made to the Editor Options.TXT and KEYS.TXT TEXTOPTS. Language HTML INI JAVA PL/SQL TEXT Editor Options Files HTMLKEYS. and code templates. Each of these buttons lets you set up two or more collections of keystrokes. and Code Templates. Do not attempt to edit these files with a text editor. Auto Replace. deselected. For example.TXT JAVAOPTS.76 Editor Options Editor Options can be selected.TXT NOTE: The Key Assignments.BIN files are written out. Highlighting. and code templates. Auto Replace.BIN HTMLOPTS. The Editor Options lists categories in the left panel: General Options. INI.TXT INIOPTS. one user might prefer to use one set of assigned keys. JAVA. auto replaces. auto replaces. or TEXT. and another user might have a different set for a preference.

All are checked by default. Wrap lines when printing Print line numbers Print filename in header Print date in header Print page numbers . If the checklist is expanded. click the “–” to close the corresponding checklist. Printing Options These options are used when you print the editor comments to paper.Chapter 5 SQL Editor 77 General Options General Options contains four categories: Printing Options Display Options Control Options General Options Click the “+” next to each option to expand its corresponding checklist.

If you have chosen to display line numbers. If unchecked. You might want to increase the width of the gutter. If unchecked. Display line numbers in gutter Default – Unchecked When checked. to display large line numbers. When unchecked. the gutter displays. In the SQL Editor or Procedure Editor. you can also drag and drop the vertical right margin line left or right to change it. Show right margin Default – Unchecked When checked. and allow for multiple line selection with the mouse. NOTE: No word-wrapping occurs at the right margin line. the gutter does not display. breakpoints. Word-wrapping is discussed later in this chapter in the Show Word-Wrap Column section. .78 Display Options The display options let you control what is displayed in the editor. Show gutter Default – Checked If checked. line numbers will not display. no line to indicate the right margin will appear. this option displays a light gray vertical line indicating the right margin. line numbers. which is a vertical region on the left of the editor used to display bookmarks. but you have the Show gutter option unchecked. your line numbers which would display in the gutter will not display. in the Gutter Width textbox. this option will display line numbers in the gutter.

so you don’t have to drill down to the editor options dialog when you want to change the column settings. the cursor remains unchanged when you switch to overwrite mode as opposed to changing to a block. this displays the word-wrap column. . this option displays an arrow in the gutter for wrapped lines. So. which means no word-wrap column will display. the cursor is displayed as a block because it’s in overwrite mode providing a visual reminder that it’s in overwrite mode. if you enter 20. Show wrapped lines with the |> (arrow) glyph Default – Checked If checked. Word wrapping will not begin until you also check the General options > Word-wrap lines checkbox. For example. You have to enter a value in the word-wrap column value box in order for this to display. The vertical word-wrap line can be dragged and dropped to the left or the right. a dashed vertical line displays in column 20. and any lines longer than 20 characters will wrap. The default is 0. Block cursor on overwrite Default – Checked If this option is checked when you press the insert key to change to overwrite mode. you need to check the Show word-wrap column checkbox AND enter a value in the word-wrap column box. which is basically a dashed vertical gray line on the right side. If the option is unchecked.Chapter 5 SQL Editor 79 Show word-wrap column Default – Checked When checked.

spaces. the control characters (such as paragraph marks. this option will apply the capitalization effects that you select from the Highlighting Options section.80 Show control characters Default – Unchecked If checked. end-of-line characters. and TABs) will display onscreen in your scripts. Apply capitalization effects Default – Unchecked When checked. .

this option lets you select and drag text from an editor to another Windows application or another TOAD window. the editor will attempt to restore the current column position as you key up or down through the lines of text. this lets files be dragged and dropped from Explorer to a TOAD editor. the current column position is maintained. as you key up or down through the lines of text. Title as Load/Save Filename parameter Default – Checked This option is not applicable and not activated. If this is unchecked.Chapter 5 SQL Editor 81 Control Options Allow TCustomSyntaxMemo to be an lDragSource Default – Checked When checked. Respond to dropped files Default – Checked If checked. Track columns in vertical movement Default – Checked If this is checked. the cursor column position decrements as the lines of text get shorter. otherwise it places the cursor at the end of the line. If the text is wide enough. .

if you want to specify that “>” will override word-wrapping for a line. For example. . set word-wrap to column 16. enter it.82 Override word-wrap based on line start char Default – Unchecked You can specify a character or characters on the Editors Options dialog Word-wrap override chars textbox that will override word-wrapping for that line only. and you’ll get: This is over 16 chars and will word wrap But when you begin the line with your specified character “>” >This is over 16 chars and will not word wrap.

an appropriate number of spaces are inserted. the editor will fill the required gap with a minimum number of characters composed of TABs and spaces. Type this: This line of code starts in column 5 So does this line . Tab to next column Default – Checked When checked. the <TAB> key moves the cursor to the next column. if you double-click on a word in the editor it becomes selected. Insert TABs into text for TAB chars Default – Checked Tabs are inserted into the text when the <TAB> key is pressed. Auto select word on double-click Default – Checked When checked.Chapter 5 SQL Editor 83 General Options Auto indent Default – Checked If you have an indention already set when you type. it automatically indents the following lines. Otherwise. Insert mix of TAB/SPACE for optimal fill Default – Checked If checked.

If this option is selected. . you get this: this line of code starts in column 5 <SPACE><SPACE><SPACE><SPACE>so does this line Cursor beyond EOL Default – Unchecked When checked. you can type text or move the cursor past the right edge of each line of text.84 If the option is checked you get this: this line of code starts in column 5 <TAB><SPACE>so does this line Unchecked. you cannot type beyond the right margin even if the Cursor beyond EOL option is checked. text will automatically wrap at the Word-wrap Column margin. Word-wrap lines Default – Unchecked When checked.

and capitalization preferences for different items. fonts. in the current schema. For example. the datatype is underlined. the type size. Reserved word refers to Oracle reserved words.Chapter 5 SQL Editor 85 Highlighting The highlighting options let you select colors. the font. You can change the foreground or background colors for Reserved words. names. . etc. This lets you customize the way your code will appear for whatever is easiest for you to read. Here. In the preview screen. A preview pane is provided in the lower part of the window that shows you how the selections you make affect the preview example. the underline option is checked for datatypes. and even the capitalization.

you could syntax highlight SYS view names like this: And the result would be “Table_Privileges” in light red.86 The following items can be syntax highlighted independently: § § § § § § § § § § § § § § § § § Reserved Words SQL Functions Default Packages Exceptions Comments Identifiers Strings Numbers Symbols Datatypes Tablenames View Names SYS Views SQL Reserved Words PL/SQL Reserved Words Default Exceptions User Procedure Names For example. . initial caps.

They have only certain options enabled. You can change both the foreground and background colors that will display for the selected text. you must uncheck the default box to enable the dropdown menu.Chapter 5 SQL Editor 87 You can syntax highlight tablenames in your schema applying different colors and capitalization effects. Selected Text This is an item in the display items that refers to the colors that will display when you select text by either clicking and dragging the mouse over a section of text. and Gutter. Only the foreground and background color sections are enabled. In such a case. Left Margin This item only enables the background color choice. If the background color default box is already checked. the dropdown menu will be disabled. or pressing <SHIFT> and one of the arrow keys to select a portion of text. The last three display items. You can preview your new selected text colors before clicking OK. by selecting text in the preview window and seeing how the new colors affect the selected text. The other selection areas such as font are disabled when you click on the Selected Text item. . The dropdown menu displays a color palette from which you can choose the color for the left margin vertical bar. do not refer to actual code content. Selected Text. Display Item This lists the display items from which you can choose to modify how they will appear. Left Margin.

.g. Initial Caps – The item will appear with only the first letter of each word in caps. Uppercase – The item will appear in all uppercase letters. Capitalization effects are only applied to your text after you change lines up or down in the editor. the dropdown button is disabled.g.. Your choices are: Unchanged – No special capitalization will be applied. e.88 Gutter This item only enables the background color choice. If the Use Default box for the background color is checked. For object names that contain the underscore character. Lowercase – The item will appear in all lowercase letters. Table_Name. Default The default item lets you change the appearance of your default text if you want to use colors or fonts that are different from the defaults. type: select * from table_name and you will not get capitalization effects until you press <ENTER> or go up or down one or more lines then it is translated to: SELECT * From Table_Name . the Apply Capitalization Effects checkbox in General Options > Display Options must be checked in order for your capitalization effects to display. The editor supports only one font name for all display items. you need to uncheck the Use Default box so that the dropdown button is enabled. E. the first letter after the underscore will also be capitalized. Capitalization Effect This dropdown list lets you choose how your item will be capitalized. In such a case. However.

The Key command categories listed are: Bookmarks Caret movement Clipboard operations Deletion operations Miscellaneous Click the expand button to expand a category’s list. and that item’s keyboard shortcut will display in the Activation key sequences window. .Chapter 5 SQL Editor 89 Key Assignments Clicking on the Key Assignments item displays the corresponding Key Assignments options. Select an item from the list.

you can click a sequence from the list to highlight it and then click the delete sequence button to delete that highlighted sequence.90 Add new sequence This brings up a series of step boxes that let you add a new sequence by simply typing the sequence in the step boxes. If a list of sequences is in the box. Edit sequence This lets you edit the existing sequence through a series of step boxes. . Delete sequence This deletes whatever sequence is currently highlighted in the Activation key sequences window.

TOAD already has 5 Auto Replace items. If type this (c) (r) (tm) ndf teh Replaces with this © ® TM No_Data_Found the .Chapter 5 SQL Editor 91 Auto Replace Click on Auto Replace to display its corresponding options menu.

You can directly edit the SUB. click OK and the list will be updated.TXT file to add.TXT file. PL/SQL. JAVA. .92 Add definition This box is enabled after you click in the Current selection window and type a character. click in the With window (the window next to the current selection window). If you exit the window without clicking OK the new definition will not be added. Click the Delete definition button to delete the definition from the list. or change the autoreplace substitutions without having to go through the Editor Options dialog.that” then “this” will be autoreplaced when the “. “\n” is a carriage return. Remember to Click OK before exiting the window. and type a character in the With window. : = [ ] \n \t \s These keys will separate one word from another and trigger the editor to check for and replace one word for another. Click OK and the definition will be deleted. After you type the new entry that you want to replace the current selection with. For example. where [Language] could be HTML.” key is pressed. Auto Replace activation keys . delete. if you type “this. Then click the Add definition button to add this to the Auto Replace list. The window to the right is where you type the replacement text. INI. and “\s” is a space. The first blank window is where you type the text that you want automatically replaced. Replace definition This button is enabled after you make a selection from the already defined Auto Replace list. The autoreplace items are saved and recalled from the TOAD\TEMPS\[Language]SUB. “\t” is a <TAB> character. . or TEXT. Delete definition This button is enabled after you select a definition from the existing Auto Replace list.

TXT JAVASUB.TXT PLSQLSUB. .Chapter 5 SQL Editor 93 Language HTML INI JAVA PL/SQL TEXT AutoReplace File HTMLSUB.TXT TEXTSUB.TXT Code Templates Click the Code Templates item to display its associated options.TXT INISUB.

DCI file.DCI INI.94 Shortcut/Description window This window lists the code templates that are already defined. Code template items are saved and recalled from the TOAD\TEMPS\[Language]. where [Language] could be HTML. PLSQL.DCI . Language HTML INI JAVA PL/SQL TEXT Code Templates File HTML.DCI PLSQL. click the Delete definition button. delete. You can then type in the shortcut name.DCI JAVA. INI. and then click OK. JAVA. or change the code templates without having to go through the Editor Options dialog.DCI TEXT. Then tab and type in the description. To delete a definition. or TEXT. Add definition Click the Add definition button.dci file to add. and a new line with the word new appears in the shortcut templates window. Click on an item from this window and its template will display in the display window that is under the Shortcut/Description window. select the Shortcut/Description you want to delete. You can directly edit the . Delete definition The Delete definition button is enabled when you click on a line from the Shortcut/Description window.

You can also press F10 to display the right-click menu. "END" for matching "BEGIN". Options include Choose. To format a DML statement. Default. This provides a shortcut to the functions listed in the menu. Find Closing Block Finds the closing parenthesis. or "END IF" for matching "IF" Optimizer Mode This changes the optimizer mode for the entire session. The right-click menu includes the following: Format SQL TOAD’s internal formatting mechanism only supports Select statements. and All Rows. . If you use the internal formatter on anything other than Select statements you will get errors. Rule. If you have PL/Formatter or Formatter Plus installed. First Rows. highlight the statement you want formatted. rightclick and select Format SQL. Formatting Tools will display in the menu instead of Format SQL.Chapter 5 SQL Editor 95 Right-click menu Click the right mouse button while you are in the SQL Editor to access the corresponding right-click menu.

because you can format the results visually or graphically. It’s more flexible than using SQL* Plus. The Grid lets you take the results of a query and perform a variety of functions and display options. . you can see all rows and columns of the given table in the results grid. Query statements MUST return the ROWID to be updateable. rowid from employee would be updateable. If you have the optional PL/Formatter. For example: select * from employee would not be updateable whereas: select employee. Editable Data Grid The data grid that displays the results of the SQL queries is fully editable providing that the query returns an updateable resultset. Data tab The Data Grid is discussed in detail in the Data Grids chapter of this manual. If you type and execute Select * from tablename in the SQL Editor. and Script Output. Auto Trace.96 SQL Results Panel The SQL Results Panel tabs include: Data. a tab for Code Statistics is also on the panel. Explain Plan. The SQL Results Data Grid lets you view output from select statements.*. DBMS Output.

For example: edit employee If the resultset is editable but remains read-only. If it is an image or text file TOAD will launch the program that is associated with the extension.) Data can only be displayed once per cell each time the query is run. . (In order for the memo editor double-click feature to work the View > Options > Data Grids Data > Popup Memo Editor on double-click must be checked.Chapter 5 SQL Editor 97 To overcome this obstacle. A cell with BFILE data will display the word BFILE. You'll need to right-click the cell and select Pop-up Editor or double-click the cell to see the cursor data. A red or green box displays in the status panel indicating whether the recordset is editable (green) or not editable (red). When a query is run with a cursor. Double-click on the cell (if option is enabled) or right-click and select Pop-up Editor to display the data. the cell with the cursor will display the word CURSOR. Cursors You can view cursor data. TOAD does not provide editing capability for BFILE data. BFILE Data You can view BFILE data. make sure the View > Options > Data Grid – Data > Default to Read-Only option is not checked. Nested Table Data You can view and edit nested data. you can substitute EDIT Items which TOAD will translate into the updateable version of the statement. A column will be added to the grid to show the BFILE directory. If you run the file in an associated program you might or might not be able to edit the file. Double-click (if the option is enabled) or right-click and select Pop-up Editor to view/edit the nested table data. A cell in the results grid that contains the nested data will display the word DATASET. depending on your rights.

. You define them as “long” in your SQL script. double-click on the cell (if the double-click option is enabled) or right click on the cell and select Pop-up Editor. TOAD can handle all four of these datatypes.98 VARRAY Data You can view and edit VARRAY data. LONG columns display the first several characters. Right-click the cell and select Pop-up Editor or double-click the cell (if the option is enabled). and LONG RAW columns display as (BLOB). Word docs. TOAD does not display the data for LONG RAW columns in a SQL Edit Grid. Double-click a LONG or LONG_RAW column to display the popup memo editor. LONG RAW columns display as (BLOB). etc. LONG RAW columns contain binary data that cannot be displayed such as GIFs. The memo editor will display the first 100 entries in the VARRAY. Object Data You can view and edit object data. and LONG RAW is similar to BLOB. To view/edit. A cell containing object type data will display the data in parenthesis delimited by commas. LONG columns are columns that contain character data up to 2 gigabytes. A cell with VARRAY data will display the word VARRAY. LONG and LONG RAW NOTE: LONG is similar to CLOB.

It must be checked for the above functionality to work. You can still use the popup editors to have a read-only view of the data. . You can edit in the editor or load a file into the editor. the Memo Editor window is displayed. For LONG RAW columns the Blob Edit window is displayed. Save To File lets you take the data from the LONG RAW column from the database and save it to a file on your hard drive. The popup editor for LONG columns displays the column text. Double-clicking on the LONG COLUMN $define popups a memo editor that contains the column text. Load From File lets you select a file from your hard drive and place it into the LONG RAW column in the Oracle database. For LONG columns. Note that the recordset has to be editable for the popup editors to edit the data.Chapter 5 SQL Editor 99 You edit these columns by double-clicking on the column and editing from the popup windows that display. The popup editor for LONG RAWS provides Load From File or Save to File functionality. go to the View > Options > Data Grids tab and make sure the Popup memo editor on double-click option is checked. If the popup window does not display.

LONG RAW Columns 1 2 3 4 5 Create a table: "create table long_raw_test (id number. 1 2 3 4 5 Create a table: "create table long_test (id number.100 To Edit LONG and LONG RAW Columns LONG Columns The recordset has to be editable for the popup editors to edit the data. long_raw_col should display (BLOB). including (at least the first few chars) the long cols. long_raw_col long raw)" Edit the table: "edit long_raw_test" Insert a row: enter “1” for ID then double-click on the long raw col cell Pick a file to import. "select * from long_test" should view all records. then double-click on the long col cell Enter text. Click the right arrow. . "select * from long_raw_test" should view only id. long_col long)" Edit the table: "edit long_test" Insert a row: enter “1” for ID. Click the right arrow Next Record button.

The Explain Plan also displays additional information.C. Rows. so TOAD adds no value to the display of the date. TOAD suppresses the time values if they are 12:00:00 AM (midnight). It will also work accurately well past Y2K. The time portion of the date fraction is zero. Bytes. and PStop (Partition Stop).Data dialog is for display purposes and does not affect the storage of time values. Explain Plan tab The Explain Plan tab displays the Explain Plan for the selected SQL statement. PStart (Partition Start). Performing a query: SELECT SYSDATE FROM DUAL will display the time. The interface has tabs for Operation. NOTE: Viewing previous Explain Plans via View > Explain Plan will not work unless you first create the tables needed for storage and retrieval of Explain Plans which you can do automatically via the Server Side Installation wizard (see the Getting Started Guide). queries of DATE datatype columns will display the time if it is not midnight. Oracle stores dates as a big fraction number offset from January 1.Chapter 5 SQL Editor 101 Time Values When displaying times with dates. including partition information for Oracle 8 and above. Explain Plan can be printed from the SQL Editor and the Kill/Trace window via the right-click menu item. In/Out. 4712 B. TQ (Object Node). Object name. Cost. Explain Plan is explained in detail in the Explain Plan section on page 44. Whether or not you use time. and similarly. The time dropdown in the TOAD Options > Data Grids . it's in there. It is then converted to a complete date and time. .

When you run a query you can find out some performance statistics related to that query. It helps with tuning. TOAD will ask you if you want to enable Auto Trace. Auto Trace is not recommended if a query is going to return a lot of rows. You can enable/disable Auto Trace through the SQL Edit right-click menu. If Auto Trace is disabled and you select the Auto Trace tab. it will be enabled . If you select Yes. because it will force a read of all data from the results of a query.102 Auto Trace tab Auto Trace displays the results of every statement issued while in auto trace mode.

Save to file. the DBMS Output will automatically display in the DBMS Output tab of the results grid. Frequency of polling You can set the frequency of polling (2 seconds to 15 seconds). Open a new DBMS Output window DBMS Output is discussed in the Procedure Editor chapter. Print. Clear window. When executing as script. You can also open a new DBMS Output window by selecting the Open a new DBMS Output window button. Set Output Buffer Size (invokes the Set DBMS Output Buffer window where you can set the size).Chapter 5 SQL Editor 103 DBMS Output tab When you execute a DBMS Output statement. . You can print from the Script Output tab via the rightclick > Print menu item. Script Output When you execute a script the results automatically display in this tab. and Delete Screen. Buttons let you Turn Output On/Off. you are not prompted to save changes because the script is not saved to a temp file.

. FILE NAME STRFUNCS.TXT OPTHINTS. go to the common edit toolbar in the SQL Edit window and select Show SQL Help. You can also access SQL Templates from the Procedure Editor window.TXT and USRFUNCS. an explanation of the item or function displays in the lower panel. You can modify the files. Items can be dragged and dropped into your SQL script. The items’ associated text files are located in the TOAD directory in the TEMPS folder.TXT PREDFXCP.TXT NMBRFMTS.TXT GRPFUNCS.TXT MSCFUNCS.TXT DATEFMTS.TXT PSEUDO. To access the SQL Help Templates.TXT USRFUNCS. Functions Number Format Options Oracle Pseudo Columns SQL Optimizer Hints Defined Exceptions User Provided Function List These templates are user configurable by editing the text file. This is especially useful for configuring PREDFXCP.TXT.TXT DATFUNCS.TXT NUMFUNCS.TXT CNVFUNCS. In the SQL Templates window.104 SQL Templates SQL Templates (Help) is a popup reference for Oracle SQL functions and expressions.TXT ASSOCIATED TEMPLATE Single Row Character Functions Single Row Number Functions Group Functions Date Functions Date Format Options Data Conversion Functions Other Misc.

Select an item from the dropdown list. OR You can click the Clipboard button to copy the item to the clipboard. . An explanation of the item or function will display in the lower panel. OR You can click the Direct button to automatically copy and paste the item into your SQL script.Chapter 5 SQL Editor 105 Show SQL Help To Access and Use SQL Help Templates 1 2 3 4 Click the Show SQL Help button that is located on the common edit toolbar. You can drag and drop the item to your SQL Editor.

translates it into the code development tool syntax. the Make Code Statement function takes the currently highlighted SQL statement.” If you have multiple SQL statements in the SQL Editor. You can now switch to the code development tool and paste in the results. rather than changing the code in the SQL Edit window as the Strip Code Statement function does.106 Make Code Statement and Strip Code Statement The SQL Edit window contains two functions that simplify copying SQL statements from TOAD to code development tools such as Delphi. The functions are called Make Code Statement <CTRL>M and Strip Code Statement <CTRL>P. Make Code Statement Adds the code development tool syntax to the SQL statement in the SQL Editor. VB. C++. For example. highlight the statement you want to make before executing the Make Code Statement function. or Perl. Java. When making code statements. and makes it ready to paste into the development tool code. A message displays in the status panel such as “VB statement copied to the clipboard. and copies it to the clipboard. taking this code and running Make Code Statement for VB code changes the SQL statement from this: select count(*) as cnt from all_tables where owner = 'DEMO' and table_name = 'EMPLOYEE' to this: Sql = " select count(*) as cnt" Sql = Sql & Sql = Sql & Sql = Sql & " from all_tables" " where owner = 'DEMO'" " and table_name = 'EMPLOYEE'" . and from those code development tools back to TOAD.

For example. Java. Currently. Delphi. taking this VB code from the VB development tool.Chapter 5 SQL Editor 107 Strip Code Statement Strips off the code development tool syntax from the SQL statement. Selecting the Code Development Tool You select the code development tool in the View > Options > SQL Editor tab > Make Code Format dropdown list. changes the SQL statement from this: Sql = " select count(*) as cnt" Sql = Sql & Sql = Sql & Sql = Sql & " from all_tables" " where owner = 'DEMO'" " and table_name = 'EMPLOYEE'" to this: select count(*) as cnt from all_tables where owner = 'DEMO' and table_name = 'EMPLOYEE' Now the SQL is ready to execute in TOAD. ready to execute in TOAD. C++. The Make Code Format dropdown list lets you select a language syntax for TOAD to convert a SQL statement into (Make Code Statement function) and out of (Strip Code Statement function). pasting it into TOAD. and running Strip Code Statement. copying it. and Perl are supported. highlight the statement you want to strip before executing the Strip Code Statement function. The default selection is VB. . If you have multiple SQL statements in the SQL Editor. VB.

108 External Editor You can use an external editor to edit the SQL Editor contents. which will start and load up the current TOAD Editor contents.SQL file. Otherwise. § . While in the SQL Editor or Procedure Editor.g. To set up. e. press <CTRL><F12> to invoke the external editor.exe %S. Select Yes. go to the TOAD Options > Editors > External Editor Command Line. path. c:\winnt\notepad. § You will be prompted to reload the contents of the file only if the View > Options > Procedure Editor > Reload files when activating TOAD if the file time stamp is changed option is checked.SQL file in the TOAD folder. quit the external editor. SQLPLS. the actual file is used.. which might ask you if you want to reload the contents of the SQLPLS. and click back on TOAD. and executable name of the external editor you want.SQL is used if the editor contents are not associated with a file. Enter the drive letter. save the contents back to the SQLPLS. Use the external editor.

will show views along with tables on the Table Select window. Reload last used tnsnames file Default . Backup tnsnames file before saves Default .Unchecked If checked. Tables are listed on one tab.Checked If checked. General Show Views on Table Selector Default – Unchecked If checked. views. . will show synonyms. Tables. this option automatically loads the last two tnsnames files that you edited into the TNSNames Editor panels. and Views are on a separate tab.Chapter 5 SQL Editor 109 Options for the Editors You access this menu via View > Options > Editors menu item. this option will backup the tnsnames file prior to saving the file. along with tables and optionally views on the Table Select window. and synonyms are listed on separate tabs. Show Synonyms on Table Selector Default – Unchecked If checked.

Otherwise they are returned in upper case. when you double-click on a word only the word will be selected and treated as the object name.110 Use syntax highlighting on tablenames Default – Checked If checked. tablenames will appear in black text. if the option is checked and you double-click on BONUS then EMP_BONUS_TAB will be selected. In the example EMP_BONUS_TAB. If unchecked. This option affects: Drag-drop of table names from the Table Name Select popup Drag-drop of column names from the Column Name Select popup The Clipboard button on the Column Name Select popup Drag-drop SQL Templates from the SQL Templates popup The dropdown when you type in a table name and press ". when you double-click on a word any underbar to the immediate left or right of the word will be treated as part of the object name. will return selected column names into the editors in lower case. Treat underbar character as part of object names Default – Unchecked If checked. If the option is unchecked only BONUS will be selected. Return table and column names in lower case from selection windows and drag-drop Default – Unchecked If checked. If unchecked." Drag-drop of column names from the Details panel of the Schema Browser Drag-drop of column names from the Describe popups for tables or views . will show tablenames in the SQL Edit window and other editors using the syntax highlighting feature.

Checked If checked. TOAD will copy color markups for pasting into email or other RTF enabled applications.EXE\TEMPS.Checked If checked. You access a Describe window by placing the cursor on a table. Find word under the cursor Default .Checked If checked. If unchecked. Use StayOnTop Describe Popups Default – Checked If checked. package or view in a SQL Editor or Procedure Editor and pressing F4. procedure.EXE\TEMPS location Default . the F4 popup Object Describe windows will use the Windows Stay on Top feature. . If unchecked.Chapter 5 SQL Editor 111 Allow RTF when copying to/from clipboard Default . when you open a Find and Replace dialog TOAD will automatically look for the word currently under the cursor.CHM are read will load from TOAD. The Object Describe windows are similar to the Schema Browser windows for the corresponding object types. function. TOAD will default to the word that you most recently searched for.TXT files that populate the SQL Templates window from the network or local workstation where TOAD. will load the .EXE and TOAD. Load Source for the SQL Templates window from TOAD. the text will be copied to the clipboard as standard black text.

If the table list is already cached. While in the SQL Editor or Procedure Editor. this option will cause TOAD to requery Oracle for tablenames every time they are needed to fill a list of tablenames. Load View names from database at time of first editor window Default . e. the list will override the global browser filter for tables when the Schema Browser window is opened.Unchecked If checked. path. This allows syntax highlighting for view names. which will start and load up the current TOAD Editor contents. view names will automatically load when you open an editor. Show Spec along with Body when describing a package Default .112 External Editor Command Line textbox Enter the drive letter.exe %S. press <F12> to invoke the external editor. . Load table names from database at time of Login for each connection Default – Unchecked TOAD caches tablenames and only queries tablenames the first time they are needed per Oracle session. c:\winnt\notepad.Unchecked If checked both the spec and body will be included in the Describe. If checked. and executable name of the external editor you want.g..

If unchecked. This lets you set the amount of time that will elapse between when you type a period in a statement that invokes the tables popup window and when the tables popup window automatically pops up. will not display the columns dropdown list. The spinner can be set from 50 to 2000 (2000 would be 2 seconds). items in the columns popup will display alphabetically. Delay for pop-ups ___ milliseconds spinner. Display parameter hints after typing open paren "(" Default .Chapter 5 SQL Editor 113 TOAD Insight Display pick list after typing object name followed by a period Default – Checked If checked. Sort pick lists alphabetically Default . will display the columns dropdown list.Checked If checked. parameter hints will display automatically when you pause after typing the open parenthesis. .Checked If checked.

etc. SYSTEM. To look up table columns while you construct a query This applies to any table or view that you can access. hold down the <CTRL> key and click the items you wish to select. 1 2 After you type the table name (or view name) and the period.114 SQL Editor Tasks This section will take you step-by-step through various tasks that you might want to perform with the SQL Editor. To select more than one item. press <CTRL>T (or wait a few seconds) A list of columns displays. SYS. 3 Click the item you wish to select. including objects from other schemas. .

.TABLE_NAME.SELECT_PRIV. TABLE_PRIVILEGES. you can press <CTRL>T to display a list of the columns from the SQL Results Grid. select table_privileges.INSERT_PRIV After a query populates the SQL Results Grid. TABLE_PRIVILEGES.Chapter 5 SQL Editor 115 4 5 Press <ENTER> OR Press <TAB> TOAD places the selected column or columns into the SQL Editor to build your query.

You can drag and drop the item(s). hold down the <CTRL> key and click the items you want to select. To select more than one item. View. on the common edit toolbar select the Show Tables window button. Click the item you wish to select. or Synonym names from the Table Name Select dialog to the SQL Editor. . in the common edit toolbar. The Table Name Select window displays. or copy <CTRL>C and paste <CTRL>V. pulls up the Table Name Select window. The Show Tables window button.116 To copy Table Names into the SQL Editor You can copy the Table. 1 2 3 4 From a SQL Edit window or a Procedure Edit window.

select the Show Columns window button.Chapter 5 SQL Editor 117 To copy Table Column Names into the SQL Editor The Show Columns button. pulls up the Column Name Select window. You can drag and drop the item(s). To select more than one item. Click the item you wish to select. 1 2 3 4 From the SQL Edit window or Procedure Edit window on the common edit toolbar. hold down the <CTRL> key and click the items you want to select. . in the second SQL Editor and Procedure Editor toolbar. The Column Name Select window displays. or copy <CTRL>C and paste <CTRL>V.

1 2 3 Place the cursor on the object you want described. Check the Include Column Headers checkbox that is listed in the Save Grid Contents dialog. Paste in the results. The Select Columns window displays. like Excel. Press F4. . Uncheck the undesired columns until the columns you want are the only ones checked. This saves the results to the Windows Clipboard. Views. Procedures. Functions. Select the Save As menu item from the right-click menu. A popup window displays that describes the object. 1 2 3 4 5 6 7 8 9 Execute a query. and Packages. Select the Select Columns menu item. To use TOAD to copy Oracle data to another Windows application You can query some data and process it further in another Windows application.g. Switch to the target Windows application. [select * from employee]. e.118 To get a description of an object while you are typing in the SQL Editor This applies to Tables. Right-click over the SQL results grid to display the right-click menu.

Once the window is closed. Execute it. Click the desired file. Drag and drop a file from Windows Explorer to the SQL Editor. Click the Open button. The file loads into the SQL Editor. Type in some SQL code. Refine it. A Select File for Edit window displays. the list is reset. . Loading a file The Load a file into the editor button.Chapter 5 SQL Editor 119 Ways to get code into the SQL Editor This section shows you the various ways you can enter or bring code into the SQL Editor. Save it to disk. You can click the triangle to display a dropdown list of the last 10 files you opened while you were in the SQL Edit window. 1 2 3 4 5 OR Click the Load a file into the editor button on the SQL Editor toolbar. Typing 1 2 3 4 5 Start with a blank window in the SQL Editor.

or Procedure Editor. Recall previous SQL The Recall Previous SQL button 1 Select the SQL-Window > SQL Command Recall menu item OR Press F8 OR Press the Recall Previous SQL button. To do this.DAT. It lists the last 100 queries that you executed in the SQL Edit window. SQL Editor node. The SQL Statement Recall window displays. page 49. via the File > Reopen File menu. This list is saved and restored to the file SQLFILES.120 File > Reopen File You can also open a file into the SQL Editor. The default is 100. Select a query from the list. There is a list of the last 10 files opened.TXT in the TOAD\TEMPS folder. select items from dept select item from dept (invalid) (invalid) (valid) select item from department Another option lets you enter the number of previous SQL statements that you want to save and recall. This is a useful filter because otherwise the recall list will fill with queries until you get it right. check the Save only statements that are valid checkbox. See the Recall and Add SQL topic. for more information. 2 3 4 On the TOAD Options dialog View > Options menu item. . The list of previous SQL statements is stored to and retrieved from SQLS. you can choose to save only the SQL commands that executed without errors. It is copied to the SQL Editor.

DAT.DAT. 3 4 The list of personal SQL statements is stored to and retrieved from PERSSQLS. The SQL Statement Recall window displays. Select menu item SQL-Window > Add to Named SQLs. .. OR Select the Recall Personal SQL button from the SQL Editor toolbar. The SQL Statement Recall dialog displays.g. Select the desired SQL.Chapter 5 SQL Editor 121 Recall a Personal SQL that you created The Recall Personal SQL button 1 2 Enter a query. OR Press <CTRL>N. 5 6 The list of named SQL statements is stored to and retrieved from NAMEDSQL. Select the query to return to the SQL Editor. e. Select menu item SQL-Window > Recall Personal SQL. Create and Recall a Named SQL statement 1 2 3 4 Enter a query. Enter a name. “Salary Query” Select menu item SQL-Window > Recall Named SQL. The queries are organized by the names that you select.

TOAD looks up the code completion template and plugs it into the SQL Editor.DCI file. In the SQL Editor. INI. e.g.DCI in the TOAD\TEMPS folder. For the SQL Editor the language would be PLSQL.122 Recall a Code Completion template that you previously set up 1 Edit [Language]. PLSQL. type in the shortcut keys. and the code in the same format as the samples already in the . or TEXT. the complete name. page 93. Enter the shortcut keys for the code snippet. for more information.. “crbl” Press <CTRL><SPACE>. JAVA. See the Code Templates topic. where [Language] could be HTML. 2 3 4 5 .

reference columns. For example. CLOB. LONG. bfiles. and Master/Detail Browser. Right-click menu The right-click menu for the Data Grid provides numerous display. cursors. objects. . when you double-click. Blob Edit is for LONG RAW/BLOB data type columns. For date columns. a text editor displays.6 Data Grids Each data grid includes context menu items and a print dialog. The data grid is used in the SQL Editor. Popup Editor The Popup Editor is for nested tables. for columns that are long (200 characters or more). and exporting options. Schema Browser (Tables > Data and Views > Data). printing. SQL Modeler. CHAR. a date picker is displayed where you can select a date from a calendar presentation. or VARCHAR data type columns.

Print Grid This invokes the Report Link Designer which is discussed later in this chapter. 1 2 3 Right-click to display the right-click menu. The ASCII standard for dividing data is the <TAB> character. If you want to make changes to the data in the Memo Edit popup window.124 To view and/or edit the contents of a large column Memo Edit If the View > Options > Data Grids > Popup Memo Editor on Double-Click setting is checked. the Memo Edit popup window is read-only. Save Grid Contents The Save As right-click menu item displays the Save Grid Contents window which contains format and file options. Delimiters Some programs require commas. Otherwise. to distinguish the data from one column to another column. the resultset must be editable. 1 Double-click a column to edit its value in the Memo Edit popup window. Comma Delimited – Divides data between columns with commas Tab Delimited – Divides data between columns with tabs Other Delim Char – You type the character you want to use as a delimiter . Click the Popup Editor menu item. which is a popular standard. Otherwise. Format radio buttons Default – Tab Delimited § § § ASCII.

XLS File – Saves the file as an Excel file.Chapter 6 Data Grids 125 § § HTML Table – Generates <TR></TR> and <TD></TD> HTML tags (tags for table rows and columns) and puts the values between the tags Insert Statements . SQL Loader . Replace. The Output file contains both header and data information and is ready to be used by SQL Loader. Truncate.Causes TOAD to start up Excel if it is not running or connects to an instance of Excel if it is already running and copies the data to Excel. If multiple tables were right-clicked from the Schema Browser. XML Plain – Saves the file as an XML data file with no XSL style sheet XML (with XSL) – Saves the file in the old XML format § § § § § The options panel includes radio buttons for Insert.Saves the file with Insert statement. it lets you supply the schema and table name. text will be enclosed in double quotes. Other options include: Double Quote Char (text) Columns Default – Unchecked If this option is checked. If Excel is already running when this feature is activated the data is created in a new sheet. and text boxes for entering the Field Separator and the String Fields Enclosed by character. When exporting a data grid. the schema and table names are filled in automatically. Append. supports "Include Nulls" option XLS Instance . Example: 7369 "SMITH" "CLERK" 7902 12/17/1999 .Saves the file in SQL Loader format.

TOAD will display a confirmation message that states the number of rows that were exported. Example: EMPNO 7369 ENAME SMITH JOB CLERK MGR 7902 HIREDATE 12/17/1980 SAL 800 Include NULL Text Default – Unchecked If this option is checked. the word NULL will be included for empty cells (cells that contain no information). . After you click OK. Example: 7698 BLAKE MANAGER 7839 05/01/1988 NULL 30 Zip resulting file(s) Automatically zips the file. If you save to file you can select to launch the file after it is created.126 Include Column Headers Default – Unchecked If this option is checked. the column headers will be included in the text output. You can save to File or Clipboard.

or save the data to a file. To rearrange the order of the columns 1 2 Select the column you want to move by clicking on its header in the grid. you copy the data to the clipboard. If after rearranging your columns. . This does NOT requery the data from the database. They will NOT be included when you copy to clipboard or save to file. the data will be in the new column order. Uncheck the columns you want to hide. It just temporarily hides the columns. The Select Columns window includes a checkbox for Row Numbers. This lets you display or hide row numbers in the data grids.Chapter 6 Data Grids 127 Select Columns – Row Numbers Check or uncheck the columns you want to see. Drag the column(s) left or right as desired. To temporarily hide selected columns 1 2 Select the Select Columns item from the right-click menu.

over the border between two columns. the columns of data. On the Options tab select the table to export. Export to Flat File When you Export to Flat File. Execute This button exports the data to the file. table owner. what line they will appear on.. Size columns to the width of the data and Allow columns to be less than the header width options. Spec Filename You can type in your filename or use the drill down to choose a target path. then the grid columns will be sized according to the View > Options > Data Grids . You must set up the Specifications File which will define the table name. § Move the mouse pointer to the grid headings.Visual > Size columns to the width of the headers. the starting column. The spec file indicates start and end points for columns which you can edit. re-execute the query.128 To set the column widths to a custom width setting If you want to see more or less of a column. and drag it left or right. then TOAD retains these custom column widths. and the length of each column of data. and the column widths would remain the same. If the columns of a query are different. Spec File tab This is where you set up where your columns will begin and end. . you export data to an ASCII file without column delimiters. You could add a WHERE clause. If the columns of a query are the same from query to query. or an ORDER BY. how many lines in the output file will be covered by a single record of data. etc.

46.1.Num Columns A sample flat file as exported will look like this: 7369 7499 7505 7506 SMITH ALLEN DOYLE DENNIS JOHN KEVIN JEAN LYNN Q J K S 667 670 671 671 7902 7698 7839 7839 12/17/1984 2/20/1985 4/4/1985 5/15/1985 800 1600 2850 2750 300 20 30 13 23 .5 COL7=HIRE_DATE.1.4 COL6=MANAGER_ID.78.1.1.1.15 COL4=MIDDLE_INITIAL.5 COL2=LAST_NAME.10 COL9=COMMISSION.Start Col.Output_row_num.88.3 The basic format for the column definition lines is: COLx=COL_NAME.1.15 COL3=FIRST_NAME. Example of a specification file: TABLENAME=EMPLOYEE TABLEOWNER=DEMO LINESPERRECORD=1 COL1=EMPLOYEE_ID.1.21.6.41.Chapter 6 Data Grids 129 Save Spec File This saves your specifications file and all your edits.1.68. not the width of the actual table data. Generate Columns This creates columns for your specifications file based on the DDL for the table.10 COL10=DEPARTMENT_ID.37.1.1 COL5=JOB_ID.36.22 COL8=SALARY.1.1.

you would select the schema and the table to export. Example: ENAME = ‘SMITH’ AND JOB = ‘CLERK’ You can press <F3> to find the next row with the specified value. Find Data The Grid Data Find window lets you search through selected columns for selected values or characters. You can specify whether you want the search case sensitive. the search is fast. . Select the desired case sensitive and partial match options. If TOAD needs to query ahead in the recordset. Enter the keyword or Value to find. If the records are cached. TOAD will search all records for the value and position the recordset to the first matching value. SQL Loader tab This tab lets you set up the import parameters for the file that you are exporting so that you can later import it through Oracle SQL Loader. and whether or not you want to have partial matches.130 Flat File Export from Table window You can also create a flat file from a table using the Database > Export > Table as Flat File menu item. Click the ADD button. On the Options tab. Click OK. This dialog lets you enter a multiple column search criteria. Select the Column you want to search. To find data 1 2 3 4 5 6 From the right-click menu or from the main Grid menu select Find Data. you’ll have to wait for additional rows to be fetched from the database. The Grid Data Find window displays.

Select the Grid > Copy Row menu item (also accessible from the rightclick menu). After the sequence is applied. Columns with assigned sequences are displayed in aqua. To copy one row to create a new one 1 2 3 4 Edit the recordset. and the SQL Modeler. move to the row above in order for the row to be sent to Oracle. . LAST_NME. the Master/Detail Browser. The following example uses Set Sequence Field. It creates a Sequence called SEQA that starts with 1. If you want to cancel from adding this row. and ID_NMR. increments by 1. Run the following scripts in the SQL Editor. the Schema Browser.Chapter 6 Data Grids 131 Duplicate Row This item lets you copy an entire row. This copies the entire row to the bottom of the SQL Results grid ready for you to edit. Set Sequence Field This invokes the Set Sequence Column window which lets you apply a previously created sequence to the selected column on the data grid. After you edit the cell contents. NOTE: the recordset MUST be editable before the Copy Row function will work. press the <ESC> key. if you add a new record in the table and leave the sequenced column blank. and has a maximum value of 4. They will create a table called SEQ_TABLE with columns titled FIRST_NME. Record count is cancelable in the SQL Editor. TOAD will auto-generate the next number in the sequence applied to the column. Click in a cell of the row you want to copy. 5 Record Count This displays a message window that shows the count of the number of records in the recordset.

Right-click in the data grid and select Set Sequence Field. In the details panel click the Data tab. NUMBER (4) NOT NULL. CHAR (20). 3 4 The Set Sequence Column window displays. For this example. The cells are currently empty of data.132 DROP TABLE SEQ_TABLE CASCADE CONSTRAINTS . From the Column dropdown select ID_NMR. use the Schema Browser. You can do this through the SQL Editor or the Schema Browser. 1 2 From the Schema Browser > Tables list select the SEQ_TABLE. . From the Sequence dropdown select SEQA. you need to display the data grid for SEQ_TABLE. CREATE TABLE SEQ_TABLE ( FIRST_NME LAST_NME ID_NMR CHAR (20). CONSTRAINT UNIQUEID UNIQUE (ID_NMR)) CREATE SEQUENCE SEQA START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 4 NOCACHE NOCYCLE NOORDER Next.

The fixed columns remain locked to the left in view during horizontal scrolling. and 4. The column(s) you select will be anchored to the left. right-click. Preview Current Column This displays a full row below each data row to show the value of the selected column. Once a column is fixed.” This is because you set the maximum records of the sequence to 4. The ID_NMR column populates with 2. other columns can be dragged into the fixed area. . When you click the Insert Record button 1 is automatically entered Insert 3 more records of names. When you display Row Numbers they automatically display as fixed columns. Click in a column. To move a column out of the fixed area click and drag it to the right of the bold horizontal fixed column divider bar. and select Fix Column to fix the selected column. Insert data in the record for FIRST_NME and LAST_NME. 9 Try to Insert data for a 5th record. “ORA-8004: sequence SEQA. You can then delete the extra record. Fix Current Column You can select and fix columns. 3.NEXTVAL exceeds MAXVALUE and cannot be instantiated. An error message displays. Remove Preview Column This removes the Preview Column.Chapter 6 Data Grids 133 5 6 7 8 Click OK. This is useful for viewing long varchar columns.

The new height adjustment automatically applies to all rows in the table. If you accidentally select a row you want to deselect. Row height adjustment is useful for viewing varchar columns. . Grid Options This invokes the Data Grids . Size Columns You have a choice of Size Columns to Data Size Columns to Headers About Row Height You can easily adjust the height of your rows by moving your mouse to the gutter (the left of the first column) and over a row divider line until you get the double arrow. press <CTRL> and click the row and it will be deselected. This is discussed in detail later in this chapter. you can only select one row at a time.Visual page. When Multi-Select is not checked.134 Allow Multi-Select When this is checked.Visual page which contains numerous display options including fonts and column sizing. then click-and-drag the row up or down to increase or decrease its height. The Font option is on the Data Grids . you can select more than one row by pressing <CTRL> and the rows you want to select.

In the Schema Browser. In the SQL Editor. if a sort filter has not been applied via the filter button. if the query does not contain an Order By. The View > Options > Data Grids – Visual > Confirm sorts when clicking on column header option is checked by default. you can click on a column header and invoke a Sort Options window that contains 3 radio buttons: Remove Sort.Chapter 6 Data Grids 135 Sort Options Window The Sort Options window lets you sort columns in ascending or descending order. It is invoked when you click on a grid column header under specific conditions in the Schema Browser and SQL Editor. You have to click the apply button for your sort choice to apply. the grid is sortable via the Sort Options window. the column-click sorting is disabled until you clear the sort filter via the filter window. Sort Ascending. Sort Descending. It also lets you remove sorts. You cannot sort row numbers. . Once you apply a sort via the filter window (which you can do in the Schema Browser).

You can use the calculator to perform calculations in the cell. When you get your final result press <Enter> or click outside of the calculator area. . and the new number remains displayed in the cell.136 Calculator You access the calculator by clicking on a number in an editable cell and pressing <Enter>. A dropdown arrow displays. Click the arrow and a calculator will display.

you cannot edit data in the data tab of the Schema Browser. Default to Read-Only Queries Default – Unchecked This option controls the ability to fetch updatable result sets in the data tab of the Schema Browser. Date format dropdown Default – Your Windows Control Panel. Time format dropdown list Default – h:mm:ss AMPM This lets you select a different time format. Regional Settings. Selecting a different format will override the Windows Control Panel setting. a popup window will display with the contents.Data page. Even if the option is unchecked a popup editor is available in the cell of a grid via right-click. the data in TOAD for date columns will display in the format selected in the Window Control Panel. The Data Grids Data options are on the Options > Data Grids . . when you double-click on any text column. Popup memo editor on double-click Default – Unchecked If checked.Chapter 6 Data Grids 137 Data Grids – Data Options You access the TOAD Options menu via the Configure TOAD Options toolbar button on the main menu or by selecting the View > Options menu item. Short Date Style Format Normally. If checked. if desired. This option is useful for LONG columns and other special datatypes.

. the ROW IDs will display in the data grids. this will trim off trailing spaces from data before posting it to the database. Show Row ID in data grids Default – Unchecked If checked. Trim string data before posting to Oracle Default – Unchecked If checked. you will be warned of cascading constraints before deletion. Check and warn of cascading constraints before deletions Default . Confirm data deletions from grids Default – Unchecked If checked. TOAD will stop editing if blank is entered in a NOT NULL required entry column. this will confirm each record deletion before deleting the record.138 Do not require NOT NULL columns in data grid entry (allow Oracle to enforce constraints) Default – Checked If this option is checked.Unchecked If checked. This also affects the data grids on the Schema Browser Data tabs. This lets you post a single column with just spaces. If unchecked. TOAD will not check for blank values during grid edits and will instead rely on Oracle for the constraint checking.

30 This is the number of years that will be subtracted from the current date (system date) to determine whether a two-digit year will be interpreted as a current century year or a previous century year. 1987. Anything outside of the sliding window will be treated as a current century year.Checked If checked. so the date produced will be Jan. If you enter 1/1/57. Click the Up and Down arrow to select the range. The range of choice is 0 to 49. the date is outside of the 30 year window. For example. Pressing <Alt> <Tab> doesn't count as a key-stroke or mouse-click that will stop the fetch. If you attempt to continue scrolling a message box will appear asking “Do you want to cancel the Data Scroll?” If you click “Yes” you cannot scroll any further down and no more data will be fetched. 2000 and you specify a 30 year window (which is the TOAD default) and enter 1/1/87. the date produced will be Jan. No more data is fetched beyond the point where you stopped scrolling. 1. and any number that falls inside the sliding window will be treated as a previous century year. 2057. 1. numbers with more than 15 places and floating point numbers with more than 15 decimal point places will display in scientific notation. If you click “No” you can continue scrolling.Chapter 6 Data Grids 139 Sliding window for entering two digit years Default . Display large numbers in scientific notation Default . . Allow key-stroke/mouse-click (Alt + Tab excluded) to cancel data fetches (grid scrolls) Default – Unchecked When checked. it lets you disable scrolling in a large data set. if your current system date is set for June 1.

. the old TOAD print grid will be used when printing data grids.140 Use older version of the Data Print Grid Default . The old TOAD print grid lets you select columns that you wish to include/exclude from the printout.Unchecked If checked. Old grid print font button If you check the Use older version of the Data Print Grid option. this lets you select the font.

1 This lets you change the number of lines included in the preview column. the item you selected is marked with a black rectangle. You can select from 1 (the default) to 5. Selection Default . when you select an item in the data grid and then click outside of the grid. If unchecked. Preview Column Lines spinner Default .Chapter 6 Data Grids 141 Data Grids – Visual Options The Data Grids – Visual Options are accessed via the View > Options (or the Configure Options button) > Data Grids – Visual page. the item and cell remain highlighted. when you select an item in the data grid and then click outside of the grid. Show Focus Rectangle Default . when you click outside the grid the item and cell are no longer highlighted. .Checked If checked. If you select 0 the preview is removed and you cannot preview columns.Checked If checked. the grid displays around the data (lines appear between the rows and the columns). Grid Default – Checked When checked.

Row lines Width spinner This controls the thickness of the lines between rows on the data grid. Changing the font here only affects the font displayed in the preview column. All data grids will have the same font. Changing the font here only affects the font displayed in the headers of the data grids. Changing the font here affects the entire data grid. Header button Default – MS Sans Serif 8 point This invokes the font selection dialog. Options Column Sizing Default – Checked If checked. you can click-and-drag between columns to resize them. Fonts Grid button Default – MS Sans Serif 8 point This invokes the font selection dialog. The measurement is in points. with the exception of the preview column and headers. .142 Font button Default – MS Sans Serif 8 point This invokes the font selection window.

Tab Through Default – Unchecked If checked. Tabs Default – Checked If checked. . you must also have Tabs checked. In order to tab through the records. clicking in a cell in the data grid selects the entire row rather than only one cell. Multi Select lets you select more than one row at a time by pressing either <SHIFT> or <CTRL> while clicking on the rows. this automatically engages row select. lets you tab from column to column through one record. You cannot tab through multiple records unless Tab Through is also checked. you can click-and-drag a column to another location in the grid.Chapter 6 Data Grids 143 Column Moving Default – Checked If checked. Row Select Default – Unchecked If checked. Multi Select Default – Unchecked If checked. you can tab through more than one record.

If checked. and the option is checked... you must select the cell twice to place the grid in edit mode or just begin typing in the cell. as soon as you click on a data cell in the grid. the grid will enter edit mode. If unchecked. it will still appear to enter edit mode but the data will not be editable.. the blank row will be deleted. . If the option is unchecked.. Immediate Edit Default – Unchecked If this option is checked.144 Cancel on Exit Default – Checked This applies to the Schema Browser > Data Grid for a table. then when you click back on the table name in the table list at the left. If the data grid is not editable. if you click the Insert Record button and do not enter data. the blank row will remain.

any data cells that are null will contain the words {null}. a column containing row numbers displays. Display {null} for null columns Default – Unchecked If checked. Show row numbers Default – Unchecked If checked. It is automatically fixed and the first column in the data grid.Chapter 6 Data Grids 145 Column Sizing Size columns to the width of the headers radio button Default – Not Selected If selected. Allow columns to be less than the header width Default – Unchecked If checked. you can make columns narrower than the width of the column header. columns are sized to the width of the data that they contain. Size columns to the width of the data radio button Default – Selected If selected. and data wider than the heading is truncated. the null data cells will display as empty cells. columns are sized to the width of the headings. Unchecked. Confirm sorts when clicking on column header Default – Checked .

Unchecked If checked. Click Ok. Allow Excel Style Filtering Default . .Unchecked This option applies to the last column of the grid. the row number background will be the same color as the border background. Less than. dropdown arrows display at the top of each column that let you access a Custom autofilter menu item. You can also toggle the Custom autofilter dropdown arrows via the data grids right-click Excel Style Filtering menu item. The autofilter lets you filter with a variety of dropdown choices such as Greater than. you can resize the last column of the results grid. and select Equals from the dropdown box.146 If checked. click Custom. The filter will only display rows in the column that start with M. Color row numbers same as grid border Default – Unchecked If checked. the Sort Options window displays when you click on a column header. Unchecked. if you want to retrieve all rows in a column that start with M. and Less than or Equal to. select the dropdown in the column header. Allow resize column out of grid Default . For example. If unchecked. the row number background will be white. If checked. when you click on the column it is sorted in either ascending or descending order (whichever is the opposite of its current state). In the textbox to the right of Equals type M*.

columns are printed on subsequent pages. Footers – Not applicable to data grids Group Footers – Not applicable to data grids . the Report Link Designer displays (unless you chose to use the older version of the print grid in the Data Grids > Data options). This contains options for how your printout will display. If unchecked. Show panel Bands Default – Checked If checked. The printout will print in spreadsheet fashion. Options tab Draw Mode dropdown The choices are: Strict.e. column headers are not included. Odd/Even Rows Mode.. printing will not truncate the output at the page width. the column headers are included in the printout. and Borrow from Source. Headers Default – Checked If checked. i. adds a blank band (bar) to the top of the grid.Chapter 6 Data Grids 147 Report Link Designer When you issue a print command for a grid (Grid > Print Grid or right-click on the grid and select Print).

will autocalculate preview lines and the Preview Line Count spinner will be disabled. Nodes Grid Default – Checked If checked.Not applicable to data grids . If unchecked.148 Preview panel Visible Default – Checked If checked. Grid panel Grid Default – Checked If checked.Disabled This is enabled if the Autocalculate Preview Lines option is unchecked. Autocalculate Preview Lines Default . If unchecked. the preview columns will printout. the grid lines (the lines between the rows and columns) will printout. Group Footers Grid . the grid lines will not printout. the column lines will not print in the data grid.Checked If checked. will print the column lines in a data grid. Preview Line Count spinner Default .

Chapter 6

Data Grids

149

Colors tab
Transparent - Not applicable Fixed Transparent Default - Unchecked If checked, you can select band and header colors. If unchecked, band and header colors are transparent. Group Node and Group Footers (and their color choices) are not applicable to data grids Grid Line Color dropdown Default - Auto You can select another color from the dropdown.

Fonts tab
Fonts you can change include: band, font, header, and preview.

Behaviors tab
Choices here include Bands, Headers, Footers on every page; Auto nodes expand; and 3D effects. Graphics as text is not applicable.

Miscellaneous tab
The Expand button checkbox lets you give your printout a tree effect. If you uncheck the Flat Checkmarks option the checkmarks will be 3 dimensional. You can also have your Checkmarks display as text (True/False).

Title Properties button
This brings up the Report Title window that lets you type a title in the Text tab and select fonts and alignment from the Properties tab.

150

After you’ve made your selections, click OK and the Print window will display. The Preview button lets you preview the printout. The Page Setup button invokes the Page Set up window, which can also be accessed via File > Print Setup. This lets you set your paper size, source, orientation (portrait or landscape), and margins. Remember, the screen width is wider than portrait page width.

7
Procedure Editor
The Procedure Editor lets you create or modify procedures, functions, packages, triggers, types, and type bodies. It also has an optional PL/SQL debugging function. It includes browser style back/forward buttons for code navigation. By clicking the right mouse button or pressing F10 you access a context menu with numerous options such as Set Bookmark and Uncomment Block.

NOTE: You cannot compile files that are not split (spec and body).

Ways to invoke the Procedure Editor window § § § § Click the button on TOAD’s main toolbar. Select menu item Database > Procedure Editor. Click the Procedure Editor button in the Schema Browser > Procedure Editor page. Set the Procedure Editor to StartUp on new connection in the View > Options > Windows page.

152

Procedure Editor Toolbars
The Procedure Editor toolbar includes buttons that let you Compile the current statement, Load a SQL File (The dropdown arrow lists the most recent files used while this editor window was open), Save to a new filename, Load source from existing object in the database, Reload the object from database or file, Create a new PL/SQL object, Compile dependent procedures, and Tune the current statement using SQLab Xpert. The Procedure editor also includes a Source Control toolbar (includes Get latest version, Check out, Check in, and Add Project) and a Formatter toolbar (includes Format code, Profile Code, and Launch Formatter Plus). If you have the optional PL/SQL Debugger, its toolbar will display to the right of the Procedure Editor toolbar. The last row toolbar is the Common Edit toolbar, a standard editing/formatting toolbar which is also used in the SQL Edit window.

Chapter 7 Procedure Editor

153

Shortcut Keys
Shortcut Key F1 F2 F3 F4 F7 F9 F10 F12 <CTRL>A <CTRL>C <CTRL><SHIFT>C <CTRL>D <CTRL>F <CTRL>G <CTRL>L <CTRL>O <CTRL>R <CTRL>S <CTRL><SHIFT> S <CTRL>T <CTRL>U <CTRL>V Function Display Window Help File Show/Hide error panel Find Next Occurrence Describe Table, View, Procedure, Function, or Package in popup window Clear all text Compile Display Popup Menu Pass the SQL or Stored Procedure Editor contents to the specified External Editor Select all text Copy Perform code completion (on a package or object type), also sees what procedures are new in spec and creates stubs for the body Display procedure arguments, for functions tells you the return datatype Find Text GoTo Line Convert Text to Lowercase Open a text file Find and Replace Save file Save File As Display columns dropdown Convert text to Uppercase Paste

154 <CTRL>X <CTRL>Z <CTRL><SHIFT>Z <CTRL><SHIFT><DOWN> <CTRL><SHIFT><UP> <CTRL><HOME> <CTRL><END> <CTRL><SPACE> <CTRL><TAB> <CTRL><ENTER> <CTRL><PAGE UP> <CTRL><PAGE DOWN> <CTRL>. . includes incremental searching Hyperlink jump current word Navigate back Navigate forward You can <CTRL>Click on a function or procedure and jump hyperlink-style to where it's declared. (period) <ALT><DOWN> <ALT><LEFT> <ALT><RIGHT> Cut Undo last change Redo Last Undo Jump to the procedure implementation in the body Jump to the procedure declaration in the spec Go to col. 1. row 1 of the editor Go to the last line of the buffer Display code template (key combination + <CTRL> <SPACE>) displays the applicable template Cycle through the collection of MDI Child windows Compile Go to previous package procedure Go to next package procedure Autocomplete tablenames.

Chapter 7 Procedure Editor

155

Parameter Hints
When you enter parameters for a procedure or function call, parameter help is available in a pop-up tooltip. The parameter hint automatically displays when you pause after typing the open parenthesis following the procedure call. It will display as long as the procedure reference can be resolved. When you enter in the parameter values, the current parameter will be highlighted in the tooltip. The parameter hint pop-up will close when you do one of the following: Press <ESC> Type the closing parenthesis Move the cursor to the left of the open parenthesis Enter more parameters than expected If the procedure is overloaded, you can cycle through the overloads by pressing <UP> and <DOWN>.

156

Using the Procedure Editor
Navigating through the Procedure Edit window is similar to navigating through the SQL Edit window.

Main ways to get code into the Procedure Editor § § § § § § Read from file Load from existing object from database Create new Procedure Editor dialog Type/Paste from scratch Drag and Drop from File Explorer Select procedure or trigger in Schema Browser and click Load In Procedure Editor button (the Procedure Editor Window button on the objects panel).

The F9 key compiles and then stores the code in the database.

If you have the optional PL/SQL Debugger and click in the gutter of the Procedure Editor, a breakpoint is created. So, when selecting text with the mouse drag the selector within the text area.

To Open a Procedure Using File > Open
1 2 3 4 While in the Proc Edit window, Go to File > Open File. The Load File window will display. Double-click on the selected file. The file is opened in the Procedure Editor.

Chapter 7 Procedure Editor

157

To Load Object from a database
1 2 3 4 5 Click the Load Object from database button. The Load Database Object window will display. Select the desired schema and object type from the dropdown lists. You can filter using object types and a starts with, includes, ends with filter. To preview the source for an object, select the object from the object list. Or, double-click on an object name to load it directly into the Procedure Editor. The selected object’s SQL script is displayed in the SQL script area of the Load Database Object window. You can toggle the auto preview button that’s at the top of the dialog to turn the auto preview on and off. Click OK.

6

7

The script is opened in the Procedure Editor, and the Load Database Object window closes automatically. The filter button on the Load Database Object window shows and hides the four widgets for filtering. If you hide the widgets, you have more area for the grid.

158

To Create an Object using the New PL/SQL Object button
1 2 3 4 5 6 Click the Create New PL/SQL object toolbar button. The New PL/SQL Object Options window displays. Select an object type from the dropdown list. Click in the Object Name textbox and type in an object name. Click OK. The template script with your object name is pulled into the Procedure Editor.

The default templates are NewProc.sql for a procedure, NewFunc.sql for a function, NewPackage.sql, NewPackageBody.sql, NewPkgFunc.sql for a package function, NewPkgProc.sql for a package procedure, NewTypeFunc.sql for an object member function, NewTypeProc.sql for an object member procedure, NewType.sql for an object type spec, NewTypeBody.sql for an object type body, and NewTrig.sql for triggers. You can edit the templates to create a common starting point for new stored procedures. There is also an option to load the templates from the network if you elected to install TOAD to a network server share. See page 111 for details. You configure templates on the View > Options > Procedure Editor > Proc Templates page.

Chapter 7 Procedure Editor

159

TOAD will automatically substitute values for keywords in the templates. TOAD will perform the following substitutions. Object Name: Sysdate: Date/Time: Date: Time: Username: %YourObjectName% or *YourObjectName* %SYSDATE% %DATETIME% %DATE% %TIME% %USERNAME% (set in TOAD Options, Procedure Editor)

Trigger Options: %TriggerOpts% For example, this template: /* Object Name: %YourObjectName% */ /* Date: %DATE% */ is translated into: /* Object Name: My_Proc_Name */ /* Date: 2/15/2002 */

TOAD can substitute variables in the code completion templates. If you have substitution variables in your code completion templates, then after you enter the code completion keystroke, TOAD prompts you for the substitution variable.

PL/SQL tables. Click on an item and it goes to that item in the code. records. Compiling will be disabled for files that are not split. exceptions. . When you open a package in the procedure editor the spec and body will open in separate tabs unless you choose for them to open in the same tab through the Options > Procedure Editor > File Splitting page. variables. It can also display the following declarations: constants. The navigator tree represents nested procedures. Each procedure will open in a separate tab. ref cursors. cursors. The upper right panel in the Procedure Editor contains the code for the selected object. system types. You can have several procedures open. record fields. which is displayed in the hierarchy on the list. subtypes. Each package is composed of a Specification (SPEC) and/or Body. Functions are in indicated with an f ( ) and procedures are indicated with a p( ).160 The left panel contains the navigator tree a list of objects or package contents. and Varrays. parameters. You can right-click in the tree and select what you want to display.

VALID or INVALID status.Chapter 7 Procedure Editor 161 The Error panel lists errors on the left in a list box and details on the right. A vertical splitter between the navigator tree and the editor lets you resize the navigator tree and the editor. Double-click on an error to invoke the Instant Messages screen for that Oracle error. Single-click on an error in the list to display the details and the error will highlight in the editor. A horizontal splitter between the editor and the error panel can be sized up or down. whether or not the code has been Modified. and whether or not the code was compiled successfully or compiled with errors. The Status panel shows the Row number and Column number of the cursor position. .

You can also right-click and select Execute without debugging. If your database contains many items. If GIVE_RAISE is the selected procedure and you click the Run button. If you select the Load Object from Database button you get a filter window. This populates the list of existing objects more efficiently. Sort Alphabetically This button is used to sort the navigator tree alphabetically If the button is UP. Navigator Tree Buttons Refresh Navigator This button refreshes the navigator tree. you need to right-click and select Show Navigator. If you close the navigator and want to reopen it. it will run the GIVE_RAISE procedure. the list appears in source code order. uncheck the View > Options > Procedure Editor > Automatically show objects on Select Database Object Window option and set up filters before clicking the Run button. regardless of whether or not you have the debugger. Close Navigator This button closes the navigator tree. If the button is DOWN (depressed). the items appear alphabetically. It runs the selected procedure. .162 Run button The Run button is only enabled for the debugger.

for User Procedures. TOAD will check the date stamp of the file to see if it was modified by the external program. TOAD will highlight functions and procedure names in the Procedure Editor. TOAD will display a prompt dialog that will say that the file date/time has changed and ask you if you want to reload it. if PROC_B is a stored procedure and you’ve designated stored procedures to be displayed in red. Highlighting tab. File Splitting. General Reload files when activating TOAD if the file time stamp is changed Default – Unchecked If checked. this allows editing in an external editor. When a Procedure Edit window containing a file is reactivated (gets focus). Select Yes. and the other read-only editors in TOAD. Debugging. and the file will reload. SQL Editor. This option refers to syntax highlighting.Checked This option must be checked if you want the Load Source menu item enabled in the Procedure Editor right-click menu.Chapter 7 Procedure Editor 163 Options for the Procedure Editor You access the TOAD Options window via the Configure TOAD Options button or by selecting the View > Options menu item. Highlight names of stored procedures Default . “PROC_B” will display in red. The Options > Procedure Editor page contains numerous options under General. NOTE: you must select a custom color in the Editor Options dialog. For example. and Proc Templates. If checked. If the file was modified. .

and you must select before any objects are shown. this basically puts owner name in the first line when loading from the database. Example: CREATE OR REPLACE PROCEDURE STHOMAS. source will be prefixed with the owner. the Create clause will read. "Create Procedure/Function/Package . the Create clause will read “Create or Replace Procedure/Function Package” and overwrite any existing objects that have the same name... the Create Procedure will not overwrite an existing object. no object type is selected (just a blank grid). When exporting source. instead of overwriting it. If unchecked. When loading PL/SQL into the Procedure Editor.". . an object type will be selected. source is not prefixed with the owner. and all objects that are not filtered will be shown. If unchecked.PROCEDURENAME IS If unchecked.164 Include Owner when extracting source From database Default – Unchecked If checked. This is useful if when compiling a procedure. if this option is checked. a different object of the same name already exists in the database. Use “CREATE” instead of “CREATE OR REPLACE” when loading database objects Default – Unchecked If this option is checked. hence the compile will fail. Automatically show objects on Select Object from Database Window Default – Unchecked If checked.

forcing a need to recompile PROC_A. the Modified flag in the status panel will toggle to “Modified”. If PROC_A calls PROC_B and you are editing and recompiling PROC_B. This is similar to the option that limits the number of SQL Edit windows and Schema Browser windows. Notification when compile process is complete Default – Unchecked When checked. If unchecked.Chapter 7 Procedure Editor 165 Search for Dependent Objects following a compile Default – Checked If checked. . Oracle flags PROC_A as INVALID. per connection. Toggle Modified Flag after compiling source from database Default – Unchecked If checked. TOAD will search the database for dependent objects of the currently compiled PL/SQL object (those procedures that call this procedure). Only show one Procedure Editor per database connection Default – Unchecked If checked. which you can then click to compile PROC_A. after you compile source from the database. enable the Compile Dependencies button. will enable the Compile Dependencies button. and therefore not leave any INVALID objects out there as a result of your changing PROC_B. this plays the TOADLOAD. and if any are found.WAV (croak sound) when the compile of a procedure has been completed. TOAD will check for this dependency. the Compile Dependencies button is always enabled. permits only one Procedure Edit window per database connection to conserve Windows resources.

Unchecking this option enforces the practice of loading and altering source files instead of storing the only copy of the code in the database. Use multi-line tabs in the editor Default . displays the Navigator hierarchy of package procedures and functions in the panel that is to the left of the Stored Procedure Editor.Unchecked If checked. and choose to save to separate files after splitting.Checked If checked when you load a package spec or type spec the corresponding body will be loaded. and when you load a package body or type body the corresponding spec will be loaded. the tabs will display with a horizontal scroll bar. choose to never split files (this disables compiling). Always load Package or Type Spec and Body as pair Default . . be prompted to split files. The Debugging options apply to the optional DBA module and are discussed in TOAD Help. The File Splitting options let you choose to automatically split files. This lets you click the procedure names in the navigator to advance the editor to that section of source. once a line of tabs is full.166 Allow compiling when source loaded from database Default – Checked If checked. TOAD will let you compile source that is loaded from a database. once a line of tabs is full the editor tabs will display on multiple lines. Show Navigator Panel Default – Checked If checked. use file splitting tags. If unchecked.

You can also press F10 to display the right-click menu. insert. Close Tab Closes the current tab New Tab Adds another tab and places the cursor on line 1 of your new tab Comment Block Adds dashes before the selected line or lines Format Statement TOAD’s internal formatting mechanism only supports single DML statements (update. it displays the procedure popup window. This provides a shortcut to the functions listed in the menu. Some of the functions that the menu contains are: Describe Displays popup window that describes the selected object. If you have PL/Formatter or Formatter Plus installed. Formatting Tools will display in the menu instead of Format Statement. . If you use the internal formatter on anything other than individual DML statements you will get errors. Many of these items are the same as the items found in the SQL Edit window right-click menu. If the item is a procedure. delete).Chapter 7 Procedure Editor 167 Right-click menu Right-click while you are in the Procedure Editor to access the right-click menu.

and Status Toolbars and includes a Customize Toolbars menu item Read Only Toggles a File’s Read-Only status . Debug Panel. "END" for matching "BEGIN" or "END IF" for matching "IF” Procedure Editor Desktop Lets you show/hide the Navigator Panel.168 Find Closing Block Finds closing parenthesis.

and then a separate process queries the buffer out and displays the contents. Oracle provides a package. In nested procedure calls. The Procedure Editor right-click menu lists DBMS_OUTPUT specific commands. Click the place in your script where you want to paste the DBMS_OUTPUT statement. etc. and paste keys work in the DBMS_OUTPUT textbox. Right-click to display the right-click menu for the Procedure Editor. called DBMS_OUTPUT. not while you are single stepping through the code. Output only comes out after the procedure has completed execution. You can edit DBMS_OUTPUT content. cut. It uses a buffer that your PL/SQL code writes into. all procedures must have run to completion before any DBMS_OUTPUT content is displayed. Select the Make Output Statement item.Chapter 7 Procedure Editor 169 DBMS Output You get to this dialog via the View > DBMS Output menu item. which is specifically designed with functions for debugging PL/SQL code. . Select Paste from the right-click menu OR the Edit menu. The standard copy. make comments. delete specific lines of output. To create a DBMS_OUTPUT statement 1 2 3 4 5 Highlight the desired selection from your SQL script.

Click the place in your script where you want to paste the statement. which you paste into your script and fill in the blank sections yourself.170 Blank Output You can also select Blank Output to get a DBMS_OUTPUT template. and the blank DBMS_OUTPUT Statement is pasted into your script. Select Paste from either the right-click menu or the Edit menu. . To create a Blank DBMS_OUTPUT statement 1 2 3 Right-Click and select the Blank Output Statement item.

The Tools Option window opens.oreilly. The Tool Properties window opens. 7 8 * NOTE: If you install the runtest script in a directory that uses spaces. Click the Add button. provides support for these instructions and for the script. Press OK to finish. 1 2 3 4 5 6 Save the script (on the next page) as C:\utplsql\runtest (or any other valid windows filename) Click the menu dropdown for Configure/Execute tools and select Configure.com/utplsql You can visit the open source project home page.net/projects/utplsql/ Please note that Quest Software.Chapter 7 Procedure Editor 171 utPLSQL TOAD works with Steven Feuerstein's open source utPLSQL program. such as: C:\Program Files\Quest\… then you must use single quotes in the parameters box. You can get more information about the background of utPLSQL at: http://oracle. where you can download utPLSQL and the latest script at https://sourceforge. In the Title box type in a title such as "Unit Test in utPLSQL" In the Program box type the path to SQL*Plus Type the following in the parameters box: $UID/$UPW@$SID @c:\utplsql\runtest $FIL where the path to runtest is the one you chose above* Click in the shortcut box and type in the desired shortcut. Any support issues for utPLSQL should be directed to one of the aforementioned Web sites. Inc. a unit testing framework for PL/SQL applications. To run utPLSQL from the toolbar/shortcut Chris Rimmer created the following steps and script. .

--Now run the test utplsql. END IF.prefix). 1). '\'. --Strip off ut prefix IF SUBSTR(filename.1).sql' '$FIL' Now when you are editing a package file (such as mypack.prefix THEN filename := SUBSTR(filename. or its unit test package (such as ut_mypack.0. --Chris Rimmer 15 Feb 2002 SET serveroutput ON SET verify OFF DECLARE filename VARCHAR2(100) := '&1'. dot PLS_INTEGER. dot . slash PLS_INTEGER. strips off its directory and --extension and calls utplsql. -1.172 The same rule applies for your source code. IF dot <> 0 THEN filename := SUBSTR(filename. 1. slash + 1). If the packages to be tested or the unit test packages are in a path which contains spaces. END.test ('mypack'). This relies on you using a naming convention where the package name is reflected in the file name. END IF. prefix_len + 1). This script works with TOAD: --RUNTEST.'. / pause Press ANY KEY TO CLOSE EXIT . IF slash <> 0 THEN filename := SUBSTR(filename. BEGIN --Strip off the directory slash := INSTR(filename.pks) it will run utplsql.test with the result. 1.SQL Version 1.2 --This file takes the given filename. --Strip off the extension dot := INSTR(filename. '. prefix_len PLS_INTEGER := LENGTH(utconfig. 1. prefix_len) = utconfig. then the $FIL parameter should be surrounded by single quotes: $UID/$UPW@$SID @'C:\Program Files\Quest Software\utPLSQL\runtest. 1). END IF.pkb).test(filename).

7 (requires the VM Development Interface) StarBase StarTeam 4. integration cannot be guaranteed at this time. The following vendors support SCC API and have been tested with TOAD: § § § § § Microsoft Visual SourceSafe 6. NOTE: The client portion of the Source Control install must be run. Other vendors might conform to the API but have not been tested with TOAD.2 (requires the Developer Studio Integration option) QVCS 3. Working Folder You must have a working folder set in order to use the TOAD Source Control interface.0 PVCS 6. and select the Set Working Folder option. Each SCC compliant product will create an entry in the registry identifying it as an SCC provider and identifying the location of the DLL used to invoke the SCC functions.5 (Quma) (use the QVCS client to add QVCS as a Source Control Provider) CS-RCS 2.Chapter 7 Procedure Editor 173 Source Code Management TOAD supports the Source Code Control (SCC). The SCC API provides functions to perform the common source control operations such as Check-out. For example if you are using Microsoft Visual SourceSafe. and Add File. a Microsoft API.140 (ComponentSoftware) Personal Version NOTE: Earlier versions of these software products have not been tested with TOAD. It defines a standard interface between development environments and source control products.5. therefore. Check-in. to set your working folder you would open Microsoft Visual SourceSafe. and we cannot guarantee their compatibility. You cannot run only the server piece of the Source Control install. . right-click on a folder.

it is set to read-only again. Check-in File When a file is checked-in. the file is reloaded from disk (it could be different than the file that was loaded). The toolbar on the Procedure Editor contains the check-in and check-out buttons. The Source Control Provider dropdown lists the SCC providers found in the registry. The Prompt for Comment checkboxes let you determine whether or not a dialog will display that lets you store comments with the respective action. To set the Source Control Options 1 Select the Source Control Provider that you wish to use with TOAD from the dropdown. The right-click menu contains a Source Control menu item that has the following submenu items: Check-out File When a file is checked-out.174 Source Control Options You must also have the interface to the SCC configured by selecting the Source Control options in the View > Options > Source Control page. Check file out of source control Check file into source control All the other functions are on the right-click menu. and it is made writeable. . you should restart TOAD. 2 Source Control is run through the Procedure Editor. If you switch providers.

Confirm your client is configured to support SCC API. original version. Source Control functionality does not work with database objects. Select project This produces a dialog (provider-specific) to let you select a source control project to work with. Select your SCC provider and check/uncheck options as desired. Read-only files cannot be edited. You confirm this by confirming that the client or the client install has created this registry key. for example. Steps for using Source Control from TOAD for the first time 1 2 3 4 Install your client.Chapter 7 Procedure Editor 175 Undo-checkout This command throws away any changes and reverts to the read-only. The selected project is retained in the .ini file between TOAD sessions. . All the SCC functions act upon the currently loaded file. Get latest version This refreshes the file from the source control and reloads the file (still readonly). This is useful. if you do not want any changes stored to the database. Add File This adds the current file to source control and reloads it read-only. it only works with files. A file that is not checked out should have a read-only status. Go to View > Options > Source Control.

8 If the file is already stored in Source Control. Otherwise. you can right-click and select Source Control > Add File to add it into Source Control. Your SCC provider will display a dialog that will ask you to select a project. It might provide a place for you to set a working folder. Depending on the provider and the configuration. you can check it in or check it out.176 5 6 7 Load the file that you want to work with into the Procedure Editor. Remember. This assigns it a checked in status. Source Control is run through the Procedure Editor. and you will have to check it out to modify it . it might also ask you to log in or browse for a database. Right-click in the Procedure Editor and choose Source Control > Select Project. NOTE: The working directory for the selected project must match the directory that you loaded the file from. Refer to your provider’s documentation if you need further details.

lets multiple Oracle users work on a Team Coding controlled project in their own schemas. With a third party version control product Team Coding allows a revision history to be kept for your code. triggers. Team Coding works with the Procedure Editor to control access and development of functions. lets you launch the third-party provider's browser. . You can use team coding alone or in conjunction with a third party version control system. It includes a built-in version control browser with a check in/check out system that does not require a third party version control product. and places script files under code control. using customizable groupings. and more. It provides more features in a more integrated environment. procedures.Chapter 7 Procedure Editor 177 Team Coding Team Coding is a cooperative source control feature. Team Coding lets PL/SQL developers develop stored programs without concurrently modifying the same objects. packages. Team Coding includes Flexible Code Control Groups that help you control objects from one or more schemas. For more information about Team Coding refer to TOAD Help. Team Coding does not have to replace TOAD's version control. It also works with the Schema Browser > Favorites tab.

you can view the DBMS_OUTPUT from the server. The PL/SQL Debugger. logic. as appropriate. and it will use those values. You can also access the Debug menu using the keyboard by pressing <ALT>U. You can run a debug session with or without argument values. the Debug toolbar displays to the right of the Procedure Edit toolbar in the Procedure Edit window. which is run in the Procedure Editor window. For all databases. and delete breakpoints. You can also set conditional breakpoints and apply pass counts. edit. for functions that depend on the argument values. If you have the Debugger installed. You can add. debugging begins and stops on breakpoints.178 Optional PL/SQL Debugger The PL/SQL Debugger is an optional feature for TOAD. line-by-line. The Debug menu is only enabled in a Procedure Edit window. After the procedure has executed. you can still check the branching. you must have the Oracle Probe API installed in order to debug PL/SQL using TOAD. So. Unless you specify parameter values in the Set Parameters dialog. statement-by-statement. You can also set argument values in the Set Parameters dialog. With the click of the toolbar button. lets you step through the code as it executes. etc. or it runs to the end. they will default to NULL values. Objects you can Debug § § § § § Top-level Functions Top-level Procedures Package Functions Package Procedures Triggers .

Press F7 (Trace Into) to start stepping through the code. 2 3 4 If you want to step into other procedures and view debug information. To start the Debugger 1 Open the Procedure Edit window from either the Database > Procedure Editor menu item OR Click the Open a New Procedure Edit window button on the main toolbar. Load a PL/SQL procedure into the editor or write a new procedure. . you’ll need to click the Compile Dependencies with Debug toolbar button before beginning the debug process. TOAD generates the symbol table required to obtain debug information for this procedure. Compile the procedure by Pressing F9 OR Clicking the Compile button on the Procedure Editor toolbar. select Debug from the menu. and several Debug functions will appear on the submenu.Chapter 7 Procedure Editor 179 Objects you cannot debug § § Java classes Anonymous PL/SQL blocks Right-click over the editor. You can Load a procedure from a file on disk OR Load a procedure from an existing object in the database OR Type a procedure from scratch OR Click the New Procedure button.

Checking this option can cause the Debugger to run slow. the procedure will execute to completion.180 When you begin debugging. if you haven’t set any breakpoints you might want to use the Step function <F8> instead of the Execute function <F11>. compile it once again by toggling the Debug button on the main toolbar to the off position and pressing F9 to discard the symbol table. Otherwise. if no breakpoints have been set and no errors occur. NOTE: When debugging a procedure. When you finish debugging your PL/SQL code. Tooltip Feature for Variables The Debugger has a handy tooltip feature. The View > Options > Debugging > Show executable line indicators in gutter option (available for Oracle 8.1. watched variable values in the dependent procedures will have “no debug information” displayed in the watches window.7 and later) will display a small blue dot in the editor gutter for an executable line of code. .” This is a common cause of confusion when people first start using the Debugger. To avoid this confusion. and it appears to have “done nothing. you can set TOAD to § § § Always compile dependent procedures Never compile dependent procedures Prompt you whether or not to compile dependent procedures To set any of these options go to View > Options > Debugging tab. This indicates where breakpoints may be set in the code. a tooltip pops up that tells you what the value of that variable is at that point in the code. When you are running the Debugger if you move the pointer over a variable.

“Valid” or “Invalid” displays.Chapter 7 Procedure Editor 181 The Status Panel Indicators When debugging PL/SQL code. You can display all the windows at once. the word “Running” displays in a segment of the Procedure Edit window status panel at the bottom of the window. Any of these windows can be docked together into one window (or combinations of multiple docked windows) by dragging the window title bar of one window and dropping it on another window. drag them by their tabs and place them on top of each other. and DBMS Output. The Dockable Windows There are four stay-on-top windows in the Debug menu: Breakpoints. after execution of the procedure has completed. To return the windows to their docked as one position. DBMS Output DBMS Output is also discussed in the Procedure Editor chapter. This creates a tabbed interface to the separate panels. The DBMS Output dockable window displays with the variable value listed. You can double-click on a floating debug window's title bar to dock it. To view the DBMS_OUTPUT 1 2 Select Debug > DBMS Output. Watches. Call Stack. If you are not debugging a procedure. . A right-click menu item lets you Dock to Procedure Editor which groups and docks all four windows.

This recompiles it without the debug symbol tables. so it will run faster.182 Preparing PL/SQL Code for Production Once you have finished debugging your PL/SQL code. This will make your code smaller. compile your procedure and any called procedures one last time with the debugger toggled off. For more information about the PL/SQL Debugger refer to TOAD Help. .

. The Conversion Formulas Celsius = (Fahrenheit-32) * 5/9 Fahrenheit = (Celsius * 9/5) + 32 Stored procedures are useful for processes that will be repeated over and over again. In this example. the procedures are the temperature conversion functions.Chapter 7 Procedure Editor 183 Procedure Editor Tasks This section demonstrates how to create a few simple functions using the Procedure Editor (converting temperatures from Fahrenheit to Celsius and from Celsius to Fahrenheit).

Click OK. . The New Procedure Create Options dialog window displays. you need to create a new stored procedure function that will convert Fahrenheit to Celsius.) 7 8 After F_TO_CELSIUS on the first line. Type in the function name “F_TO_CELSIUS”. (Now you need to edit the script with the input and return arguments. type the following: (IN_FAHRENHEIT NUMBER) After RETURN NUMBER IS type the following: OUT_CELSIUS NUMBER Your code should now look like this: 9 Scroll past the comment section and after the BEGIN statement edit the next line (it contains a tmpvar holder) to match the following formula. From the Object Type dropdown menu select function. OUT_CELSIUS := (5/9) * (IN_FAHRENHEIT – 32). To Create a New Procedure 1 2 3 4 5 6 Click the Create a new procedure button. A template script displays with F_TO_CELSIUS in the Create or Replace line.184 F_TO_CELSIUS First. 10 after RETURN type OUT_CELSIUS Notice the END statement has been automatically filled in.

. The final script should look similar to this. (See the right-click menu. If you get errors. they’ll display in the error panel. all extra comments and spaces have been deleted. Type <CTRL>R or choose the Edit > Replace menu item. in this case F_TO_CELSIUS. Compile button This function converts Fahrenheit to Celsius.) Then use the Edit/Replace function to change the copy of the Fahrenheit to Celsius script to a Celsius to Fahrenheit script. copy the code you’ve just created. and you can correct and recompile. You can compile the script for a quick syntax check.Chapter 7 Procedure Editor 185 END F_TO_CELSIUS. option New Tab. Here. and paste it into a new tab in the Procedure Editor. To Use Edit/Replace 1 2 3 Place the cursor on the text you want to replace. The Find and Replace dialog displays with the selected item already in the Text to Find entry. C_TO_FAHRENHEIT Now you can go to Edit > Select All and then Edit > Copy.

Type in IN_CELSIUS for the replacement. Confirmation dialogs will display. When you have finished replacing all. compile the procedure. which in this case would be IN_FAHRENHEIT. . press ESC to close the dialog window. 11 Repeat the Find/Replace or manually edit to change the following: OUT_CELSIUS to OUT_FAHRENHEIT 5/9 to 9/5 – 32 to + 32 (You'll need to manually edit line 5 so that the formula is in the correct order. Click the Replace All button to replace all occurrences of the text.186 4 5 6 7 8 9 Type in what you want to replace the text with. 10 Select the Replace All button. Select your next replacement item. The selection is already entered.) The final script should look like the following: Next. Press <CTRL>R to open the Find and Replace dialog. in this case C_TO_FAHRENHEIT.

The Set Parameters window opens. This adds a DBMS_OUTPUT statement. and the return value is displayed. Click OK in the Set Parameters window. Click OK. Return to your Procedure window. 10 Go to the DBMS Output window that you opened.Chapter 7 Procedure Editor 187 Using the just created Celsius to Fahrenheit script. A dialog displays with your argument filled in. . RetVal = 71. but the Procedure Editor provides a shortcut to typing in your own anonymous PL/SQL block. such as 22. and the dialog closes.6 You can also test the functions in a SQL Edit window. To input and output values 1 2 3 4 5 6 7 8 9 Open a DBMS Output window via View > DBMS Output. right-click. The value is automatically entered in the SQL Code panel. Check the Output OUT args checkbox. and select Execute without debugging. Type a value in the value cell. you can test the function. A Procedure Completed message displays.

.

You can cancel certain long running list populating queries in the Schema Browser. Select menu item Database > Schema Browser. For performance. details or the DDL structures for that object are displayed in the right panel. all views appear in the left panel when the Views type is selected. Ways to invoke the Schema Browser window § § § Click the button in TOAD’s main toolbar. Details for the objects are separated by tabs. It also lets you compare details between objects of the same type with one click. . Keyboard users can easily use the scroll keys to perform the same tasks.8 Schema Browser The Schema Browser separates database objects by type. all tables appear in the left panel when the Tables type is selected. For example. Set the Schema Browser to open automatically when a new connection is made in the View > Options > Windows dialog. This eliminates having to drill down through hierarchical mountains to find the desired data. TOAD delays fetching some schema lists until the dropdown or tab that requires that list is activated. The Statement Processing popup will display which lets you cancel. etc. When you select an object.

Object Lists Right-click in the tab area of the objects panel (the left-hand side of the window) to display a menu that lets you show/hide individual tabs. This means that the procedure was compiled using the Oracle wrap utility and is not stored in readable format. The vertical splitter between the objects panel and the details panel can be moved left or right via click and drag. All the tabs that show in the details panel are details for the selected object. you might see "wrapped" rather than the code of the object. Schema Browser options let you control how the object types will be displayed. an alphabetized dropdown. The next time you run TOAD. You can always show or hide tabs (for the tabbed view) or nodes (for the tree view) through the right-click menu. the window will hide the tabs that you unchecked in your previous session. Any Schema Browser Object can be dragged and dropped into the SQL Editor. When you exit. You can check or uncheck menu items to show or hide the tabs. all the objects in the list (left-hand side) have micro-help. you cannot hide the Tables tab. If you only want Views and Synonyms. In the non-tree view all the Object lists (left-hand side) can be sorted without requerying the database by clicking the column header. The default is a tabbed interface. You can choose a tabbed interface. hover the mouse over a table and it will display the tablename and the tablespace. For example. In the non-tree view. deselect the rest for a cleaner interface. All the left-hand side Object lists (except Favorites) are now multi-select enabled. or a tree view. . TOAD saves your options. However. You can also drag and drop multiple objects using multi-select (<CTRL> Click). When viewing Packages and Procedures.190 Using the Schema Browser The object types that display in the left panel depend upon the database version.

The dropdown box above the Object tabs lets you select the desired schema. such as Tables and Views. This does not affect the alphabetized dropdown list which displays if you have chosen to display the categories in a dropdown by unchecking the Tabbed Schema Browser option. the Tables tab is selected by default. Configure Browser Tabs window The right-click menu in the tab area also includes a Configure menu item which invokes the Configure Browser Tabs window that lets you rename and rearrange tabs. you can rearrange the order of the tabs by clicking in the gray box on the far left of the row of the item you wish to move and dragging the row to its new position on the list. You can rename these captions by simply clicking in a caption cell and typing. In addition. Or you can select a tab or caption cell and click the Up Arrow or Down Arrow in the window to move the whole row up or down in the list. have enhanced right-click menus that contain menu items for all the buttons on the objects panel and details panel of the page. You can press <F4> in the left-hand side lists to get describes for objects that have describes. The Configure Browser Tabs window has a Tab column that lists the actual category names and an editable Caption column that lists the captions TOAD is currently displaying for the tabs. Panels Right-Click Menus The Schema Browser panels contain right-click menus. Many of the pages.Chapter 8 Schema Browser 191 You can double-click an object in the left-hand side list to get to the alter screen for the selected object. Navigation When you first open the Schema Browser. and a list of all the tables in the selected schema displays. . The right-click menu in the tree view display lets you configure which nodes of the tree view to show or hide.

You can click on a session from the list to change the active session. From that point forward. Refresh All The Refresh All button refreshes everything in the Schema Browser. the “Table Name Select” dialog or the “Column Name Select” dialog. It will bring up the “Select Session” dialog where you can then click the NEW button to create the new session. This list is saved and restored in a file named schema_databasealias. Only show users that own objects in dropdown lists and Oracle Users List.LST. The status panel shows what session you’re in. To set up a specific list of Oracle users (schemas) that you want to see. e. in the TOAD\TEMPS folder.. The Change Active Session button has a dropdown button next to it. select menu item View > Oracle Users List. subject to any active table filters.g. SCOTT_ORA8I. click Refresh All which will requery. For details about “Show only schemas that own objects” see the Schema Browser options.g.. Its dropdown list displays all active sessions. This opens the Configure User Lists dialog where you can multi-select any combination of users you want to see. Refresh Current List The Refresh current list button refreshes the objects panel (left panel) list.lst. click the change active session button. The CNT on the status panel shows how many objects are in the object list for the object tab you’ve selected. . If you want to create another session. and the table name should display in the list.192 If you want to narrow the list of schemas in the schema dropdown list you have two choices. the Object tab window will be empty for that tab. any dialog in TOAD that presents a schema dropdown list will be restricted to the schemas you select. If an Object tab doesn’t contain any objects. If you create a table and you don’t see it in your table list. e.

Schema Browser Icon Legend This button opens the Icon Legend for the Schema Browser. the data is sorted ascending/descending but not filtered. Object name and Date created/altered The object name (and the date created/altered if available) displays on the top of the details panel for all object types. Filter § § § When the filter is red it’s ON.Chapter 8 Schema Browser 193 Refresh Detail The Refresh Detail button refreshes. The filter can display four states: empty. If you dropped a column. only the details panel. . ascending/descending filtered. When there are no filters. When the filter funnel is gray it’s OFF. On the Schema Browser page Tables > Data tab and Views > Data tab. a four-way filter button displays a dialog where you can sort and/or filter. or requeries. you can click on the Refresh Detail button to see the refreshed list. the filter is gray and it’s OFF. ascending/descending empty. Clear all data grid filters A button also lets you clear all data grid filters. You can expand and collapse individual nodes or all nodes. Here. It initially opens with the node expanded for the active Schema Browser page. filtered.

TOAD will omit SYS owned objects from the Procedure Dependencies lists (Deps tabs on the Procedure detail panel and the trees in the View Dependencies window). TOAD will automatically save the Data tab grid layouts with respect to column order and custom column widths. when you select an object from the objects panel TOAD will auto refresh the details panel.Checked If checked. such as standard packages. Data tab Omit SYS objects from the Procedure Dependencies List Default . . The options are on 2 pages accessed via the Data and Visual tabs. DBMS_UTILITY.194 Options for the Schema Browser You get to the Schema Browser Options menu through the View > Options (or the Configure Options button ) > Schema Browser item. Auto refresh details after selecting object on left hand side Default – Checked If checked. DBMS_STANDARD. etc. Save data grid layouts Default – Unchecked When checked.

. This conserves operating system resources. TOAD will use cursors when retrieving detail information to display in the details panels to the right of the Schema Browser window. TOAD will only permit one Schema Browser window to be opened per Oracle connection. uncheck this option. Use same schema after changing sessions Default – Unchecked If checked. TOAD will save the browser filters to disk in files named SCHEMA. This option is similar to limiting the number of SQL Edit windows in the SQL Editor option (Only show one SQL Editor per database connection) and Procedure Edit windows in the Procedure Editor options menu. when you change sessions within the Schema Browser the selected schema will be the same. where only the bind variable values change. and one is already open. So.FLT in the \TOAD\TEMPS folder.Chapter 8 Schema Browser 195 Save Browser filters Default – Checked If checked. only the object name changes from query to query. the use of cursors. Cache cursors used for queries (faster Browser but uses 12 cursors) Default – Checked If checked. because the Schema Browser is loaded with widgets. Only show one Schema Browser per database connection Default – Unchecked If checked. and bitmaps. buttons. TOAD will just switch to the existing Schema Browser window. If the user tries to create another Schema Browser window. If you want to reset your Schema Browser filters each time you close and open TOAD. Usually. is much faster than forcing Oracle to reparse and re-execute different queries each time.

BLOB. BLOB and CLOB data types can be large and can take a long time to load. Otherwise.196 Automatically show filter dialog for filtered lists on Browser Default – Unchecked If checked. Use NOPARALLEL hint in data grids Default . . Don't select BLOB/CLOB fields in data grids Default . Include disabled FK constraints in data grid lookup window Default . will use NOPARALLEL hint in the data grids. Set focus to table data grid after selecting table Default – Unchecked If checked. then the Schema Browser will open with only those objects matching the filter. before the Schema Browser window is opened a Filter Dialog will display for the user to enter filter criteria for tables.Unchecked If checked. disabled function key constraints will be included in the data grid lookup window. after you first pull up the Schema Browser page and select a Table on the objects panel and > Data on the details panel if you start typing you’ll be automatically editing in the data grid section. CLOB. and NCLOB type columns will be excluded from the query for the Data tab in Tables and Views pages.Checked If checked.Unchecked If checked. the focus will remain on the list of tables.

Limit grid fetch ___ fetches (25 records) Default – Unchecked If a value is entered. it fetches n more rows and then prompts again. e. or Only show users that own objects excluding Synonyms. This option affects all windows in TOAD with Schema dropdown lists. then a prompt will ask you if you want to keep fetching rows. If you respond yes. if it exists (db level option): textbox This lets you enter a default schema for the Schema Browser. "Column Name Select".Chapter 8 Schema Browser 197 Default Browser to this schema.g. It will fetch that number (n) of rows. The spinner range is 500 to 20000 milliseconds. This option does not affect the SQL results grid on the SQL Edit window. . the SQL results grids on the Tables > Data tab and the Views > Data tab are limited to that number of rows. This filter makes the schema dropdown list more manageable. "Table Name Select". Milliseconds for List Search Timer on LHS Lists You can select how many milliseconds for the list search timer. User/Schema Lists Default – Show all users Radio buttons let you choose Show all users. Only show users that own objects. etc.

length. scale. You can also check this ON or OFF via checkboxes on the Stats/Size tab. Show Column Length Info with Column Data Type Default – Checked If checked. Show Primary Key Columns for tables Default – Checked When checked. For some tables with long column names and/or compound primary keys. scale. Show Table Stats for Table Details (on the Stats/Size tab) Default – Checked If checked. will display the date and time objects were created and updated on the details panel above the tabs. this label might not be long enough. TOAD will display the list of Primary Key columns on the Tables/Columns tab to the right of the Show Comments dropdown list. and precision (if applicable).198 Visual tab Show toolbars above object lists on left hand side Default – Checked If checked. If unchecked. and precision will display in separate columns in the grid. . Show object create/alter dates on the right hand side Default – Checked If checked. toolbars will display above object lists on the objects panel. columns will show in the columns tab in the format "VARCHAR2(20)" including max length. TOAD will show the table stats information.

Sys Privs. will only display the top level grants on the Users. package procedures will be sorted alphabetically. Enable DROP ALL buttons Default .Indexes tab. and Resource Group tabs.Unchecked If checked the Schema Browser Drop All buttons will be enabled for the current session. Sort package procedures alphabetically Default .Unchecked If checked. Triggers. Drop All buttons in the Schema Browser are in the details panel of the Schema Browser > Tables .Chapter 8 Schema Browser 199 Show table names following Trigger names Default – Unchecked If checked. Roles. Roles.Constraints. Only show top level grants for Users. and Indexes tabs and the Schema Browser > Snapshots .Unchecked If checked. Sys Privs. Auto-size list view columns Default – Unchecked If checked. TOAD will automatically size the width of the list view columns in the details panel to the width of the text. corresponding tablenames will display after trigger names on the triggers object list. . and Resource Groups tabs Default .

If unchecked.200 Browser Style radio buttons Radio buttons let you choose Tabbed Object Type Selection (Schema Browser object types will display in a tabbed interface). . Dropdown Object Type Selection (the object types will display in an alphabetized dropdown list). the tabs will display with a horizontal scroll bar. or Tree View (a tree view style display). If you choose Tabbed Object Type Selection you can also choose to Use Multi-line tabs on the left side. once a line of object tabs is full. once a line of object tabs is full the schema browser tabs will display on multiple lines. If checked.

The scripts are always copied to the clipboard by default. NO DROPS CAN BE REVERSED. The drop all button is on the Tables page .Constraints. The drop all buttons are disabled by default. and Indexes panels. Copying From the Browser Any of the Object Names shown in the Object Lists on the left of the Browser can be copied to the clipboard by pressing <CTRL>C for the highlighted object name. The Create Script button on the objects panel is used to generate a script. and on the Snapshots page . the button is enabled whenever an object is selected in the list. Triggers.for most of the objects displayed on the Schema Browser. Any column of data shown in the detail grids on the right of the Browser can be copied to the clipboard by pressing <CTRL>C for the highlighted grid cell. but after you respond Yes to the confirmation. When an object has a drop button. Dropping Objects Many objects can be dropped directly from the Schema Browser. They will only be enabled if you check the Enable drop all option in the Schema Browser options.Oracle Statements to recreate the object -. . TOAD will confirm any DROP operation on the Schema Browser.Chapter 8 Schema Browser 201 Objects Object Scripts TOAD can create DDL Scripts -.Indexes panel.

This means you can define a filter for the schema DEMO and a different filter for PRODUCTION. They can be filtered to show a subset of all the like objects in the schema. Table Filters allow filtering on table names as well as column names. . also affects the table lists throughout TOAD. Synonyms can be filtered by Synonym scope: owned by schema only. Not only is the display refreshed faster. The browser filter. The grids that display Table Detail Information support multi-row selection and always copy the first column to the clipboard. owned by schema plus Public synonyms. and the appropriate filters will be loaded when you view that schema in the Schema Browser. Constraints can be searched by constraint name or constraint column name. Schema Browser filters are specific to a schema/owner name. you can find all tables that have columns with FND_NO anywhere in the column name. For example. you might have hundreds of tables in a schema but only want to see those where the table name begins with "GEO”. although primarily intended to filter the Schema Browser window. the query fetches fewer rows for faster response from the database. The table name may also be searched. For example. Filters All Object tabs in the Schema Browser have a filter. exclude SYS and SYSTEM synonyms. every table list will display a filtered list until the filter is changed. they also modify the query used to fetch the data. you can <CTRL> Click to select more than one column and then press <CTRL>C. Then you can paste the list into a SQL Editor or another application. if your filter is set to display only tables that begin with GEO.202 Note that the listview displays for Table Information work differently. The filters not only reduce the amount of data displayed. with commas in-between (a comma-delimited list). For example. if you are viewing a grid display of a list of columns for a table. etc. For example. This will copy your selected columns to the clipboard.

.Chapter 8 Schema Browser 203 If no filters are defined default filters include: § § Constraints show primary keys only Synonyms exclude those for objects owned by SYS & SYSTEM The filters for all Schema Browser objects can be viewed in a single window under the View > Browser Filters menu. Constraints. You should not change the select list. To apply the filters. You can change the Where or Order by clauses. . to bring up the Schema Browser Filters dialog where you can select the filter options. If you click View/Edit Query Before Executing. you must click the Filter toolbar button on the desired object tab. click the OK button.g. TOAD will show you the query which is about to populate the browser. and the browser filters are applied. e.

To create a custom query 1 2 3 In the objects panel (left hand side) of the Schema Browser. and select/add variables while you create your query. A new blank query will display. The query is created and loaded into the SQL Editor. Right-click and select Custom Queries from the right-click menu. The query is built with your selected objects and placed into the SQL Editor for editing or running. You can now use your new query the same way you would use one of the standard provided queries. Select from a list of default queries. . The window lets you rename a query.204 Custom Queries The Schema Browser lets you create custom queries. select/deselect Oracle versions. Click the Post Edits button to create the query and add it to the selection list. To create a new query template 1 2 3 From the Edit Custom Queries window click the Add Query button. Enter your new query name and the query. select the objects that you want to use for the query. Edit Custom Queries window The right-click menu also lets you edit custom queries via the Custom Queries > Edit Custom Queries menu item.

This lets you see and choose values. Specify variables by clicking the Variable button and entering variable information. Click OK to run your new query and filter the lookup grid. To lookup foreign keys 1 2 3 4 5 6 In the Schema Browser. click the Tables tab. . Click in a column that has foreign keys. (If the box is checked and you type EMP it will filter out rows that do not begin with EMP). Check syntax accuracy via the Check button. (You can exclude disabled constraints via the Options > Schema Browser > Data window). The filter by box lets you filter by typing. When you select a row and click OK. the data will be entered in the appropriate columns in the data grid. Click the drill down button and it will bring up the rows in the referential table. To filter rows by editing the query 1 2 3 4 Click Edit Query. Edit the query within the editing window. Click again to activate Editing mode. Select the table that you want to edit and in the details panel click the Data tab. The Foreign Key Lookup window includes all foreign key constraints. A drill down button displays.Chapter 8 Schema Browser 205 Foreign Key Lookup The Schema Browser data grids has a List of Value (LOV) feature which adds a drill down button next to cells that have foreign keys on them.

The Incrementally drop table menu item invokes the Deallocate Table Extents window. If the table is not large enough to drop incrementally. The Tables page right-click menu includes an Incrementally Drop Table menu item which is only accessed via this menu. and a job to drop the empty table on the last day. jobs to deallocate the unused extents in increments over a number of days. You can only incrementally drop tables with greater than 200 MB and greater than 1000 extents. . The steps include a job to truncate the table.206 Tables This chapter discusses the Tables tab in detail and then summarizes some of the other tabs. Most of the tabs and functions in the Schema Browser operate in a similar way. Incrementally drop table This lets you drop a large table in steps over a selected number of days so that server performance is not hindered. a warning dialog displays.

The Long date format checkbox is checked by default. or to delete the procedure. . a warning dialog will display. Click Yes. right-click on the table you want to drop. Click Execute. The process is scheduled. uncheck the box. You can delete the incremental drop by deleting all related jobs in the list. 5 6 Use the At this time spinner to set the time of day that you want to start the deallocation process. Use the Over this many days spinner to set the number of days you want the deallocation process to take. If you prefer the short date format. The last several jobs on the jobs list will be deallocating and dropping the selected table. A confirmation dialog displays. check the Jobs tab.) The Deallocate Table Extents window displays. 7 To confirm that the procedure has been scheduled. Select the Begin the deallocation/drop process on date from the calendar dropdown.Chapter 8 Schema Browser 207 To incrementally drop a table 1 2 3 4 In the Schema Browser > Tables page. The spinner lets you select from 5 to 14 days. (If the table is not large enough to drop incrementally. Select the Incrementally Drop Table menu item.

. This window lets you create a new Oracle table. then click the Execute button to create the Table. Click the Execute button to generate the table script. You can also access this window from the Create > Table menu item. An Inclusions pane lets you include Table Comments. Public Synonyms. see the Database > Export > Table Scripts menu item. For creating multiple table scripts. a script is created for your table that you can then paste into the SQL Editor or elsewhere. Grants. or Screen. The Options tab contains many options including Include Schema name. and Script Comments. and One big 'Alter Table' Command. and more. Create Table The Create Table button invokes the Create Table window.208 Objects Panel Create Script The Create Script button displays a Table Script Creation window with the Options tab selected by default. Include Drop Statement. The options selected in the Table Script Creation dialog are saved and restored the next time you create a table script. When you select the Execute button. Use the dialog to enter the table information. File(s). A Constraints panel lets you include the different types of constraints and has the following radio buttons: List constraints following table columns. This is easier than remembering the Oracle syntax for this command. Private Synonyms. The Output tab lets you output the table script to Clipboard. Individual 'Alter Table' Commands. Sort for Creation. or click the Cancel button to close the Table Script Creation dialog. NOTE: Most but not all Oracle clauses are not supported for object DDL scripts.

The Table window will automatically display the Schema and the Name for the table you selected. the Export Data button was clicked. It is the same window as the Create > Table window. and this was the resulting Data Export window. but you are using it to make modifications. Here. and add columns.Chapter 8 Schema Browser 209 Alter Table The Alter Table button invokes the Tables window which lets you drop. and set unused columns. select a table from the objects list and click the Alter Table button. . change storage parameters and data type sizes. modify. Export Data The Export Data function creates “INSERT INTO” SQL statements for the data in the selected table. the User Profile object was selected. To alter a table. add not null constraints. The Export Data button displays the Data Export window for whatever table is selected from the left panel of the Tables page.

INSERT INTO Foo ( ID ) VALUES (5). 2). your primary key columns will be unchecked. Exclude Primary Key Columns If checked.g. NULL_COL_TEST2 ) VALUES (6. INSERT INTO Foo ( ID ) VALUES (9). INSERT INTO Foo ( ID. INSERT INTO Foo ( ID ) VALUES (8). INSERT INTO Foo ( ID ) VALUES (9). TOAD checks all the columns by default. E. TOAD will exclude null columns from the columns clause and the values clause of the “INSERT INTO” SQL statement.. this box gets unchecked. . Columns Tab You can check/uncheck columns you wish to include/exclude. FLOAT. 1). If you then check a primary key column. DATE. You can then selectively check/uncheck the columns you want to include/exclude. If you do not have any primary key columns.210 The Data Export window supports NUMBER. Exclude Null Columns If checked. and VARCHAR2 object types. this choice will not be enabled. NULL_COL_TEST ) VALUES (7. Select All /Unselect All The Select All and Unselect All buttons let you quickly Select or Unselect all the columns. CHAR. INSERT INTO Foo ( ID.

Filename The filename area has a drill down button where you can drill down to the desired file. the Schema or Owner Name will be included in insert statements..g.Foo ( ID ) VALUES (5). E. clause The Where clause is optional.. Example: WHERE INVENTORY_NUMBER = 943 Destination Default – To File The Destination radio buttons let you choose between To Clipboard or To File.. Insert COMMIT statements every __ rows spinner This spinner lets you designate how many insert statements to generate before generating a commit statement. . you must include the word “Where” in your statement. If you include a Where clause. INSERT INTO Schema.Chapter 8 Schema Browser 211 Options Tab Where. You do not have to include a Where clause. You must supply a file name. Include Schema/Owner Name in Insert Statements When this radio button is selected.

If you only want to see the rows of users who have grants you can check the Show only users who have grants assigned checkbox.212 Show Table in ER Diagram This shows the selected table in an ER Diagram. . You can view all users and their privileges. You can rearrange columns by clicking and dragging on the column headers. Table Privileges The Table Privileges button activates the Privileges window. This is useful when applying changes to multiple users. but you will still be able to view everyone’s privileges for that object and you will also be able to rearrange columns. and revoke privileges for the selected table. right-click in the column. If you do not have sufficient privileges to alter an object. grant.. you cannot grant privileges that you don’t have the grant option for. You can multi-select the users. The Show SQL button lets you preview the SQL before applying changes. If you are not the object owner. The Revoke All button will revoke all privileges from everyone but you. This window lets you view. you will get a warning message. Grants will be highlighted in blue and admin grants will be highlighted in yellow. and grant or revoke from the right-click menu. You can multi-select users using the <CTRL> key.

So. . You can either estimate statistics (faster than compute). To analyze all tables in the current schema or other selected schema. the optimizer can run better queries. compute statistics. You can create: § § § § Primary Key constraints Check constraints Unique constraints Foreign Key constraints Analyze Table Click the Analyze Table button to display the Analyze Tables window. Use this dialog to analyze the selected table from the tables object list.Chapter 8 Schema Browser 213 Create Constraint The Create Constraint button activates the Create Constraint window. This collects statistics so that COST based query optimization can be used. and a confirmation window will appear asking if you want to create a public synonym for the table. Add Public Synonym for Table Click the Add Public Synonym for this Table button. go to the Tools > Analyze All Tables menu item. You can also get to this dialog via the Create > Constraint menu item. Use this dialog to create additional table constraints. Click Yes to create the synonym or No to Cancel. or delete current statistics. This displays a schema dropdown so that you can select which schema tables to analyze all at once.

To view all the objects again. To set up a default filter. For example. If you select multiple filters. and Constraints. Do NOT attempt to edit this file! You can also use this dialog to set up the default filter which is in force for every new schema.. and select OK.FLT in the TOAD\TEMPS folder where SCHEMA is the schema name.g. Browser filters are helpful for schemas that contain a lot of objects— the fewer objects that TOAD needs to load. simply select the filter button. then they are joined together with an AND statement in the SQL as opposed to an OR statement in SQL.214 Table Filter The Table Filter button displays the Browser Filters window for the Tables. and click the Show Default Filter button. Views. Triggers. These filters will be set up by default each time the Schema Browser window is opened. table name and tablespace name. Not Like sets up the tablename query like this: [not like KEYWORD%]. The filter is stored in a file named SCHEMA. clear the filters by selecting Clear where you have filters. After you set your filters. All the Browser Filter windows have a similar interface. e. Set up your default filters and press OK to close the window. The Browser Filters button can be found on the tabs for Tables. select OK and the browser displays the resulting objects. Synonyms. you can narrow the focus to only tables whose names begin with EMP and temporarily ignore all other objects in the schema. Rebuild Table This button invokes the Rebuild Table window. Procedures. . the faster it will execute. go to View > Browser Filters.

A confirmation window will ask you if you are sure you want to drop the table. Drop Table The Drop Table button lets you drop the selected table directly from the Schema Browser. Truncate Table This lets you truncate a table (delete all the data but maintain the table structure) and either reuse the storage or drop it. Once you select Yes the table is dropped and cannot be retrieved. The following dialog will display when you select the button. Once you click the Execute button you can’t rollback or undo your choice. .Chapter 8 Schema Browser 215 Compile Dependencies If your table is called by a Procedure or View this button will compile those dependencies.

You can change the length. and column comments.5)” through the TOAD Option > Schema Browser > Show Column Length Info with Column Data Type setting. Primary Key columns are indicated by PK column numbers in the PK column. scale display to “NUMBER(10. The other choices in the dropdown are Column Comments and Table Comments which show the comments in an overlay panel at the bottom of the details panel. You can type directly into this panel to edit the various comments. You can multi-select columns. Default value. precision. Table . if any. scale). To save the comment edits. just select a different column or table. press <CTRL>C to create a comma-delimited list of columns to the windows clipboard and paste the selection into an editor. A label to the right of the Add and Drop column buttons in the details panel displays the Primary Key column name(s).216 Details Panel The Tables details panel has tabs for displaying different details about the selected table. .Columns The Columns tab lists all the columns for the selected table. column attributes (such as length. precision. It also displays each column Data Type whether or not the column accepts Null values. The dropdown default is Show no comments.

This dialog lets you add a column to the selected table. Click the Execute button to add the column. The Drop Column button and the Drop Column from Table right-click menu item are enabled only if you have Oracle 8. select the SQL tab. and other appropriate information. Character Default Values have to be wrapped within single quotes in order to make a valid "ALTER TABLE..5 or later. a filter is active for the data grid.1. the Type. You must enter the Column Name.. To Add a Column 1 2 Enter the column name. The panel also contains a Clear Filter button. and you can click the Clear Filter button to clear the filter. The Nullable radio button is selected by default. Additional columns are always appended to the end of the table definition.Chapter 8 Schema Browser 217 Table . data type. If it is red. .Columns Details Panel Buttons Click the Add Column button to display the Column Definition window. and the Size. If you want to see the resulting SQL script of your command." statement.

. analyze. It lists the Constraint Name. and compile. whether or not the index is Unique. For foreign key referential integrity constraints. and the When Clause. the corresponding Column. the Column(s). the panel at the bottom lists the owner. It includes the Type.Triggers The Triggers tab lists any triggers for the selected table. and drop indexes. modify.218 Table . The list includes the Index Name. and column names that the foreign key constraint is pointing to. table. The Indexes details panel buttons include a Create script for selected index button and buttons that let you create. the Trigger Event.Indexes The Indexes tab lists the indexes for the selected table. The Table – Triggers details panel buttons let you enable/disable triggers. open a Procedure Editor window for the selected trigger. rebuild. The Table-Constraints details panel buttons let you enable/disable constraints and drop constraints. and the Position. The editor at the bottom of the details panel lists the source code for the selected trigger. Status. and the Position. It also lists the Parameters and Values for each index. drop triggers. the Constraint Type. whether or not it’s Enabled. Table .Constraints The Constraints tab lists any constraints for the selected table. the Trigger Owner. Table .

If you want to clear the entire filter for this table. click the Clear Sort button. The data in this grid is directly editable.Data Details Panel Buttons The Filter Data toolbar button opens the Table Sort dialog where you can select the columns to sort and/or filter. click the Clear Filter button on the Table Sort dialog. Table . Double-click any data item to bring up a memo editor for that item. Table Sort window Sort Tab To Sort. Single record view button Click on the book in the top left corner of the table to show single record views of the selected row. and implement it via the OK button. select the column(s) you want to sort and click on the pointing hand.Data The Data tab displays the selected table with data in grid format. The View/Edit query button opens the View/Edit Schema Browser query window which lets you edit the query. This is similar to the SQL Results Grid on the SQL Edit window.Chapter 8 Schema Browser 219 Table . Grid configurations on this data tab are saved and restored from the TOAD\TEMPS folder structure. You can move items up and down the list. because the query to populate the grid includes the ROWID column. You can easily rearrange columns by clicking and dragging on the column titles. Filter Tab . You can sort in ascending or descending order. If you want to clear the sort column(s) for this table. check it to see if it parses ok.

The sort and filter criteria are saved in temporary files in the TOAD\TEMPS folder hierarchy. The First Record button takes you to the top of the grid (the first record in the recordset). When finished. The filter tab provides dropdowns with additional filter choices. click OK and the data in the grid will be sorted and/or filtered as specified.220 You enter the filter criteria in the lower text panel. and so on. If a table filter is in effect. the funnel icon on the Data tab will be red. Data Details Panel buttons Continued The forward and backward buttons let you quickly move around from row to row in the recordset. You can further edit the resulting SQL right in the memo editor widget. The Next Record button takes you to the next record in the recordset. On the filter tab. select the Column. . See the Data Grids chapter for information on the Data Grids right-click menu. Operator. The Clear Filters toolbar button clears the filter criteria and the sort criteria. and Value to filter upon.

The Copy Script to SQL Edit window opens a SQL Edit window and pastes a copy of the script into the window. This indicates that a change has taken place but is not yet reflected in the SQL script. updating any changes. the GO button turns red. The GO (Refresh the Table Script) button refreshes the script. The tab includes options. . The scripts tab buttons include Copy Text to Clipboard and Select All Text. Once you click GO the script refreshes implementing the options you’ve changed and GO returns to its original gray color.Chapter 8 Schema Browser 221 Table .Scripts The scripts tab displays the SQL script for the table you’ve selected. When you change an option by either checking or unchecking it.

Click Apply. Partition Name. The privileges window for the selected table displays. The display includes Subpartition Name. The Grants details buttons include Revoke All. Click the Privileges button. To Add or Replace Privileges 1 2 3 4 5 6 Select the table from the object list. Click in the cell of the privilege you wish to change.Partitions This lets you see partitioned columns and partitions for the selected table. Table . The Truncate Partition button lets you truncate a selected partition. Select an item from the dropdown. . Tablespace. and Blocks.Grants The Grants tab lets you view existing table grants and assign or replace existing privileges. and Privileges which opens the Privileges window.Subpartitions This lists the subpartitioned columns. Table .222 Table . A confirmation dialog will appear. have your DBA Grant select on dba_roles to schema. Revoke Privilege. The Drop Partition button lets you drop partitions. Confirm by clicking OK. If you cannot see any roles. A dropdown displays. Rows.

such as TABLESPACE NAME and NUM ROWS. are captured.MANAGER_ID referencing EMPLOYEE. are displayed in the upper window of the details panel. You can select an item in the list. This display is based on the existing foreign key constraints from table to table. emp_id is referenced by manager_id. so you cannot drill down in the hierarchy endlessly (for example.EMPLOYEE_ID. “+” on the keyboard expands one branch of the hierarchy. Remember. which references manager_id. and <CTRL><SPACE> expands the whole tree. The panel window columns are click and drag resizable. are displayed in the lower window of the details panel. such as SIZE IN BYTES and INITIAL EXTENTS.Chapter 8 Schema Browser 223 Table .Stats/Size The Stats/Size tab displays numerous statistics and size information about the selected table.Referential The Referential tab displays a hierarchy of tables and how the selected table is referenced by other tables and references other tables. Table . On each node of the hierarchy. The Stats. . there is a chain symbol for standard referential and a scissors symbol if the reference is Cascade on Delete. "*" will fully expand the current node. and the Size/Extents information. which references emp_id. such as EMPLOYEE. press <F4> and get a popup window describing the object in detail. The two display options Show Stats and Show Size/Extents are checked by default. and a horizontal splitter is between them. and so on). Circular references. Pressing the asterisk key.

224 Table -Used by The Used By tab shows the objects that reference the selected table such as views.Sales view. triggers. The Used By tab in the details panel shows that the CUSTOMER table is used by the Demo. the CUSTOMER table is selected in the objects panel. functions. procedures. and packages. Here. .

The symbol indicates a public synonym. Grants. views. edit. the objects panel includes buttons that let you create the view script syntax. the Show Public synonyms except those for objects owned by SYS/SYSTEM is selected by default. the panel includes a Filters button which lets you filter out different types of synonyms. create a public synonym for the selected view. The details panel includes tabs for Columns. The details panel also displays tabs and details associated with the object. You can see details about synonyms pointing to tables. sequences. So. users like to filter them out for easier navigation. procedures. and drop buttons. and copy the outline of a selected object. packages. Deps (Used by). You can also get a popup describe window by selecting an object in the Deps list and pressing <F4>. The Dependencies tabs display the dependencies. The Deps right-click menu lets you compile. Deps (uses). Because the SYS/SYSTEM schemas contain a lot of synonyms. Unknown Objects are listed as UNKNOWN. functions. and compile dependencies. and Triggers. open the SQL script of the selected view in a SQL Editor. compile. In addition to the basic create and drop buttons. Synonyms You can create synonyms for the following objects: tables. filter. describe. display the privileges window for the selected view. If there is a hierarchy of dependencies. . the details panel will contain the same tabs the Object View tab displays in the details panel and the same associated details. For example. if the object is a view. the dependencies tree will display. views and synonyms.Chapter 8 Schema Browser 225 Views In addition to the basic create. Data. and stored procedures. save. The details panel displays details of the object the selected synonym is pointing to. Synonyms basically point to the original object. Script.

click the Compile Dependencies button. Arguments. It opens a Procedure Edit window for the procedure that you’ve selected in the objects panel. and Packages. and Grants. it compiles only INVALID objects. select procedure B. In addition to the basic save and drop buttons. function. The Compile button compiles the selected procedure. The Public Synonym button lets you create a public synonym for the selected procedure. On databases prior to 8. if procedure A calls your procedure B.1. or Load Body Only. a pink X is for a Package that contains one or more invalid (red X) functions or procedures. Use this Privileges button to view or modify the privileges of the selected procedure to other user schema accounts or roles. A package body cannot function without a spec. Deps (Used by). and click OK to execute the procedure. The Compile All button compiles all procedures. The Procs Filter button displays a Browser Filter dialog for procedures.226 Procedures In the left panel list of PL/SQL Procedures. packages. Load Spec Only. A dialog asks if you want to compile the dependencies on the selected procedure. Deps (Uses).7. or Compile Body Only. The Compile Dependencies button will compile dependencies for the selected procedure. The Execute Procedure button brings up the Set Parameters window where you can enter your arguments. A circle with a slash through it in the left panel list indicates a package body that has no package spec. or package. Refer to the icon legend (click the icon legend button) for more icon information. the panel includes the following. Errors. The details panel includes tabs for Code. The Proc Edit button is enabled after you select a procedure. For example. function. Functions. Select Yes or No. and TOAD will recompile procedure A. A dropdown lets you select to Load. A dropdown lets you Compile. and triggers for the current schema. or package. Compile Spec Only. . functions.

. and drop buttons. compile. The Columns tab displays the column. If there is a hierarchy of dependencies. describe. The details panel displays information about the selected trigger. The Errors tab displays the last errors that occurred when you tried to compile the selected procedure. the dependencies tree will display. The trigger text is selectable via <CTRL>A and can be copied to the clipboard via <CTRL>C. You can select an item in the Deps list. and usage. its location is highlighted in the script displayed in the lower part of the details panel. filter. table. load in the Procedure Editor. Triggers The Objects panel includes save. The Source tab displays the SQL script for the selected trigger. It also includes a Proc Edit (Trigger to Proc Editor) button that places the selected trigger in a Procedure Editor ready for editing.Chapter 8 Schema Browser 227 The Dependencies tabs (Uses and Used By) displays the dependencies in the upper part of the panel. If you click on an error. and copy the outline of a selected object. The Deps right-click menu lets you compile. table owner. press <F4> and get a popup window describing the object in detail.

and Script. the panel includes the following. In addition to the basic create. Yellow Square + Red Triangle + Blue Circle icons indicate UNIQUE indexes (vs. Refer to TOAD Help for more information about the Rebuild Index window. The Analyze Index button lets you collect statistics on the selected index so that COST based query optimization can be used. the optimizer can run better queries.228 Indexes In the list of indexes. Indexes need to be periodically rebuilt in order to improve query performance. Partitions. "101" icons are BITMAP indexes. The details panel tabs include Column. and “f ( )” indicates function-based indexes. . The Rebuild Index button lets you rebuild a table index. modify. non unique). The Create Script button copies the Create Index script of the selected index to the clipboard. The Filters Indexes List button invokes the Browser Filters window that lets you filter Index Names and Table Names. and drop buttons. So.

The details panel has a Code tab. The details panel provides information about the selected constraint including its type. It lets you view the list of Java objects. A red X displays next to disabled constraints in the objects list.Chapter 8 Schema Browser 229 Constraints The Constraints tab displays the constraints in the objects panel. if any of the constraints you have selected to disable have dependencies. The right-click menu includes a Publish Java to PL/SQL menu item. alter. The Constraints Filter button invokes a Browser Filter dialog window for constraints. the objects panel includes a button that opens the privileges window for the selected sequence and a button that creates a public synonym for the selected sequence. The buttons on the Grants tab in the details panel let you revoke privileges for the selected sequence or all sequences. When you disable constraints. In addition to the basic create. You can enable/disable constraints. table and owner. and drop buttons. . status. an Oracle error message will display stating that you cannot disable constraints that have dependencies. Sequences Sequences are basically counters that Oracle maintains. JAVA TOAD includes a JAVA tab for Oracle 8i and up databases.

host. You can also create and copy the SQL script to the clipboard. and more. which revokes the selected Role or Privilege (Revoke) or revokes all the Roles or Privileges (Revoke all). and drop users. You can copy (and then rename) users. user name. the panel includes a Copy script to clipboard button that copies a Create Public DB link script to the clipboard and a Create new database link button that invokes the Create Database Link window. In addition to the basic drop button. Links can be public (used by all schemas) or private (used only by the schema that created it). modify. Public links in the list have the symbol next to them. You can lock and unlock accounts.230 DB Links DB Links lists all possible links from the database you are using. and Privileges. DB Links are used in queries at the end of each table or view name. The details panel lists the owner. . The Roles and Privileges tabs contain Revoke and Revoke all buttons. You can view details for roles and privileges. Locked accounts display in the objects list with a lock icon to the left of the name. The details panel contains tabs for Info. The objects list right-click menu includes an Expire Account feature. Users You can create. and the date and time the link was created for the selected DB link from the object list. Roles. Resource Groups.

The details panel shows various parameters for the selected job. alter. The objects panel lists user-defined datatypes in a hierarchical display. Queue Tables This page lets you create. This feature is only available for Oracle 8 and higher databases. using Oracle’s built-in DBMS_AQADM package. NEXT DATE. and edit user-defined datatypes. This feature is only available for Oracle 8 and higher databases. execute. depending on the item you select. and drop jobs. alter. browse.Chapter 8 Schema Browser 231 Jobs You can create. and INTERVALS. and drop queues and enable or disable enqueuing or dequeuing on those queues. . and drop queue tables using Oracle’s built-in DBMS_AQADM package. such as LOG USER. Source for the selected job displays in the lower pane of the details panel. Alter queue table is not supported in Oracle 8. The Edit User Type button invokes either the Edit Object Type window or Edit Collection Type window.0. You can also place jobs online or offline and view job details. Types This page lets you create. This feature is only available for Oracle 8 and higher databases. Queues This page lets you create. alter. You can set options via the View > Options > Types Tab page.

The objects can be grouped into one or many folders. and right-click menu (which includes menu items that perform actions on the objects) for the object type. tabs. toolbars. The Details Panel displays the appropriate details. . It displays the clusters' columns and the tables and indexes involved.232 Clusters This tab lets you quickly see all of the clusters in the database. A script tab gives you the script to recreate the cluster and optionally the tables and index. Many of the Schema Browser tabs include a right-click Add to Favorites list menu item. The folders are specific to an instance. The Create/Alter Clusters screen can be launched from the Clusters tab. Favorites The Favorites tab is a configurable tab that lets you add different objects from other Schema Browser tabs into one tab.

press <CTRL> while clicking the columns you wish to select.Chapter 8 Schema Browser 233 Schema Browser Tasks This section will take you step-by-step through various tasks that you might want to perform with the Schema Browser. select the starting point. From Tables > Columns 1 Click the Column you want to copy. CITY. To copy table or view column names to the clipboard You can copy the column names from the list on the Tables/Columns tab or the Views/Columns tab via multi-select list and copy <CTRL>C. In this example. the following selection is copied to the clipboard: CUSTOMER_ID. To select more than one column. 2 Press <CTRL>C or select Edit > Copy from the menu. To select a continuous block of columns. The selection is copied to the clipboard. . ZIP_CODE. press <SHIFT>. and click on the ending part of the blocked selection.

enter the WHERE clause in the where textbox on the Options tab. TOAD adds the entire string onto the end of the SQL and executes it. you can export table data to either a file or the clipboard. . If you want to filter out only certain records. If you want to sort the data further. add an “ORDER BY” clause after the “WHERE” clause.234 To export table data in a certain order In the Data Export window. which is accessible from the Schema Browser window > Tables page > Export Data button.

e. tables. etc.g.Chapter 8 Schema Browser 235 To filter out schemas that do not contain objects from the schema dropdown list If you have a database where only a few schemas contain objects. go to View > Options > Schema Browser and check Only show users that own objects in dropdown lists.. . views. and all other schemas are used as end-user logins.

.

This section will highlight some selected options and features found in other TOAD windows. and Schema Browser. Procedure Editor. .9 Other TOAD Options and Features The major windows covered in the previous chapters of this manual include: SQL Editor.

The default is 10 point Courier.238 Quest ScriptRunner Quest ScriptRunner is a low maintenance script execution utility included in your TOAD directory that lets you execute DDL and DML scripts. code templates. and all the other editor features found in the TOAD Editor Options window. . Output Font button This option lets you set the output font (bottom panel). You can run it from the executable or from the command line. It lets you toggle between a full screen and split screen editor. Edit > Options Menu Application Options Editor Font button This option lets you set the editor font (top panel). The default is 10 point Courier. If Quest ScriptRunner is not in your TOAD directory. The Edit menu contains the basic text editing commands including Find and Replace. Because of its small size. hot keys. Output background color dropdown You can change the background color of the output. it will not include syntax highlighting. several instances of Quest ScriptRunner can be running at one time. The File menu contains the basic file commands. It includes automatic formatting.

Save previous connection information checkbox Default . This option gives you access to: autoreplace. and the ability to schedule scripts to run. hotkeys. if Quest ScriptRunner is located in the TOAD directory. templates. Start in Full Screen edit mode until script is executed Default .Unchecked If checked. When a script is executed. connection information will be saved when you close Quest ScriptRunner and the next time you open Quest ScriptRunner you will automatically be logged on with that information. Quest ScriptRunner will close if you have not entered connection information on the command line.Checked When this option is checked. or if the TOAD editor option files have been copied to the directory where Quest ScriptRunner resides. looks in its local directory for the files. Quest ScriptRunner first looks for TOAD editor options in a Temps directory below the application.Chapter 9 Other TOAD Options and Features 239 Load TOAD editor options if installed into the TOAD path (ignore fonts above) checkbox Default . when you run Quest ScriptRunner from the command line.Unchecked If checked. the screen splits to display the results grid in the lower pane. Exit if no connection provided on command line or entered at startup checkbox Default . or there is no automatic logon connection information saved. Quest ScriptRunner will load and use them. syntax highlighting. .Unchecked If checked. So your TOAD options will override the fonts selections that are on this options page. and if not found. will open Quest ScriptRunner in full screen mode until you execute a script.

The results panel right-click menu also includes commands that let you use any results your script returns. Menu Shortcuts (click and type the desired shortcuts). and Toolbars (also includes toolbar buttons options). will exit after it executes from either TOAD or the command line.Unchecked If checked. Execute Script step-by-step. Step through Script from Cursor.240 Show Login window at startup Default . and Connect (opens a new connection to an Oracle database). Run from Cursor. . Right-Click Menus The editor panel and results panel right-click menus contain some of the common main menu items.Unchecked If checked. Run Menu The Run menu includes the following commands for running the script: Execute entire/highlighted Script. the login window will be invoked when you start Quest ScriptRunner. Run to Cursor. Script (default script options). Always exit after execution from TOAD or command line Default . Run Current Statement (runs only statement where cursor is positioned). The other option pages include Printing.

It will load the file into the editor panel. To Launch Quest ScriptRunner and specify a connection from the command line use one of the following formats QSR <username>/<password>@<databasename> QSR demo/demo@mydatabase To Launch Quest ScriptRunner and connect using a blank/default database name from the command line QSR demo/demo To get Quest ScriptRunner to attempt to connect using an OPS$ login QSR/ To Specify a file to load when Quest ScriptRunner is launched from command line Use the following format. Press <Enter> Quest ScriptRunner will launch and prompt for a connection.Chapter 9 Other TOAD Options and Features 241 Launching Quest ScriptRunner from Command Line To Launch Quest ScriptRunner from the command line 1 2 3 Type QSR at the command prompt.sql . and Quest ScriptRunner will connect using the specified connection. QSR demo/demo@mydatabase c:\temp\mysql.

sql" Commands Supported Quest ScriptRunner supports many of the SQL*Plus commands such as REM/REMARK.242 If the filename or path contains spaces. SET ECHO. SETHEADING/HEA. SET ESCAPE/ESC. Refer to TOAD Help for more details. PROMPT/PRO. the entire path must be enclosed in double quotes: QSR demo/demo@mydatabase "c:\temp\my sqlfiles\mysql. and SET LINESIZE/LINES. .

and create the desired type of statement. The SQL Modeler uses floating list boxes for tables which include checkboxes for selecting column(s) and allow for scrollbars and resizing. Views. The modeler allows for keyboard interaction with the tables. . Open a new SQL Modeler Two ways to invoke the SQL Modeler § § Click the Database > SQL Modeler menu item. You can select Tables. or Delete statement. join columns. Update. Insert.Chapter 9 Other TOAD Options and Features 243 SQL Modeler The SQL Modeler lets you quickly create the framework of a Select. Click the Open a new SQL Modeler button on the main toolbar. or Synonyms. Press the Up Arrow and Down Arrow keys to move up and down. select columns. and press the Space Bar to check or uncheck a box.

To maximize the model viewing area. and a floating list box for the table displays in the Table Model Area.244 Table Selector Area This is where the tables are listed for the selected schema. Double-click (or drag-and-drop) an item from the Table Selector list. . press F2 or right-click in the model and select Full Screen Model from the right-click menu. Checkboxes let you select columns. A dropdown list lets you select a schema. Table Model Area The Table Model Area lets you graphically lay out a query.

less than (<). or Join Test. Tables > Calculated Fields Adds calculated fields based on other table columns Show > Join Text Displays the column names that comprise the joins Show > Adjust Model Origin Adjusts the upper left object to the upper left of the window Show > Primary Key Shows or hides the Table Primary Keys as "(PK)" next to each PK col . etc. Once the line is drawn. such as Inner Join vs. greater than (>). You can establish your own joins by dragging and dropping a column from one table to another table column. Views. you can double-click the line to adjust its properties. Copy Model Image to Clipboard Copies a bitmap image of the model to the Windows Clipboard Tables > Visibility Displays a Tables Visibility window with checkboxes next to a list of tables that are in the model. Check/uncheck the individual tables to show/hide them..g. The selected column information will appear in the Criteria grid below.Chapter 9 Other TOAD Options and Features 245 You can visually join or manipulate the Tables. Model Area right-click menu Right-clicking over the model area displays the following menu items. or Synonyms. equal (=). Outer Join. e.

if necessary SQL > Global Where Adds a WHERE clause to the query in addition to the column conditions from the Criteria tab SQL > Global Having Adds a HAVING clause to the query in addition to the columns conditions from the Criteria tab SQL > Query Variables Displays the Variables window where you can add and edit variables Auto Join All Automatically joins all tables based on existing DDL Foreign Key Constraints Full Screen Model Temporarily hides the Table Select list and Results tab .246 Show > Indexes Shows or hides Indexes as "(IDX)" Show > Show Field Type Shows or hides the data type of each table column SQL > Run Query in Thread Lets you cancel a query while it is running.

Object right-click menu Right-clicking over a Table object in the model displays the following menu items.Chapter 9 Other TOAD Options and Features 247 The right-click menu also includes Optimize All Table Sizes. and Arrange Tables Vertically. Arrange Tables Horizontally. Alias Field Names Sets logical column names Show Schema Name in SQL Shows or hides the schema name before each table in the generated query Set Table Alias Sets the Table alias Auto Join Automatically joins this table to others based on existing DDL Foreign Key Constraints Remove Table Permanently removes this table from the model Select All Selects all columns in the table . Cascade Tables. Auto Arrange Tables.

right-click over the empty model space and select the Tables > Visibility menu item . To unhide the table.248 Unselect All Unselects all columns in the table Invert Selection Selects columns that were unselected and vice versa Optimize Size Sets size to the (data) fields listed in the box Hide Temporarily hides this table from the model.

TXT. If the table name is eight characters or less in length. The Results Grid contains four tabs: Criteria. or Variance. Sum. Query Results. Field Name to enter a different logical column name. Condition to bring up the Input the WHERE Definition dialog where you can set a column equal to a constant value or another column value. If the selected table does not have an entry in ALIASES. Max. and the resulting query will display. Count. Or to enter another WHERE criteria. Criteria tab If individual columns are selected. or No sort for that column. Min.Chapter 9 Other TOAD Options and Features 249 Results Grid After you lay out your query. Double-clicking on the following Criteria columns has the following effects: Double-click on: Sort in a column to select Ascending. Aggregate Function to select an aggregate column function such as Average. Generated Query. which will be OR'd together with the above WHERE criteria. To remove the WHERE definition. and Explain Plan. Standard Deviation. . For example. and Explain Plan.TXT. Descending. go to the expert mode from the Input the WHERE Definition dialog. the aliases for ALL_OBJECTS and ALL_TABLES are both going to be ALL. You can edit the alias as desired to make it unique or change it to something more meaningful. To clear the form click the Clear Form button. bring up the dialog and click the Remove Condition button. they will be displayed in the Criteria grid. the first three characters of the table name are used to generate the alias. The alias comes from ALIASES. "Table" and "Schema" are not editable here. click the Generated Query tab. See page 63 for details about setting up table aliases. the entire table name is used as the table alias. which might not always be unique. You can edit many of the column properties in the Criteria grid. Other tabs in the window are Criteria. If you want to AND multiple column criteria together. Query Results.

250

Visible to toggle whether or not this column is returned in the query (Show or Not Show). Group to select this as a GROUP BY column. A number within parentheses indicates the order of the columns in the GROUP BY clause. Group Condition to bring up the "GROUP BY Definition" window to enter a GROUP BY condition. If you want to change the table alias, right-click over the table in the model and select the Set Alias menu item. To rearrange the order of the columns, click the column headers and drag and drop them left or right.

Criteria Tab right-click menu Right-clicking over the Criteria grid will display the following menu items.

Suppress Current Column Removes this column from the query, which also removes the plus “+” from the column in the model

Best Fit (All Columns) Sets the column width of the Criteria grid to show all text

Default Width (All Columns) Sets the column width of the Criteria grid to the default width

Copy Query Grid Image to Clipboard Copies the Criteria grid to the clipboard. A dialog gives you the options of rotating the image 90 degrees and/or a gray shaded image.

Chapter 9

Other TOAD Options and Features

251

Execute as SQL*Plus Report Opens the Query Report Format window which lets you format query results in a report style format

Generated Query tab This tab lists the automatically generated SQL statement. Any changes made to the model or column criteria will automatically regenerate this SQL statement.

252

You can copy the query to the clipboard by selecting it and pressing <CTRL>C or right-clicking and selecting Copy from the popup menu. You can also copy the query directly to the SQL Edit window by clicking the SQL button in the SQL Modeler toolbar or via the right-click option. You cannot directly edit the SQL on the Generated Query tab dialog. The query is syntax highlighted using the same editor settings from the SQL Edit or Stored Procedure Edit window.

Query Results tab This grid displays the results of executing the generated query. Insert, Update, and Delete queries can only be executed in the SQL Edit window.

Query Results right-click menu Right-clicking over the Query Results grid displays the following menu items.

Print Grid Invokes the Report Link Designer so you can print a hardcopy of the data

Save As Invokes the Save Grid Contents window which lets you save data to Clipboard or File.

Chapter 9

Other TOAD Options and Features

253

Export to Flat File Invokes the Flat File Export from Query window which lets you save the data as a Flat File.

Find Data Invokes the Grid Data Find window.

Record Count Displays the number of records in the grid.

The menu also lets you resize columns.

Explain Plan tab If you click the Explain Plan button for a generated SQL statement in the modeler, the Explain Plan output will display on the Explain Plan tab.

Explain Plan tab right-click menu Right-clicking over the Explain Plan window displays the following menu items.

Copy to Clipboard Copies the Explain Plan statement (in text mode) to the Clipboard

Optimizer Mode Lets you select the query optimizer mode for subsequent statements from Choose, Default, Rule, First Rows, or All Rows

254

SQL Modeler Options SQL Modeler options can be set via View > Options > SQL Modeler. A Modeler Table Text Font drilldown lets you change the font for the table. A selection list includes Inner Joins, Outer Joins, and Auto Joins. Click over a color box to select a color for the element. Right-click over the color box to select a background color for the selected item. A preview of the Table object with its new colors displays in the preview window below.

Automatic AutoJoin Default – Checked When checked, this feature will automatically check foreign key constraints and join tables that are dropped into a model with other tables. If the option is unchecked, then you can manually join tables with the table popup menu.

Use Schema Name in Generated SQL Default - Unchecked If checked, the schema name will be included in the tablename (i.e., myschema.mytable) in the generated SQL. Regardless of whether or not this option is checked, schema names are automatically included if the table belongs to a schema that is different than your login schema.

Automatically Select All Columns Default - Unchecked When checked, all columns are automatically selected when you add a table to the SQL Modeler. If unchecked, no columns are selected.

Show Views on Table Selector Default - Unchecked If checked, views will display on the table selector.

you will be prompted each time a Cartesian Join is going to execute. Allow Cartesian Joins Default . . if the spinner is set to 5. when you are in the Schema Browser . For example.Unchecked If checked. when you are in the Schema Browser .Chapter 9 Other TOAD Options and Features 255 Show Synonyms on Table Selector Default .Views page and open a view in the SQL Modeler via the Views page > Model View right-click item the Modeler will open in full screen mode.Unchecked If checked.Tables page and open a table in the SQL Modeler via either the Tables page > SQL Modeler toolbar button or the Tables page > Model Table right-click item. synonyms will display on the table selector. only 5 columns will display and a scrollbox will let you view the rest of the columns. Warn on Cartesian Joins This checkbox is only enabled if the Allow Cartesian Joins checkbox is checked. If checked.Unchecked/5 This lets you limit the number of visible columns on the table in the model area. If checked. the Modeler will open in full screen mode. the box is checked and you add a table with 10 columns. the modeler will allow Cartesian products. Limit visible columns to __ when adding tables to the model area checkbox/spinner Default .Unchecked If checked. Model Table/View in Schema Browser opens Model in full screen mode Default .

256 Restore All Defaults button Click this button to discard your customized options and restore the default settings for the options. .

. button will save the map as a . The object at the arrow end of the line is referenced by the object at the black dot end of the line.Chapter 9 Other TOAD Options and Features 257 Code Road Map You get to this window via the main menu button. The toolbar buttons include Create new code road map. F2 in the map toggles full screen. the Tools > Code Road Map menu item or from the Schema Browser . The Code Road Map displays a diagram illustrating with arrows which object references which object.crm file. The Save file as. F4 or double-clicking on an object performs a describe for objects that are supported by the describe feature in TOAD. and Toggle expand/collapsed package view. You can also Save the map as a bitmap.. and the respective object in the map is brought into focus. The left side contains the object browser treeview list. The Auto layout design buttons are designed to improve the map layout.Procedures page > Right-click menu. Open an existing . Note: The Create the scripts for the objects in the map button requires the DBA module. Set colors for DB Objects lets you change the colors for all objects of a type on the screen.. Information (lets you type comments which will be saved with the file). Click on an item in the list. Clear the map. Right-clicking on either the objects in the map or the objects in the object browser treeview list will display the associated Schema Browser right-click menu for that object. For larger maps you might find that the Save the diagram as a text file button creates a text file that is easier to read.crm (code road map) file.

The Create the scripts for the objects in the map button requires the DBA module. The toolbar includes a button that lets you Load the objects into the SQL Modeler. data type. Each object in the ER Diagram includes an "X" on the caption bar that lets you remove the object from the diagram. You can add additional tables to the diagram by double-clicking on a table name. Right-clicking in either the object browser list or the diagram will display the associated Schema Browser right-click menu for that object. The Save as. . and synonyms can be added to the diagram. foreign keys. F4 or double-clicking on an object performs a describe for objects that are supported by the TOAD describe feature.erd file. the Tools > ER Diagram menu item or from the Schema Browser . not nullable. After you add new objects. F2 will toggle full screen. unique keys.258 ER Diagram You access this window via the main menu button. and indexes. views.. The ER (entity relationship) Diagram works in a similar way to the Code Road Map.Tables page > Right-click menu. Objects on the arrow end of the line are referenced by objects on the black dot end of the line. press the Find dependencies button on the toolbar to find dependencies between the newly added objects and the existing objects. The left side contains the treeview object browser list. button saves the file as a . New tables. When you create a new diagram you can select what to display: primary keys.. The lower left hand pane lists tables. It shows dependencies and selected details.

.Chapter 9 Other TOAD Options and Features 259 Create/Alter Table Create Table You get to this dialog via the Create > Table menu item or from the Schema Browser window > Tables page > Create Table button. Global Temporary Table radio button Select this if you want a table whose data is only visible for the current session. This window lets you create a new Oracle table. Advanced Queuing radio button Select this if you want to create an advanced queuing table. This is easier than remembering the Oracle syntax for this command. then click the Execute button to create the Table. Clustered Table radio button Select this if you want a table that is part of a cluster. Use this dialog to enter the table information. Index-Organized Table radio button Select this if you want a table whose data rows are stored in the primary key index. Standard Table radio button Select Standard Table if you want a normal relational table.

Refer to TOAD Help for more information about Create Table/Alter Table. It is the same window as the Create Table window. To alter a table. change data type. The types checked are the only ones that will be included in the Table Data Types dropdown. select a table from the objects list and click the Alter Table button. create manually with a GUI. The Table Type radio buttons are disabled. or manual edit of an existing SQL Loader control file. modify. You can check and uncheck the individual types. and add columns. add not null constraints. change storage parameters. Types are listed in the Native Oracle Types panel and the ANSI Types panel. but you are using it to make modifications to an existing table. . because you can't alter the table type. This window lets you drop. and set unused columns.260 External Tables radio button When you are connected to Oracle 9i or later. Alter Table You get to this window from the Schema Browser > Tables page > Alter Table button. The Table window will automatically display the Schema and the Name for the table you selected. The options that are checked will appear as items in the Data Types dropdown in the Create Table and Alter Table windows. you can create external tables. Access parameters can be created by one of three methods: create with a GUI by sampling data. Data Types Options The Data Types Options page is accessed through the View > Options > Data Types item. Select All and Select None buttons are in each panel.

Or you can click on the Reports button on the toolbar. If you have a long running report process you can close TOAD and leave the reports program open. The reports list is displayed in the Reports panel in tree views that are divided by major categories. To run a report 1 2 3 Select the report. The Close button closes the window. The parameters that are displayed depend upon the type of report you select. because it can run in the background without tying up TOAD. Enter the parameters. The Report Description panel displays a description of the selected report. Click the Run button.Chapter 9 Other TOAD Options and Features 261 TOAD Reports TOAD Reports lets you print out various preformatted reports. You select a report from the list. TOAD Reports runs as a separate program. The wildcard symbol “%” is a choice in each parameters list. . The window does not close automatically when you close TOAD. TOAD Reports enhances TOAD performance. The Print Preview window displays the preformatted report and lets you set your printer options. The right panel contains a dropdown of Parameters that you need to set. The Run button will run the report and invoke a Print Preview window where you can select your printer settings. You access the window from the View > Reports menu item.

Hyperlinks throughout the HTML document let you jump between sections of the documentation.) when checked. Schema selections are saved and loaded on a per-database basis. This window lets you select one or more schemas from the Sources tab and create HTML documentation describing the schema(s) via the Begin HTML Schema Doc Generation button at the top of the screen. Snapshots Summary. Refer to TOAD Help for more information. Counts of All Objects checkbox If checked.INI file. NOTE: The HTML Schema Doc Generator includes command line support. the document will list each object type owned by the schema and the number of objects of that type in the schema. . Object Summary checkboxes Each Object Summary checkbox (Tables Summary. creates a list of characteristics of the object. All options are saved to and loaded from the TOAD. etc. Content tab This tab contains checkboxes that let you select what to include in your HTML document. the object name is a hyperlink to a more complete description of the object. For most object types. The following options require further explanation.262 HTML Schema Doc Generator You access this window from the Tools > HTML Schema Doc Generator menu item.

Chapter 9 Other TOAD Options and Features 263 Object Descriptions checkboxes Each Object Description checkbox enables additional checkboxes that let you specify what to include in the description. A few files per schema If selected. schemas are broken into a few files. One file per object If selected. each schema is written to its own file. Format tab File Options radio buttons One file per schema If selected. If more than one schema is selected. each object is written to its own file. select this option and specify the file name or URL (The default will be the same name as the HTML file but with the css extension. a Default Value column will be added to the table descriptions and display the default value for each column in a table.). The Table Descriptions includes a Default Values checkbox. When this option is selected. Background Use Existing CSS file checkbox Most of the style options are written to a CSS file. . one file for each major section. If checked. the options that are written to the CSS file are disabled. and each summary section is written to its own file. an additional HTML page will be created that is a link between the schema documents. If you want to use your own customized version of the CSS file.

the HTML code in the files will be indented with spaces so it can be more easily read. This option does not change the way the HTML documents are displayed when viewed through a browser.264 Indent HTML files checkbox When checked. so the resulting files are smaller and can be read faster by computers. A radio button also lets you select to specify object sets. In/Exclusions tab This tab lets you create and select inclusion and exclusion files. This lets you specify the objects using the GUI instead of editing a text file. If you use it as an inclusion file then only the tables or views listed will be included. You can then view and edit the file. You can also add STARTSWITH: ENDSWITH: CONTAINS: filters. The filter button lets you select either the Tables or Views button. no indentations will be made in the HTML code. This is the fastest way to create HTML schema documentation for large schemas when you are interested in creating documentation for only a small percentage of the schema objects. When the option is unchecked. Aliases for Schema Names tab This lets you add aliases for the generated HTML for individual schemas. The Create a file button generates an inclusion/exclusion text file for the schema that lists all your tables or views. . If you use it as an exclusion file then only the tables or views listed will be excluded. Headers/Footers tab This lets you add headers and footers and select the fonts for each header/footer. The inclusion/exclusion files are suited for specifying a large percentage of schema objects.

type in your password. The top panel is a console that displays messages from the server and the commands that you type in. including backspace.. although at this time only displayable characters and the <Enter> key are supported (i. You access the Network Utilities options via the View > Options > Network Utilities page. The menu lets you Clear the screen or copy information to the Clipboard. The lower panel shows the Telnet commands sent and received as part of the protocol. control characters. The protocol is specified in Internet RFC 854. Type in the Host Name/IP (Host Name or the IP address) in the dropdown box. . The Save Output button lets you save through the Save As window. press <Enter>. are not currently supported).e. Type in the Port number. It functions like a terminal emulator.Chapter 9 Other TOAD Options and Features 265 Network Utilities You access the Network Utilities window via the File > Network Utilities menu item. The Telnet tab is used to communicate with servers implementing the Telnet protocol. In the window your cursor will appear after “login:” Type in your login name. Click the Connect button. It provides Telnet capability through a simple interface. Right-click in the terminal window to access the context menu. Telnet Telnet (Telecommunications Network) is a protocol for connecting to another computer and establishing a session there where you can issue commands. and press <Enter>.

266

RExec
The RExec tab lets you execute a Unix command. The server must be running Rexecd in order for this function to work. It provides controls for specifying the host, user name, and password for the connection. It also provides a location to enter the command to be executed and an Execute button to submit the command. For more information about the RExec command, consult your Unix administrator or refer to your Unix documentation. The output of the command is displayed in the panel below the connection information. If it is a command to run a program (such as “bc”), then you can enter the information to send, press <Enter>, and see the results of the program. The connection continues until you exit the remote program. Type in the Host Name/IP (Host Name or the IP address). In the User box type in the User name. In the Password box type in the password. In the Command box type in a Unix command such as “who” or “ls”. You can double-click in the Command box to display a command editor that will accommodate long strings. Press the Execute button to execute the command. The right-click menu lets you Clear or copy to Clipboard.

Ping
This uses ICMP to contact other machines on the network and let you know whether it was successful or not. Type in the Host name/IP (Host name or IP address) that you want to ping. You can set a different Interval (which is in milliseconds), if desired. Click Start. TOAD will ping the selected host and display the results in the bottom panel. The sending bytes and received bytes results will display in the window. It will continue to ping the host at the interval selected until you click Stop.

Chapter 9

Other TOAD Options and Features

267

You can right-click in the results panel to access the context menu which lets you copy the results to Clipboard or Clear the results window. Ping is configured under View > Options > Executables.

TNS Ping
TNS Ping is an Oracle utility that tries to determine whether a TNS Listener is running for one of the connection strings in the TNSNAMES.ORA file. Given a connection string, TNS Ping looks in the TNSNAMES.ORA file to determine the name or IP address of the machine running Oracle. TNS Ping then connects to that machine to determine whether a TNS Listener is running. The TNS Ping tab has a Server dropdown with the connection strings from the TNSNAMES.ORA file and a TNS Ping button to submit the TNS Ping request. The results of TNS Ping display in the panel at the bottom of the window. TNS Ping is configured under View > Options > Executables. Select a Server from the dropdown. Click TNS Ping. An “Attempting...” message and “Ok...” message will display indicating that the server was successfully pinged. If there is no listener a “No Listener” message will display. The right-click menu lets you Clear or copy to Clipboard

IP Addresses
The IP Addresses tab lets you enter a Host name or URL and get the IP address, or enter an IP address and get the Host name or URL. The top of the window displays the local Host and the local IP address. In the Host/IP/URL box, type in the Host or URL. Press the Find button or press <Enter>.

268

Both the Host/URL and its IP address will display. This also works in the other direction. Type in an IP address, Press the Find button or press <Enter>, and both the Host/URL and the IP address will display. The results panel displays all of the results since you opened the window. The right-click menu in the results panel lets you Clear or Copy to Clipboard. The Save button lets you save the results to a comma-delimited file via the Save As window.

Chapter 9

Other TOAD Options and Features

269

TOAD Security
TOAD includes a security feature. You can restrict TOAD users from having access to specific TOAD features. NOTE: Due to a redesigned architecture for TOAD Security, if you are upgrading to TOAD 7.3 or later and have already set up your security features in a version of TOAD prior to 7.3, you will need to recreate the security tables and assign restrictions based on the new format. During the installation you had the opportunity to set up TOAD Security from the Server Side Installation wizard. You can also access the Server Side Installation wizard from the tools menu. See the Getting Started Guide for more details.

To Run Toad Security
1 Run TOAD, log in as the DBA user and select the Tools > TOAD Security menu item to bring up the TOAD Features Security window. Select the user or role, then select the features you want to deny to that user or role. All other TOAD Security features will be granted to this user. Since other non-DBA users only have SELECT privileges to the TOAD_RESTRICTIONS table, they cannot make changes to the security. 2 Click the Grant SELECT button so the user or role can see the TOAD.TOAD_RESTRICTIONS table. If the user cannot see the TOAD_RESTRICTIONS table (i.e., they do not have SELECT access granted to them), they have FULL access to all TOAD features. If the user has SELECT privileges on the TOAD_RESTRICTIONS table, then the security is in effect.

270

3

Move any commands you do not want the user to have from the Features list to the Restricted Features list. Not all buttons, menus, or functions in TOAD are contained within this security scheme. If you need to restrict other functionality, please let us know.

4

When you have completed restricting features, click OK to save your changes.

You can also create collections of TOAD features using existing Oracle roles. Grant the features to a role, e.g., DEVELOPER_ROLE, grant the role to the end user(s), then those TOAD users will get the collections of TOAD functionality without having to set up the same list of TOAD features for multiple users.

Disable saving Oracle passwords by TOAD This option is in the Features > Non-Menu list as No save passwords. It lets you disable the ability to save passwords. When this feature is activated, it applies to the entire TOAD session, even if other users on the same session have the rights to save passwords.

Read-only You can make TOAD read-only to a selected user or role. This is useful, for example, if you have someone who needs to view scripts and roles but does not have the authority to change them. To make TOAD read-only move the Read only Override function from the Features > Non-menu list to the Restricted features list. This makes TOAD read-only to the selected user.

NOTE: TOAD security is not enforced if the user has the DBA role.

For more information about TOAD Security refer to TOAD Help.

You can: § § § § § § § Organize session views View detailed information Kill sessions Trace sessions View locks being held or acquired by sessions View transaction information for online rollback segments Filter sessions For more information about the Session Browser refer to TOAD Help. .Chapter 9 Other TOAD Options and Features 271 Session Browser The TOAD Session Browser lets you easily view and work with sessions.

272 Java features Java features in TOAD include: Load/Drop of Java classes via the Java Manager Publish Java classes to PL/SQL packages via the Java to PL/SQL wizard Browse Java sources/classes/resources in the Schema Browser Create Java Sources in the SQL Editor .

and the Create Menu. and changes parameters Tablespace Map – Provides a graphical view of tablespaces in your database TOAD Control Files – Displays control files Pinned Code – Pins code into the memory buffer New Database Wizard – Creates new databases Identify Space Deficits – Displays tables that do not have enough free disk space to allocate their next extent Redo Log Manager – Maintains the redo logs for a database Log Switch Frequency Map – Shows when your database performs a log switch LogMiner – Analyzes a database for which system change number (SCN) caused a corruption problem so that you can recover to the transaction exactly before the corruption . instance. and database parameter settings. DBA windows include the following: Database Monitor and Unix Monitor – Monitor database performance with charts Instance Manager – Checks on the status of the databases you can access Database Health Check – Performs a series of checks on a selected database and displays the results Top Session Finder – Finds the sessions in the database that are consuming the most resources Oracle Parameters – Alters parameters NLS (National Language Support) Parameters – Displays session. the Schema Browser.Chapter 9 Other TOAD Options and Features 273 Optional Quest DBA Module The optional Quest DBA Module adds database administration functionality to the DBA menu. The Quest DBA Module windows are discussed in TOAD Help.

Lets you compare two databases Generate Database Script .Sets parameters for Unix and Windows registry to improve database performance Database Probe . alter. Resource Consumer Group. Resource Groups. Policies. For example.Displays summary for all databases on a server at one time Schema Browser The Quest DBA Module adds tabs to the Schema Browser including: Dimensions. Libraries. redo logs. Directories. Rollback Segments. Profiles. Roles. drop.Generates a script for various database level objects. Refresh Groups. Resource Plans. Most of the tabs let you create. and roles Unix Scheduler . Libraries. and System Privileges. and Resource Plans.Schedules Unix tasks to run regularly Unix and Windows Registry Parameters .274 Export Utility Wizard – Exports a schema script using Virtual DBA routines Import Utility Wizard – Imports a schema script using Virtual DBA routines Generate Schema Script – Takes the selected schema or definition file and builds DDL and/or definition files for all selected objects Compare Schemas – The DBA version of this function loads def files and saves the migration/synchronization report to a script file Compare Databases . Policy Definitions. Policy Groups. Directories.Checks your database for errors on a regular basis and alerts you if a test that you designed fails Database Browser . Tablespaces. and view details of the associated object and include additional functions. Policy Groups. Profiles. Create menu The Quest DBA Module adds menu items to the Create menu including. . Tablespaces. you can place tablespaces and rollback segments online or offline. such as tablespaces. Rollback Segments. Roles. Dimensions.

toadsoft.quest. and try to run TOAD again. . What is the current version of TOAD? See www.quest. there could be a problem with the sound card or sound devices.com for the latest version information.com site. What can I do? If TOAD hangs during the splash screen. Where can I get upgrades? Upgrades can be obtained from the Quest web site.WAV to something else. set “PLAY_WAVE=0”. Can TOAD connect using 16 bit Oracle SQL*Net? TOAD is a 32 bit application and therefore requires 32 bit SQL*Net.com. so that TOAD will not find it or attempt to play it. You can also rename TOADLOAD.INI. www. Edit TOAD.10 Frequently Asked Questions/Support For a comprehensive list of Frequently Asked Questions and other information about TOAD refer to the www. Something causes TOAD to hang during the splash screen.

Save the support bundle text to a file.276 TOAD Help To access TOAD Help while in TOAD. and details on TOAD’s features. That information is stored in CONNECTIONS. The toolbar includes Copy the support bundle text to the clipboard.INI.INI to emails (When checked. but it might help the support staff because it includes options settings and other TOAD information. Change the active session for this window (useful to quickly compare server information for each session). TOAD. Attach TOAD.INI does not include any connection information (passwords. your credentials (passwords etc. Launch default web browser and go to Quest support on the web (http://www. servers. the support bundle text is included as the body of your email) . So. It also contains details for troubleshooting problems.) are not included. Send a message to Quest Support (support@quest.com/support/). The Help > Support Bundle menu item window provides updated support information.com).INI file to Quest Support or share it with other TOAD users. Customer Support If you have questions about using TOAD. and you can’t find the answers in the TOAD User’s Guide. TOAD Help includes contents. the TOAD Getting Started Guide or TOAD Help please contact the customer support staff. a searchable index. TOAD. Send a message to the TOAD mailing list (toad@yahoogroups. Including the TOAD. The information it contains will be useful for support when resolving issues and we recommend that you include this support information with emails to Quest Support. Include this information in the body of your emails (When checked. press the F1 key. usernames).INI file is optional.quest.INI is included with your email to Quest Support or the TOAD mailing list as an attachment). when you submit the TOAD.com).

Xpert. SYSDBA. and Swap) . etc.ORA Location Server Version Server NLS_CHARACTERSET Server NLS_NCHAR_CHARACTERSET Connected User and Connect As (Normal.Chapter 10 Frequently Asked Questions/Support 277 Information Displayed Application Information § § § § § § § TOAD Version TOAD Registration Information TOAD Options (Debugger.) Installation Type (Network or Local) EXE and Client Directories (Client directory only applies to network installations) Knowledge Xpert Version and Location Formatter Plus Version and Location Oracle Client/Server Information § § § § § § § Client Version Client Location TNSNAMES. SYSOPER) System Information § § Operating System Version Total and Available Memory (Physical. DBA. Virtual.

include the error text as well. This information helps the customer support staff. The Help > About window displays customer support contact information including telephone numbers and your version number. (Located under HKEY_LOCAL_MACHINE\Software\Oracle.quest. When you contact customer support they will need to know what version of TOAD you are using. you will also be able to check the status and update your own calls online. You can type in information about your question or problem in the body of the letter. .com/support If you create support calls online.278 § § PATH Environment Variable TNS_ADMIN Environment Variable Oracle Home Registry Data § All registry information for each installed home is displayed. You can create your own support calls online at www. If your question is about an error message.

................................279 INDEX A Advanced Queuing.................................... Also See Syntax Highlighting Columns ................................................... 111.............. 192............... 100 Create Table ........... 123 CNVFUNCS............... 87............................................ 218.............260 Analyze All Tables................................................. 184 ASCII ..... 247. 104 ............ 164... 216 Commit........................ 14 Constraints...... 80..........TXT ......................58..........202................. 72....... 85.................................... 88 Change Active Session.. 9...... 12 Table .181 Capitalization ...............55....................... 27.... 104..................... Also See Rollback Compile ....... 73 Comments... 192 Clipboard ..................................................................98........156 Browser Schema............. 80 Create ............................................................................................................. 93 Colors8.............................TXT .......136 Call Stack ............................ 69.259 Advice... 210............................. 245 CLOB......................... 26............................................ 137 DATEFMTS...........................INI ... 87.TXT .......... 128 B BLOB...................... 230 Create .................................................................................................. 184 Synonym............ 230 Date Format...................... 100................................. 45. 203 Control Characters....................... 153.......................... 129.98...................12 Aliases....................9.................................. 123 Bookmarks .................. 71............ 35.....257 Code Templates ........104 Code Road Map .............. 152 Configuring the Editor...................................... 66 CONNECTIONS... 229 Create .70... 105. 89..100...............117........................................................213 Arguments..... 229 Primary Key ........... 89 Breakpoint........................ 230 DBMS Output................................ 225 Table..9........................ 204 D Data Types Options .............. 211........ 250 ALIASES.................................................... 189 C Calculator................................. 124.......... 38 Comment Code....... 201 Constraint .................................... 213 Disable......... 198............. 249... 76..............................218 Table .............. 63..... 230 List.................................................................. 169 Object ........... 213 Database Link......................23...................... 233..... 15. 259 custom queries.....213 Index ..................................... 127.....................................37... 85....................................................................................................... 216 Column Name Select..........................................63 Alter Table .............................................See Table Database Links ...............................42......... 158 Procedure..... 63 Database........... 43..................... 197 Dropdown.......131............................................

....15 ER Diagram............... 93 HTMLSCR................................................................................... 137 SQL ............ 34.. 105 TOAD ..................... 228 Rebuild ..........................................66 Auto Replace Substitutions ....... 73....206 Debug ........................ 181 E Editor..68 Procedure .......................... 78......66.......................................... 94................... 195. 68......................... 61................................................................... 76................................................ 228 INI . 104 Gutter..............................128.....................39..... 74................................. 44................................. 185................. 68 INISUB........................ 76...... 48............ 26........................ 37....17..... 180.............. 183 Read-Only ... 71 I Import .... 93 HTMLOPTS.......101 DATFUNCS...... 214 Find................. 70 Code Templates.........................................................................280 Dates ......... 37.....63......... 78. 100 Incrementally drop table.. 202............................ 93 INIOPTS................................. 71........................ 37..... 37............................. 68 HTMLSUB.......... 156 H Help ........TXT...................................178.....................................................180 Procedures ..................... 74. 104................................. 153.TXT .TXT ......... 262 HTML Schema Doc Generator.......................................... 119................................... 95 Grid..71.... 253 Table Data ....... 88....TXT .....................165 With Debug Information .............. 94 INIKEYS...... 114 Syntax Highlighting . 70..104 Explain Plan ...................................... 76. 88 IP Addresses .. 220 Data .......202.............................. 76................................. 37........................................27......... 156.........................104 DBMS Output ........... 267 ....................... 206 Index..........27 Parser Scripts............ 214.165 Drag and Drop........................ 70............BIN ...................................................DCI. 8........................................................ 124.180 Dependencies ......................... 97............... 75..TXT .................................. 92.......... 99............... 151.............. 86............ 180 Symbol Table ......TXT ............TXT.................. 169........ 163 End Connection.... 94 External .................... 182 Functions..........................DCI.... 96...... 104 SQL Templates ................ 93 INI............ 181.. 23 HTML.......... 72................179............. 93....103...... 50......... 253 Editor ....................... 181 Deallocate Table Extents.. 85 Foreign Key Lookup................................. 72............................. 130 Fonts ....178.....66... 219 Schema Browser .....208 F Filters ................................ 182 Debugging............................................................. 63... 227 Recompiling ................................ 76............................ 222 GRPFUNCS........... 71 Initial Caps......... 45... 76.......................258 Exceptions...... 92..................................... 101 Export....... 181 Information..........................209 Flat File . 87............ 262 HTML...........179.. 76.....179 Dependent Objects .......BIN ....... 276 Hotkeys.................... 180. 128 Data .......................... 153 Grants ........... 63 As a Language Type ............ 68................... 66......................................... 112 Key Assignments ........... 89 Offline ................TXT ..66....40............123....... 110 Editor Options23................ 71........108... 153.......... 205 G Goto . 226.............................. 93 INISCR........... 76...............................194.......................... 76...................... 50................. 218 Analyze.................... 94 HTMLKEYS. 69... 125........................234 Table Script ..........................23..........................193......................................

............................... 76................................TXT........................... 198.................. 250.... See Initial Caps MSCFUNCS.. 69 PLSQLSUB............... 71......................... 158 NEWPROC.............TXT....DAT . 76..DCI....... 14 Personal Oracle..................... 94 PLSQLKEYS.....98.................................................TXT ....... 121 Ping.........77.......265 NEWFUNC.................. 123..............94 JAVAKEYS...158 NEWPACK.... 123............................................................ 71 Post.......................................69 Lowercase ....TXT..........179 Script......................................................................................... 174 Printing .............TXT ...... 77 Procedure Editor......................................... 85..................................... 77 ................................................... 226 Debugging . 72............................. 104 Printing .............. 37 Password...........72...104 N NAMEDSQL.................................. 123 LONG RAW ................. 210 Numbers ...... 88 M Make Code .......... 158 NEWTRIG..... 160................................................TXT ........ 163 Procedure ........................................... 210..................................................... 194 Right-click35....... 77 Options .272 JAVA.......SQL.................................. 86.. 93 PLSQLOPTS..... 9....... 11 Other.............. 138............. 158 NMBRFMTS................................ 166 Parameters ...... 167. 37............ 252...71 K Key. 266 PLSQL...............................DAT ........ 254 P Package....... 93 PLSQLSCR........ 123......9 LONG ..........................................................213 Foreign ................TXT . 253 Message Boxes........ 95...........21 Keystroke ................. 106........ 107 Memo Editor ..37................................SQL ........ 93 JAVASCR........................................ 213.................................................................................... 190............ See Arguments PARAMS.................... 81..............TXT...... 78 Load ............76...DCI ...........20 Method ..66............21.....TXT ......................................... 78 Editor..68 JAVASUB.........................................TXT ..........................................................................TXT ..SQL......BIN .. 104 O OPTHINTS............................................ 246................................................ 137 Display................179 Mixed Case .See End Connection Logon ... 83............................. 91.............................TXT ................... 88............... 213...............44 Logoff ..............126.......... 89....................71 L Line Numbers.............................................BIN ............................................................... 223............................ 50...............99............... 163 Schema Browser..................... 254 Primary.......98................................... 245..... 178 Navigator ..................................................................... 99....... 99.......................................... 76............................... 157 File ..........................................52................ 104 Null.............. 109 Logon ...... 53 Parse ....................................................... 121 Network Utilities..............81............... 15 PERSSQLS..................................................................................................................... Also See Line Numbers NUMFUNCS........... 76 Editors .......... 55 SQL Modeler . 138 PREDFXCP...................... 104 Options Data Grids...... 41.........................................76...... 194 SQL Editor ........ 57.................... 245 Keyboard..................................281 J Java features............................... 124 Menu .......................... 100 LONGSCR...... 68.. 93 JAVAOPTS............SQL .......................................................... 119...TXT ..................................

.......... 252 File ........................................... 49..202...... 124....................... 275 SQL*Plus..................147 Results Grid.......................... 225 Create..........................38................... 90 Set Parameters ... 11...........................................37 Compile................. 203.................195 Search....276 Queue Tables.... 115..................... 252 Canceling ........................ 260 ............................................................. 223.......................................................................14 Schema ...........55 Quest ScriptRunner .. 213..... 57........................................ 153 SQL Editor.161 Execute. 52......................... 195.28 PSEUDO.. 51.............7..........282 Print Grid.. 58 Named SQLs..................................... 33.. 243 SQL Recall .......... 229 Delete................................. 162...................................231 Queues.......... 227 Vertical ............................ 54. 49..................................................... 249..... 225 Q Queries11............ 121 Personal ................................. 104 Strip Code... 21 Table............ 165.......... 219 S Save.................................. 244 Add Column ............................... 50 Status Panel Indicator ............... 234 Sort Options window.................178 Procedures Arguments ......................38......... 161....TXT .................................. 249 RExec ....... 124 TAB Key .... 49 SQL Results Grid ... 40..........................................................TXT ................... 120 SQLS............104 Public ............................................................. 41 Sort ........ 121................ 53..............................212............................ 213................................ 110......... 34 SHORTSCR.................................................................................................................. 114................................... 225 Syntax Highlighting..... 163 T Tab Delimited ................................................... 96...................... 226 Probe API......... 66........ 226 Compile Dependencies....... 42..................... 73.... 226 Shortcut Keys .................... 63........ 69...........................................................182........................................ 154 Referential....... 14 TOAD .....223 Report Link Designer ....... 118 SQL*Net................................. 269 Sequence..... 40 Stay on Top ....................... 51...................................................................231 R Redo ............. 15.......... 37............ 250 Single Record View............... 268 Security .........26........................................... 130.............................................. 69 Show All... 99. 161.................... 120........................... 75.......... 49..................... 96. 164....225 Passwords..........162 Project Manager ................... 215.......... 38.......DAT ............. 118................ 111 STRFUNCS......................................... 49...... 174 Splitters Horizontal ............... 190 SQL Modeler ......................39....... 230............... 106............... 135 Source Control.............................. 123...............................................................252 Privileges........................ 137.... 101......... 114..................................214 SCHEMA........................ 184 Dependent .. 74. 121 Previously Executed .....179....... 251............158........................ 164............ 107 Synonym................................. 12.............. 225 View ...........................TXT.............. 90 Edit ........... 244.10............... 61 SQLFILES....FLT ..................................................... 213 Filter .................. 74.... 95.......................................... 116........................................... 122 Procedure Editor ..........238 Quest Software Customer Support............... 153 Passwords....................180 Errors..................... 87... 217 Alter.....................................TXT ....... Also See Commit ROWID ............. 219.. 116.....................................................................96............... 222.........266 Rollback ............. 180 Create ................ 109.....

..............283 Analyze ......................... 209 Filter...208 Select... 154.....71 Thread ........................ 57 Substitution.....................259 Data Types Options...................................................68 TEXTSUB.................................. 13....................................................................... 179 Triggers ........ 79 ......................................................... 275 Toggle............................... 104 utPLSQL.............................104 TEXT................ 86......... 275 Views......... 22 Navigation ..........................101 TNS Ping.......................................... 79 Word-Wrap Column................265 Templates Code Completion ...............................................ORA.......................................................................... 93 TEXTOPTS............ 153.................... 109..........................................128....... 43 Uppercase .....267 TNSNAMES....................................261 TOADLOAD .........215 Tablenames38...... 12..............76........................... 199 Tabs (in the editor text).......TXT . 112........BIN ..................................................... 181 MDI .................... 19 Word Wrap......................................199............... 231 U Uncomment Code......165... 54 Version Information ........................................ 237............................................................................ 73 Undo ..................... 275 Schema........................ 222 USRFUNCS............................. 154 Modal ........ 17..................................................................................55 Time Values ................... 87.................................................................. 181 Trace Into .... 152 Procedure Edit Status ...... 215 Update Grid Edits..................... 202 Viewing... 154...........260 Drop . 105...... 38............. 65.........71 New Function............. 10..............15 Security .................8 TOAD Reports ................TXT...................269 TOAD Getting Started Guide............ 192................................................................ 218............................................ 219 Common Edit ....................215 Export Data ............................ 171 V Variables.............................. 103..76........... 110.. 8................................... 15 TOAD ................................. 7................................................158 SQL Help ...... 152 Procedure Edit ..158 New Procedure.............................. 227 Types ............................................... 104.......................................................33.......................177 Telnet ...........213 Create ....223 Script..DCI ....................................................................... 225 W Windows Dockable..................................................................35................................................ 66......39............................................ 212 Referential.................. 88 User ............40.. 86 List............... 250 Toolbars................... 9..........................................................158 New Trigger ...................... 53 Bound ....................................... 87.................................................................................214 Privileges.............................. 109 Truncate ........ 9...................... 37. 93 TEXTSCR........TXT ........................................................TXT..................83 Team Coding..................94 TEXTKEYS...................................158 New Package..............................................................................86. 246 Bind ..................................................................

Sign up to vote on this title
UsefulNot useful