I have been asked to write a document spelling out exactly how we will write PL/SQL for our data warehouse application. I was thinking about recommending the use of inheritance in PL/SQL for error handling, possibly the execute immediate statments, and anything else where we want to keep the logic in one central place.
Does anyone have any thoughts on using inheritance in PL/SQL? Does anyone have any thoughts about creating a centralized error handler with or without using inheritance?
Inheritance with respect to error handling? That will be quite a paper considering inheritance (with encapsulation and polymorphism being the other hallmarks of object-oriented programming) has more to do with data structures as opposed to being used as an error handling mechanism. What properties will the error inherit from a parent error? The fact that it is an error?
Errors - you have Oracle pre-defined, and user defined (error codes in the -20000 to -20999 range and named programmer-defined exceptions). You/Oracle can propagate errors. How do you see an error inheriting properties?
You are right of course. I was thinking of Java. In Java you can create a class with methods, properties etc. and inherit from that. Mostly I'm just trying to look at what is being done already for coding standards and come up with some new ones. I believe that we should use a common code base for all of our packages and stored procedures so that we don't keep reinventing the wheel, and so that the code can more easily adapt to changes in our business rules and changes in the way Oracle works from one version to another. So one of things that I want to look at is making all of the error hanleding go through one package.