toad (tool for oracle application developers)

6
APPENDIX C TOAD (TOOL FOR ORACLE APPLICATION DEVELOPERS) INTRODUCTION TOAD is a tool from Quest Software (www.quest.com) for creating and testing PL/SQL code. It offers many features for developers and DBAs and is available in a variety of versions. This appendix uses TOAD for Oracle version 11.5. You can download a trial version of TOAD at the Quest Software Web site. NOTE To download the software, you must supply a business e-mail address for Quest Software. This appendix gives you an overview of TOAD and explains how to use it to enter and run both SQL and PL/SQL statements. To explore this tools features, visit the Quest Software Web site, which offers information, data sheets, and white papers. CONNECTING TO A DATABASE First, you must establish a connection to access database objects, such as tables. Follow these steps to create a new connection: 1. Start TOAD. The database login window shown in Figure C-1 opens. Enter the connection information for your database. (Check with your instructor if youre not sure what to enter.)

Upload: others

Post on 12-Sep-2021

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: TOAD (TOOL FOR ORACLE APPLICATION DEVELOPERS)
Page 2: TOAD (TOOL FOR ORACLE APPLICATION DEVELOPERS)

N O T EAn Oracle TNS connection is shown in Figure C-1, but you have other connection options, such asdirect or LDAP.

2. Next, click the Connect button to open the main TOAD window(see Figure C-2).

FIGURE C-1 Connecting to Oracle in TOAD

Statementarea

Resultsarea

FIGURE C-2 The main TOAD window

C2

Appendix C

Page 3: TOAD (TOOL FOR ORACLE APPLICATION DEVELOPERS)

To view database objects, click the Schema Browser button to open a window in thework area with available objects listed in the left pane. After you select an object, tabs inthe right pane display information about the object. For example, in Figure C-3, a tablehas been selected in the left pane, and the right pane includes tabs for columns, indexes,constraints, and so forth.

EXECUTING STATEMENTS

You can enter SQL statements or PL/SQL blocks in the statement area. In Figure C-4, anSQL statement has been entered in the statement area. Clicking the Execute Statementbutton runs the statement and displays its output in the lower pane.

Schema Browserbutton

Object type tabs

Information for theselected object isdisplayed in tabs

FIGURE C-3 Using the schema browser to view database object information

Execute Statement button

SQL statement and output

FIGURE C-4 Executing an SQL statement

C3

TOAD (Tool for Oracle Application Developers)

Page 4: TOAD (TOOL FOR ORACLE APPLICATION DEVELOPERS)
Page 5: TOAD (TOOL FOR ORACLE APPLICATION DEVELOPERS)

To run the procedure, right-click it in the left pane and click Action Console. In theAction Console dialog box, click Execute Procedure, and then click OK. The SetParameters window shown in Figure C-7 opens with an anonymous block createdautomatically to test the procedure. This block contains a call to the procedure. To testit, you need to set values for any IN parameters and add DBMS_OUTPUTstatements todisplay values. Figure C-7 shows how the supplied block is modified.

The Turn OutputOn button

FIGURE C-6 Enabling DBMS output

FIGURE C-7 Testing a procedure

C5

TOAD (Tool for Oracle Application Developers)

Page 6: TOAD (TOOL FOR ORACLE APPLICATION DEVELOPERS)

Click OK to run the procedure. Processing returns to the statement area, and theresults area displays values for OUT parameters (see Figure C-8).

SUMMARY

This appendix has shown you how to get started with TOAD software, including creating aconnection and executing SQL and PL/SQL statements. TOAD has more advancedfeatures to help with PL/SQL development; for example, you can set breakpoints duringprogram unit debugging to view information, such as variable values, while a program isrunning. To explore these features, review product information on the Quest SoftwareWeb site.

Result of test run

FIGURE C-8 Displaying test output

C6

Appendix C