O'Reilly logo

Advanced Oracle PL/SQL Programming with Packages 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

15.2. Displaying Compile Errors

The err procedure of the PLVvu package offers a very useful alternative to the SQL*Plus SHOW ERRORS command. The header for this procedure is:

PROCEDURE err 
   (name_in IN VARCHAR2 := NULL, overlap_in IN INTEGER := overlap);

You provide the name of the program unit for which you want errors displayed and the err procedure not only displays all errors found in the USER_ERRORS view, but it also shows you exactly which lines of code are causing the problem. The second argument specifies the numbers of lines of code to display around the line with the compile error. The default value is the value set by the set_overlap procedure (described in a later section).

If you do not supply a program name, PLVvu.err will show you the compile errors for the most recently-compiled program unit. It determines this information by searching for the object in ALL_OBJECTS whose last_ddl_time equals the MAX (last_ddl_time).

The format for specifying a program unit is explained fully in Chapter 11. Briefly, you can supply only the name, the type:name (as in "b:PLVio" for the body of the PLVio package), or even the type:schema.name (as in "s:scott.showemps" to see the specification of the showemps package owned by SCOTT).

The err procedure tries to be smart about displaying the surrounding lines of code. Suppose, for example, that you have errors on two consecutive lines (318 and 319) and you have specified 10 lines of overlap. You would not want to see lines 309 through ...

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