Oracle PL/SQL Best Practices
Steven Feuerstein
O’Reilly – 2nd Edition
http://www.oreilly.com/catalog/9780596514105/index.html
This is a great reference for PL/SQL Programmers. The book covers most aspects of PL/SQL code from start to finish. The style used is somewhat narrative and even entertaining. The author lists several pitfalls in each chapter. The “pitfall story” talks about why programmers might write sub-optimal code in the first place, how to recognize the problem, what is the root cause of the problem, and how to fix the problem. Each example lists code with the issue in place and then the “patched” code after the best-practice has been implemented. Most of the example center around a database at the fictional company used to tell the stories, but the examples are forms of common issue found in most any Oracle database.
The reference does not teach the SQL language itself outside the context of PL/SQL programming. It does cover how to write better SQL in some cases and gives advice on encapsulation of SQL, packaging SQL, and auto-generating SQL. Also, best practices for how to use SQL are covered.
By following the guidelines, PL/SQL code would be easier to maintain and debug, especially for someone who did not write the code or for the developer who has not looked at the code in a while. Also, the “best practice” code had better security feature although the author does not cover security extensively. Some of the examples of “in-application” SQL would be vulnerable to SQL injection attacks and the recommendation by the author to encapsulate the SQL into procedures or packages mitigates this risk. The best-practice code runs more efficiently in most cases as well.
Chapters generally cover:
Overall best programming practices
Standards
Testing
Variables
Loops and Branches
Error Handling
Encapsulation of SQL
Functions and Procedures
Performance
This is an excellent reference for those who program PL/SQL.
|