O'Reilly logo

Oracle PL/SQL Best Practices by Steven Feuerstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Structure of This Book

Oracle PL /SQL Best Practices is composed of nine chapters and one appendix. Each chapter contains a set of best practices for a particular area of functionality in the PL/SQL language. For each best practice, I’ve provided as many of the following elements as are applicable:


A single sentence that describes the best practice and provides an identifier for it in the form XXX-nn (where XXX is the type of best practice—for example, EXC for exception handling—and nn is the sequential number within this set of best practices); see Section P.4 for how to use this identifier online. I have, whenever possible, sought to make this title stand on its own. In other words, you should be able to glance at it and understand its impact on how you write code. This way, after you’ve read the entire best practice, you can use Appendix A to instantly remind you of best practices as you write your code.


A lengthier explanation of the best practice. It’s simply not possible to cover all the nuances in a single sentence!


We learn best from examples, so just about every best practice illustrates, through code and/or anecdote, the value of the best practice. Whenever it makes sense, I put the example code in a file that you can use (or learn from) in your own programming environment. You’ll find these files on the O’Reilly web site (see Section P.4 later in this Preface).


Why should you bother with this best practice? How crucial is it for you to follow this particular recommendation? This section offers a quick review of the main benefits you will see by following the best practice.


Wouldn’t it be great if we lived in a world in which following a best practice was all-around easier than the “quick and dirty” approach? That is, unfortunately, not always the case. This element warns you about the challenges, or drawbacks, you might face as you implement the best practice.


In the world of the Internet, everything is connected; no programmer stands alone! This section recommends resources, ranging from books to URLs to files containing code, that you can use to help you successfully follow this best practice. Where filenames are shown in this section, they refer to files available on, or referenced by, the O’Reilly web site.

Here are brief descriptions of the chapters and appendix:

Chapter 1 steps back from specific programming recommendations. It offers advice about how to improve the overall process by which you write code.

Chapter 2 offers a series of suggestions on how to format and organize your code so that it is more readable and, therefore, more maintainable.

Chapter 3 takes a close look at how you ought to declare and manage data within your PL/SQL programs.

Chapter 4 is a “back to basics” chapter that talks about the best way to write IF statements, loops, and even the GOTO statement! Sure, these aren’t terribly complicated constructs, but there are still right and wrong ways to work with them.

Chapter 5 covers another critical aspect of robust application development: exception handling, or what to do when things go wrong.

Chapter 6 focuses on the most crucial aspect of PL/SQL development: how you should write the SQL statements in your programs.

Chapter 7 offers advice on how best to build your procedures, functions, and triggers—the program units that contain your business logic. It also includes best practices for parameter construction.

Chapter 8 steps back from individual program units to present recommendations for packages, the building blocks of any well-designed PL/SQL-based application.

Chapter 9 focuses on how to take best advantage of a few of the most often used of the packages provided to us by Oracle Corporation.

Appendix A compiles the best practice titles across all the chapters into a concise resource. Once you have studied the individual best practices, you can use this appendix as a checklist, to be reviewed before you begin coding a new program or application.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required