CARVIEW |
Oracle PL/SQL Best Practices, Second Edition
Write the Best PL/SQL Code of Your Life
- By
- Steven Feuerstein
- Publisher:
- O'Reilly Media
- Released:
- October 2007
- Pages:
- 304
Product Editions
- Oracle PL/SQL Best Practices, Second Edition - October 2007
- Oracle PL/SQL Best Practices - April 2001
Oracle PL/SQL Best Practices summarizes PL/SQL best practices in nine major categories: overall PL/SQL application development; programming standards; program testing, tracing, and debugging; variables and data structures; control logic; error handling; the use of SQL in PL/SQL; building procedures, functions, packages, and triggers; and overall program performance.
In this compact book, Steven Feuerstein, widely recognized as one of the world's leading experts on the Oracle PL/SQL language, distills his many years of programming, teaching, and writing about PL/SQL into a set of best practices-recommendations for developing successful applications. Covering the latest Oracle release, Oracle Database 11g, Feuerstein has rewritten this new edition in the style of his bestselling Oracle PL/SQL Programming. The text is organized in a problem/solution format, and chronicles the programming exploits of developers at a mythical company called My Flimsy Excuse, Inc., as they write code, make mistakes, and learn from those mistakes-and each other.
This book offers practical answers to some of the hardest questions faced by PL/SQL developers, including:
- What is the best way to write the SQL logic in my application code?
- How should I write my packages so they can be leveraged by my entire team of developers?
- How can I make sure that all my team's programs handle and record errors consistently?
This book is a concise and entertaining guide that PL/SQL developers will turn to again and again as they seek out ways to write higher quality code and more successful applications.
"This book presents ideas that make the difference between a successful project and one that never gets off the ground. It goes beyond just listing a set of rules, and provides realistic scenarios that help the reader understand where the rules come from. This book should be required reading for any team of Oracle database professionals."
--Dwayne King, President, KRIDAN Consulting
-
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

- Title:
- Oracle PL/SQL Best Practices, Second Edition
- By:
- Steven Feuerstein
- Publisher:
- O'Reilly Media
- Formats:
-
- Ebook
- Safari Books Online
- Print Release:
- October 2007
- Ebook Release:
- February 2009
- Pages:
- 304
- Print ISBN:
- 978-0-596-51410-5
- | ISBN 10:
- 0-596-51410-7
- Ebook ISBN:
- 978-0-596-10273-9
- | ISBN 10:
- 0-596-10273-9
-
Steven Feuerstein
Steven Feuerstein is considered one of the world's leading experts on the Oracle PL/SQL language. He is the author or coauthor of Oracle PL/SQL Programming, Oracle PL/SQL Best Practices, Oracle PL/SQL Programming: Guide to Oracle8i Features, Oracle PL/SQL Developer's Workbook, Oracle Built-in Packages, Advanced Oracle PL/SQL Programming with Packages, and several pocket reference books (all from O'Reilly & Associates). Steven is a Senior Technology Advisor with Quest Software, has been developing software since 1980, and worked for Oracle Corporation from 1987 to 1992.
The animal on the cover of Oracle PL/SQL Best Practices, Second Edition, is
a red wood ant. Red wood ants (Formica aquilonia) are often the dominant
ants of forests throughout the northern hemisphere. F. aquilonia can build
nest mounds of dried spruce needles and twigs that are three feet or more in
diameter and height. Each nest can contain thousands of ants as well as
several queens. The insects have no sting but can defend themselves by
firing formic acid from their rear ends when disturbed.
The workers vary in size up to about half an inch in length with a red thorax,
black abdomen, and red and black marked head. The ants are both scavengers
and general predators of insects, carrying many soft-bodied caterpillars,
flies, and sawflies along their several major trails back to the nest.
Red wood ants are a keystone species (i.e., without them the ecosystem
changes fundamentally). When red ants disappear from a system, herbivorous
insects can subsequently damage forest trees. In forests weakened by
pollution and acid rain in central Europe, red wood ant populations are
often endangered, which in turn causes further imbalances in predator-prey
dynamics and the ecosystem. These rare ants are protected by law in some
European countries because of their great value in destroying forest pests.
For 28 years, Professor Seigo Higashi has been studying a supercolony of
Japanese red wood ants (Formica yessensis), which dwell along a strip of
shoreline on the Ishikari coast of northern Japan. When first discovered in
1973, the colony consisted of approximately 45,000 nests with connecting
tunnels extending nearly 12.4 miles along the shore of the Japan Sea. It was
estimated that the colony had about 306 million workers and 1.1 million
queens, and is thought to be about 1,000 years old. Since 1973, the colony
has been under siege, threatened by the development of infrastructure for a
new port on Ishikari Bay, which has occurred on top of 30 percent of the ant
megalopolis. This has reduced the number of red wood ants living there by
more than half.
The Ishikari ants are one of only two known ant supercolonies in the world.
The other, smaller one is in the Swiss Jura mountains.
![]() ©2010, O'Reilly Media, Inc. (707) 827-7000 / (800) 998-9938 All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners. |
About O'Reilly
Academic Solutions Authors Contacts Customer Service Jobs Newsletters O'Reilly Labs Press Room Privacy Policy RSS Feeds Terms of Service User Groups Writing for O'Reilly |
Content Archive Business Technology Computer Technology Microsoft Mobile Network Operating System Digital Photography Programming Software Web Web Design |
More O'Reilly Sites
O'Reilly Radar Ignite Tools of Change for Publishing Digital Media Inside iPhone makezine.com craftzine.com hackszine.com perl.com xml.com Partner Sites InsideRIA java.net O'Reilly Insights on Forbes.com |