O'Reilly logo

Oracle PL/SQL For Dummies by Paul Dorsey, Michael Rosenblum

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

Chapter 16

Ten Common Mistakes to Avoid in PL/SQL

In This Chapter

bullet Recognizing bad exception handling

bullet Controlling conditions, cursors, and loops

bullet Reusing code effectively

bullet Writing code that’s easy to read and maintain

No matter how hard programmers try to make their code error free, they’re still human, and every system includes code that contains mistakes. In addition to simple mistakes in coding, some global mistakes are common among inexperienced programmers. To help you recognize these problems and get up to speed with PL/SQL more easily, this chapter describes ten of the most important mistakes to avoid when writing PL/SQL.

Catching an Exception with WHEN OTHERS THEN NULL

Never catch an unidentified exception without logging information about it. Chapter 15 mentions that the exception handler WHEN OTHERS is extremely useful, but it can also be the source of the most dangerous line of code that can exist in PL/SQL, as shown here:

begin

    ...

exception

when others then

null;

end;

Unless you’re in the debugging or development mode, never use an exception handler like ...

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