As an Oracle developer you are working with a lot of lines of code.  Some that you have written and some that you have inherited but are now responsible for.

How do you document your work and decipher the code that you are working on?  Yes you can use a VCS, and Toad for Oracle works with several, to track the changes you have made to your code but how do you keep track of the objects you are using?

By using Toad’s Code Road Map feature.

For this blog I have opened a package named orastress:

It is a fairly simple package that makes calls to a couple of functions and a half dozen procedures. 

Now let’s see what database objects are being used by this package. You can do this by right-clicking on the package name and choosing “Code Road Map”.

Toad will then read your code and match it to the database objects being called and present you with an ERD style display of your code:

Now you have a diagram that shows you all of the objects used by your code.  In this case we have 9 tables and 10 dependencies.

On the right-side you can see a diagram that shows these relationships.  The more objects you have, the busier the screen but you can resize the screen to view it better:

I have increased the view from size 24 to size 65 and now it is easier to read. 

Double-clicking on any of the objects will open that object in its own window so you can see all of the details about that object.  Below is a view of the Customer table after I double-clicked on it:

If you recall from above there are 9 tables accessed by this package and they are all listed in a single Workspace. 

But what if you want to break the diagram up into smaller logical segments?  You can easily do that by adding another workspace to the diagram.

Here I have selected 2 tables, Orders and Order_line, and did a right mouse click to open this menu:

I will choose Workspace 1 but you can add a new workspace if you wish.

Now I have an additional workspace that only contains the Orders and Order_line tables.  You can create as many workspaces as you need.  This helps you break up a larger diagram into smaller logical pieces for viewing.

All of these new workspaces are still related to the original workspace so you are not removing anything from the ‘master’ view.

There are a couple more features I want to show that will help with the documentation process. 

You can add a Diagram Title that you enter in pertinent information to document this diagram:

This Title box gets added into the diagram and is clearly visible in the diagram.  It can be edited for updates as you are making changes to the diagram as well.

You can also create an HTML report of the Code Road Map.  Once created you can share this document with your teammates and now everyone can understand what is being used by this piece of code:

There are several other features you can use in the Code Road Map utility to help enhance your experience and I will leave it to you to explore these as you start using the Code Road Map feature.

Hopefully this blog will pique your curiosity about this feature and maybe even get you to explore more of the features in Toad that you may have overlooked.

Of course, you can always ask more questions on the Toad World forums and I, and the Toad community will gladly help you.

 

-Mark Kurtz