광고
광고
Toad for Oracle
Navigator Panel
The Navigator Panel displays an outline of the script in the active tab. Click on items listed to jump to that statement in the editor.
The navigator identifies SQL Plus statements, comments, DML statements, and
DDL statements.
If you have the pointer over an item in the navigator, the entire statement displays as a tooltip. Statements must be separated by ";" in order to appear. It must be valid SQL Plus syntax.
SQL Results Panel
The SQL Results Panel tabs include: Data, Explain Plan, Auto Trace, DBMS
Output, Script Output, Code Statistics, Query Viewer, Script Debugger (for editions with debugging functionality), and CodeXpert.
Data tab
The Data Grid is discussed in detail in the Data Grid chapter of this manual.
The SQL Results Data Grid lets you view output from select statements. The Grid lets you take the results of a query and perform a variety of functions and display options. It's more flexible than using SQL* Plus, because you can format the results visually or graphically.
If you type and execute
Select * from tablename in the SQL Editor, you can see all rows and columns of the given table in the results grid.
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. Query statements
MUST return the ROWID to be updateable.
40
SQL Editor
For example: select * from employee would not be updateable whereas: select employee.*, rowid from employee would be updateable.
To overcome this obstacle, you can substitute EDIT Items which Toad will translate into the updateable version of the statement.
For example: edit employee
If the resultset is editable but remains read-only, make sure the
View | Options | Data Grid - Data | Default to Read-Only option is not checked.
A red or green box displays in the status panel indicating whether the recordset is editable (green) or not editable (red).
Cursors
You can view cursor data. When a query is run with a cursor, the cell with the cursor will display the word CURSOR. You'll need to right-click the cell and select
Pop-up Editor or double-click the cell to see the cursor data. (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.) Data can only be displayed once per cell each time the query is run.
41
Toad for Oracle
Nested Table Data
You can view and edit nested data. A cell in the results grid that contains the nested data will display the word DATASET. Double-click (if the option is enabled) or right-click and select Pop-up Editor to view/edit the nested table data.
BFILE Data
You can view BFILE data. A cell with BFILE data will display the word BFILE. A column will be added to the grid to show the BFILE directory. Double-click on the cell (if option is enabled) or right-click and select Pop-up Editor to display the data. If it is an image or text file Toad will launch the program that is associated with the extension. Toad does not provide editing capability for BFILE data. If you run the file in an associated program you might or might not be able to edit the file, depending on your rights.
VARRAY Data
You can view and edit VARRAY data. A cell with VARRAY data will display the word VARRAY. Right-click the cell and select Pop-up Editor or double-click the cell (if the option is enabled). The memo editor will display the first 100 entries in the VARRAY.
Object Data
You can view and edit object data. A cell containing object type data will display the data in parenthesis delimited by commas. To view/edit, double-click on the cell (if the double-click option is enabled) or right click on the cell and select
Pop-up Editor.
LONG and LONG RAW
LONG is similar to CLOB, and LONG RAW is similar to BLOB. Toad can handle all four of these datatypes.
Toad does not display the data for LONG RAW columns in a SQL Edit Grid. LONG columns are columns that contain character data up to 2 gigabytes. You define them as "long" in your SQL script. LONG RAW columns contain binary data that cannot be displayed such as GIFs, Word docs, etc.
LONG columns display the first several characters, and LONG RAW columns display as (BLOB).
42
SQL Editor
LONG RAW columns display as (BLOB).
Double-click a LONG or
LONG RAW column to display the memo editor.
You edit these columns by double-clicking on the column and editing from the popup windows that display. For LONG columns, the Memo Editor window is displayed. For LONG RAW columns the Blob Edit window is displayed. If the popup window does not display, go to the View | Options | Data Grids tab and make sure the Popup memo editor on double-click option is checked. It must be checked for the above functionality to work.
The popup editor for LONG columns displays the column text. You can edit in the editor or load a file into the editor. The popup editor for LONG RAWS provides
Load From File or Save to File functionality.
Double-clicking on the LONG
COLUMN $define popups a memo editor that contains the column text.
43
Toad for Oracle
Load From File lets you select a file from your hard drive and place it into the
LONG RAW column in the Oracle database.
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.
Note that the recordset has to be editable for the popup editors to edit the data.
You can still use the popup editors to have a read-only view of the data.
To Edit LONG and LONG RAW Columns
LONG Columns
The recordset has to be editable for the popup editors to edit the data.
1.
Create a table: "create table long_test (id number, long_col long)"
2.
Edit the table: "edit long_test"
3.
Insert a row: enter "1" for ID, then double-click on the long col cell
4.
Enter text.
5.
Click the right arrow. "select * from long_test" should view all records, including (at least the first few chars) the long cols.
LONG RAW Columns
1.
Create a table: "create table long_raw_test (id number, long_raw_col long raw)"
2.
Edit the table: "edit long_raw_test"
3.
Insert a row: enter "1" for ID then double-click on the long raw col cell
4.
Pick a file to import.
5.
Click the right arrow Next Record button. "select * from long_raw_test" should view only id, long_raw_col should display
(BLOB).
44
SQL Editor
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.
Click the Single Record View button, and the Single Record View window displays for the record of the item you've selected. The arrow buttons in the window let you move up and down the columns. You can also insert records, delete records, and post edits.
Here, the location for Department 30, Sales, was changed from Chicago to New York.
45
Toad for Oracle
Time Values
When displaying dates with times, Toad suppresses the time values if they are
12:00:00 AM (midnight). The time portion of the date fraction is zero, so Toad adds no value to the display of the date.
Oracle stores dates as a big fraction number offset from January 1, 4712 B.C. It is then converted to a complete date and time. Whether or not you use time, it's in there. It will also work accurately well past Y2K.
Performing a query:
SELECT SYSDATE FROM DUAL will display the time, and similarly, queries of DATE datatype columns will display the time if it is not midnight.
The time dropdown in the Toad Options | Data Grids - Data dialog (or right-click on the grid and select Grid Options) 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 including partition information for Oracle 8 and above. The interface has tabs for
Operation, Object name, Rows, Bytes, Cost, TQ (Object Node), In/Out, PStart
(Partition Start), and PStop (Partition Stop).
Explain Plan can be printed from the SQL Editor window via the right-click menu item.
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 Object wizard (see the
Getting Started Guide).
Explain Plan is discussed in more detail later in this chapter.
46
SQL Editor
Auto Trace tab
Auto Trace displays the results of every statement issued while in auto trace mode. It helps with tuning. When you run a query you can find out some performance statistics related to that query. Auto Trace is not recommended if a query is going to return a lot of rows, because it will force a read of all data from the results of a query.
DBMS Output tab
When you execute a DBMS Output statement, the DBMS Output will automatically display in the DBMS Output tab of the results grid.
Buttons let you Turn Output On/Off, Clear window, Set Output Buffer Size
(invokes the Set DBMS Output Buffer window where you can set the size), Save to file, Print, and Delete Screen.
Frequency of polling
You can set the frequency of polling (2 seconds to 15 seconds).
You can also open a new DBMS Output window by selecting the Open a new
DBMS Output window button.
DBMS Output is discussed in the Procedure Editor chapter.
Script Output
When you execute a script the results automatically display in this tab. When executing as script, you are not prompted to save changes because the script is not saved to a temp file. You can print from the Script Output tab via the right-click | Print menu item.
The script editor allows multiple editor tabs (like in the Procedure Editor) each with its own results sets in the lower part of the editor. You can run multiple queries and get multiple grids back (one for each data set returned) using the new execute button.
47
Toad for Oracle
Query Viewer
This tab displays currently running background queries, the database where they are running, their current execution time, and the SQL.
Toad’s main Query Viewer window (under the View menu) shows all the user queries that Toad has run.
The Error tab displays any error messages.
48
다운로드
광고