Oracle PL/SQL Best Practices, Second Edition
By
Steven Feuerstein
October 2007
Pages: 292
| Table of Contents
| Index
| Sample Chapter
| Colophon
Table of Contents
-
Chapter 1 The Big Picture
-
Successful Applications Are Never an Accident
-
Best Practices for Successful Applications
-
Software is like ballet: choreograph the moves or end up with a
mess.
-
Deferred satisfaction is a required emotion for best
practices.
-
Contracts work for the real world; why not software, too?
-
Don't act like a bird: admit weakness and ignorance.
-
Five heads are better than one.
-
Don't write code that a machine could write for you
instead.
-
We need more than brains to write software.
-
Chapter 2 Real Developers Follow Standards
-
Best Practices for Developing and Using Standards
-
It's a free country; I don't have to use carriage returns in my
code.
-
Too much freedom is a very bad thing.
-
Good names lead to good code.
-
Put your checklists into your code.
-
Who needs comments? My code is self-documenting!
-
Chapter 3 Life After Compilation
-
Testing, Tracing, and Debugging
-
Best Practices for Testing, Tracing, and Debugging
-
Thanks, but no thanks, to DBMS_OUTPUT.PUT_LINE!
-
Assume the worst, and you will never be disappointed.
-
Users really don't want to be programmers.
-
Do you take road trips without a destination in mind?
-
For every test you can think of, there are 10 tests waiting to be
performed.
-
Sherlock Holmes never had it so good.
-
Chapter 4 What's Code Without Variables?
-
Best Practices for Declaring Variables and Data
Structures
-
That column's never going to change!
-
There's more to data than columns in a table.
-
I take exception to your declaration section.
-
Best Practices for Using Variables and Data Structures
-
This logic is driving me crazy!
-
Go ahead and splurge: declare distinct variables for different
usages.
-
Didn't your parents teach you to clean up after yourself?
-
Programmers are (or should be) control freaks.
-
Best Practices for Declaring and Using Package Variables
-
Danger, Will Robinson! Globals in use!
-
Packages should have a strong sense of personal space.
-
Chapter 5 Developer As Traffic Cop
-
Best Practices for Conditional and Boolean Logic
-
Reading your code should not require mental gymnastics.
-
KISS (Keep it Simple, Steven).
-
Beware the hidden costs of NULL.
-
Best Practices for Loop Processing
-
There's a right way and a wrong way to say goodbye.
-
Don't take out "programmers' insurance" . . . and don't worry
about SkyNet.
-
There is more than one way to scan a collection.
-
Best Practices for Branching Logic
-
Maze-like programs are never a good thing.
-
Chapter 6 Doing the Right Thing When Stuff Goes Wrong
-
Best Practices for Understanding Error Handling
-
Ignorance is bad exception management.
-
All exceptions are not created equal.
-
One error management approach for all.
-
Best Practices for Nitty-Gritty, Everyday Exception
Programming
-
Your code makes me feel dumb.
-
Avoid programmer apathy.
-
Best Practices for Coding Defensively
-
You weren't supposed to do that with my program!
-
Chapter 7 Break Your Addiction to SQL
-
SQL Is Bad!
-
General SQL Best Practices
-
The best way to avoid problematic code is to not write
it.
-
You may write PL/SQL code, but SQL always takes
precedence.
-
When one transaction is not enough.
-
I don't always want to save my changes.
-
Best Practices for Querying Data from PL/SQL
-
It's always better to fetch items into a single basket.
-
Answer the question being asked; that is, be a good
listener.
-
Your code makes my head spin.
-
Best Practices for Changing Data from PL/SQL
-
Assume the worst!
-
Things only get more complicated over time.
-
Timing is everything in the world of cursors.
-
Best Practices for Dynamic SQL
-
Make it easy to untangle and debug your dynamic SQL
statements.
-
Give the RDBMS a break.
-
So you think you know what users might do with your code?
-
It's rude to drop someone else's objects.
-
Chapter 8 Playing with Blocks (of Code)
-
Best Practices for Parameters
-
Once a program is in use, you can't change it
willy-nilly.
-
What the heck do those parameter values mean?
-
Where'd that data come from?
-
Best Practices for Procedures and Functions
-
Write tiny chunks of code.
-
Every program should be an island (of purpose).
-
Gifts should always come tightly wrapped.
-
One way in, one way out: multiple exits confuse me.
-
Black or white programs don't know from NULL.
-
Best Practices for Packages
-
Where there is one program, there will soon be two.
-
"Easy to use code" is code that is used—and reused.
-
Best Practices for Triggers
-
Uncertainty in trigger execution is a most unsettling
emotion.
-
"One-stop triggering" is so much easier to understand and
maintain.
-
Your application should not be able to perform a "Houdini" with
business rules.
-
Chapter 9 My Code Runs Faster Than Your Code
-
Best Practices for Finding Slow Code
-
Take the guesswork out of optimization.
-
There are so many ways to implement an algorithm; which is
best?
-
Best Practices for High-Impact Tuning
-
Let Oracle do most of the tuning for you.
-
Who has time for querying (or inserting or deleting or updating)
one row at a time?
-
If the SGA is so wonderful, why not emulate it?
-
When waiting is not an option...
-
Best Practices for Other Tuning
-
Sometimes "safe programming" is a little too slow.
-
PL/SQL loops should not resemble hamsters running in
circles.
-
Tailor-made datatypes are the best fit for your programs.
-
Appendix Best Practices Quick Reference
-
Appendix Resources for PL/SQL Developers
-
Book Example Files
-
Books and Other Content
-
Free Software
-
Colophon
Return to Oracle PL/SQL Best Practices