Toad World® Forums

Code Analysis Rules documentation (XPath Expression)

I am trying to create a rule to search the procedures and functions within a package for EXCEPTION handling.
Question 1: Can anyone tell me where to find documentation on how to manipulate an XPath Expression?
Question 2: Can anyone offer any advice to developing a rule to check for the existence of EXCEPTION handling?

Hello nhilo32,

If you tell me exactly what you want then I'll be happy to write a rule for you. Only condition would be that we're allowed to include it in our standard catalog.



Deal? Absolutely! and Thank-you very much in advance.

I have a large number of packages across several projects that I need to sort through. One of the things I need to determine is which of the procedures and functions in these packages do not have an EXCEPTION handling block in them. I am trying to write a rule to help me do this.

Also, in the interest of not have to bother you guys in the future, if you could point me toward the documentation of how XPath works in Toad that would also be VERY helpful. Or if you could explain how your rule works, that would also be very helpful. Although I did see on another post that one of you guys mentioned that such documentation was for internal use only.

Anyway, thank-you again for your help and quick response.

was for internal use only

There's more to it than just a simple "decision" such as it would be internal only. For now let's put aside Quest's vision on those things for a while.

There are two components: a/ the parse information and its XML structure, and b/ the XPath engine working on the virtual XML (there's no physical XML indeed) and for which you'd write expressions.

Both components are very well documented in house. The doc for the parse information is automatically generated and 100% correct, always in sync with any version of the parser library (qp5.dll). The doc for the XPath grammar is static (wiki pages) and we could make it available on some site. Our XPath is a subset of 2.0 enriched with proprietary syntax and functions.

In the recent past we devs were a little reluctant to publish stuff as it was under growth and evolution. Today things have stabilized.

We also have always supported user defined rules (in the 7000-9999 space), probably limited to copy-and-tweak for now. We'll sure continue to support that.

This brings us back to Quest's vision. Does their product management find it an opportunity to add that functionality to Toad? There hasn't been a big demand so far, but who knows. And the topic was probably never raised...

Hope this gives some insight - and anyone who's reading this, feel free to respond!


Did you mean that a procedure or function passes as soon as there is AT LEAST ONE exception handler in it?

yes, as long as there is one exception handler in the proc/func it would pass the test. Meaning that if there were a package with 4 procs in it and 3 of those procs had at least one exception handler then I would want the one that did not have an exception handler to generate a warning.


Thanks for the info. If you guys decide to make the XPath grammer public please let me know where you decide to publish it. Perhaps github or email me :slight_smile:
Anyway, thanks again

If we ever publish it then it will be as part of the Toad distribution.

About the expression, well, please have a try with this one, to start with:


It will squiggle or list the procedure/function names.

It means: find all package bodies in the file (ok, normally one), then find all child procedures and functions which do NOT have an exception block child element, and of those found list the qualified name. :slight_smile: