Hello, my name is Robert Pound, and I am a Product Technologist for Quest. Today, we will discuss code analysis in Toad for Oracle. Code analysis helps ensure that your code meets, and exceeds, your company's best practice standards for performance, maintainability, and reliability. The best time to adopt coding standards is during development, which is why I've started with the Editor in Toad for Oracle. So on screen, I have the editor open, and we can see blue wavy lines under certain parts of the code.
So as I hover over them, we can see the rule violation pop up, and it gives a breakdown of the rule, the code element, and the severity of the violation. So if I right click on one of these, and I choose Code Analysis Violation at the top, and then choose the rule. As we can see, I have various options for ignoring it, or I can choose explain details. This gives a more thorough breakdown of the actual rule violation itself, and it also gives information on each one of the categories. So for instance, if you were unfamiliar with the category SQL, you could click on it and it will give you all the information on the different categories, including SQL, so you can better understand what is meant when the tool says SQL. Let me go ahead and close this.
So at the top in the toolbar, we have the rule sets, which we'll talk briefly in a minute. But essentially, you have to choose the rule set that is best for your organization. So as we select different rules sets, we can see, in the case of this code, most of the violations go away when I choose Code Correctness. Top 20, they all go away. So this is where we change how the editor views the rule sets.
To the left of that, we can see Code Analysis in the Editor window. So if we click on this, it's going to analyze this code that's currently in the editor. And it's going to give some statistical information, as far as the complexity of your code, the rule violations for this code, and then the credit matrix, which talks about what and how this code is affecting your database. As we can see here, this is Select Statement, so it's only retrieving on certain tables. But this gives you a quick and dirty analysis of this particular piece of code in the editor.
The other option is sending the code to the code analysis dashboard. So this will move whatever is currently in the editor to the code analysis dashboard. You can also get to the code analysis dashboard by choosing Database, Diagnose, and then Code Analysis. I already have a Code Analysis window open, so let me go ahead and move to that now. The Code Analysis dashboard gives us the ability to run the same analysis, only looking at multiple objects, and then, obviously, being able to compare them side by side.
So to load objects into this window, you can choose from a file to open up SQL scripts that you have saved, if you want to analyze them. Or you can load objects from the database. So from here, we can choose our schema and what we're trying to look at, as far as triggers, views, functions, et cetera, and then directly add them in to the Code Analysis dashboard as well. And you can also modify your connections, add connections.
And then you also have the ability to choose whether to run just the review itself, or you can run SQL scan, in addition, which gives you more information on potential performance issues. It borrows from SQL Optimizer. So if you haven't checked out SQL Optimizer, yet I highly encourage you to go do so. But in any event, once you have the objects that you want to analyze, you can either choose Run or Run All.
So on the top is a summary of the metrics for each one of the objects. And then at the bottom, for each one of them that is selected, it will give you a breakdown of the results, the rule violations. And as you click on them, it will highlight in the Code Preview to the right where those violations are. And you can step through the list and see how your code stacks up. For the reports-- so if you click on this tab to the right for an individual object, it will give you a HTML friendly breakdown of exactly what code violations there were, the complexity issues, et cetera.
And if you want to understand more about the metrics themselves, in the report is the definition for each one of the metrics, as well as a range for good, for bad, et cetera. So if you're new to some of these metrics or you don't quite understand them, in the report is all the information you need to help better understand and categorize your code.
So some additional items on the toolbar. So you have the option to save the results to a database. So if you don't have a table already created on a database, if you click on Save Results, it will walk you through the process with a wizard to create a table on your desired database so that you can store the recent results. Then you can look historically through time at your code analysis for a particular object so you can see it getting better, or possibly worse, and take action accordingly. You also have the ability to send the current code to the editor. If you had pulled this up from a file and then you wanted to look at more detail in the editor itself, you can do that here.
And then looking at the rules themselves, so you can edit the rule sets, or the rules. And finally, this functionality is also in the automation