Use the Compare Files utility to compare files and scripts with other files and scripts, as well as database objects with revisions in the VCS. This utility provides a split window composed of read-only versions of the files that are different, plus an editable third window where the merged source code is assembled.
To open the Compare Files utility
Select Utilities | Compare Files, or click on the toolbar of any Toad feature that works with files.
Depending on where you open the utility, there may or may not be files displayed. If files are not displayed, you are prompted to select them. If both files are in the same directory, you can select them both at once. Otherwise, you are prompted to select both left and right sides separately.
To customize the Compare Files interface
Click to set the options.
The upper two comparison windows make use of standard diff tool features:
The differences are color-coded with a legend to explain them at the bottom of the Compare Files window. By default, the Compare Files window finds the next/previous differences by block, rather than by line. You can change this option by clicking (Options) in the Compare Files toolbar, then selecting Finds next difference line.
Compare Files also shows a Differences Map on the left side of the window. The Differences Map is a visual summary of the differences and lets you quickly change sections of the file. Colored lines show the relative position of line mismatches. An arrow represents the part of the text currently visible in the comparison window. You can click the thumbnail view to position the view at that point in the documents.
Note: If the Differences Map is not shown, click in the Compare Files toolbar.
To show line numbers and white space
On the toolbar:
To view a list of differences
Click on the toolbar. The report shows each difference and its line number.
Click on the toolbar to view a comparison summary. The summary shows the number of matches and the number of differences in the code on the right, as compared to the code on the left.
To view differences line by line
Click on the toolbar. This opens the line viewer pane below the split differences window.
The proposed merged source code is shown in the Merged Source window at the bottom of the Compare Files window. You can revise the merged source code as needed, using tools on the toolbar, in the comparison windows, and through direct edit.
Note: If the Merged Source window is not shown, click on the toolbar.
Important! The Merged Source code is always based on the source in the left-hand comparison window.
To switch sides
Click on the toolbar to base the Merged Source on the source that is currently in the right-hand comparison window. The Merged Source code is updated to match that code because it is now in the left-hand side comparison window.
To refine the merged code
You can use any of the following methods to refine the merged code. See also the Examples at the end of this topic.
Select a line, then click the left or right arrow on the toolbar to use that line in the Merged Source. For example, to use the line from the left-hand window, click the arrow that points to the left.
Click the diamond beside any line to add that line to the merged code in the Merged Source window. When you choose a line, that change is marked as resolved and the diamond fills in with solid color.
Make any inline changes directly to the Merged Source code as needed.
To view the status of your merge work
The status bar below the Merged Source window keeps track of how many issues there are to resolve and how many are resolved.
To revert merge changes
Click on the toolbar to reload and compare the files again. Existing changes in the Merged Source window are cleared with this action.
To accept the merged code
You cannot overwrite either of the two input files. Use the Save button to save the merged code to a new file. This preserves the original two files in case they are needed.
Deleted line: A line was deleted (therefore it exists on the left side but not the right). The following options are possible:
Option 1: Click the diamond next to that line on the left (or click ) to keep that line in the Merged Source.
Option 2: Click the diamond next to that line on the right (or click ) to delete that line from the Merged Source.
Modified line: A modified line exists on both the left and right sides. The following options are possible:
Option 1: Click the diamond next to that line on the left (or click ) to use that line from the left in the Merged Source.
Option 2: Click the diamond next to that line on the right (or click ) to use that line from the right in the Merged Source.
Added line: A line was added (therefore it exists on the right side but not the left). The following options are possible:
Option 1: Click the diamond next to that line on the left (or click ) to delete the corresponding line from the Merged Source.
Option 2: Click the diamond next to that line on the right (or click ) to keep the corresponding line in the Merged Source.
Use the Describe (Parse) Select Query function to see what columns would be returned if the query were executed. This is useful for tuning a LONG query before it is executed.
To describe a query
Select Editor | Describe (Parse) Select Query (CTRL+F9).
Any of Toad's window query results can be saved to the Windows Clipboard or to a file by the procedure below. Some dialog boxes do NOT have a Copy to Clipboard or Save to Disk function. This duplicates that functionality.
To save query results
Sql = " select count(*) as cnt"
Sql = Sql & " from all_tables"
Sql = Sql & " where owner = 'DEMO'"
Sql = Sql & " and table_name = 'EMPLOYEE'"
select count(*) as cnt
where owner = 'DEMO'
and table_name = 'EMPLOYEE'