• Post author:
  • Post category:All
  • Reading time:2 mins read

In this blog I will give you a tip to how to find error line number in PL/SQL program easily. Suppose you have a lengthy PL/SQL procedure or function which might be a standalone or inside a package and while executing, it is throwing an exception / error.

Advertisement

And because exception is also being handled properly in that PL/SQL program, so what happening is when it is giving an error, it is being handled by exception and showing the line number of that exception part of PL/SQL program, which is written at the end of the program. Below is the sample PL/SQL procedure illustrating this.

Create or Replace Procedure xyz
is
Begin
-- many code lines
--
--
--
Exception
When Others then
-- your custom exception handler
End;

Advertisement

In that case it is hard to find error line number in PL/SQL program, which is actually creating the problem. To find this you need to just comment that exception part temporarily and compile that procedure / function or package and execute again to get the actual error with exact line number of PL/SQL program.

Below is the example:

Create or Replace Procedure xyz
is
Begin
-- many code lines
--
--
--
/* Exception
When Others then
-- your custom exception handler */
End;

Advertisement

After getting the error information and line number, don't forget to un-comment that exception part and compile again, so that it should be in its original state.

This will definitely help to find error line number in PL/SQL.

Related:  How To Run Previous Commands In Linux/Unix Shell

Vinish Kapoor

An Oracle Apex Consultant, Oracle ACE, and founder of foxinfotech.in and orclqa.com a question and answer forum for developers.

This Post Has One Comment

  1. Mahesh

    HOW TO FIND ERROR LINE NUMBER IN PL/SQL....Can you show me a complete example to find an exact error line number....

Comments are closed.