Re: Determining the position of an error at run-time

From: Jeffery Cann <jcann_at_fairway.com>
Date: 1998/03/26
Message-ID: <351A6AF9.B4E94F8A_at_fairway.com>#1/1


Wido Riezebos wrote:
>
> Can I (and when yes how), determine the line where an error/exception took
> place in PL/SQL AT RUN TIME?
> I want to log the right position of an error, and re-raise the exception
> that was caught. The problem is that re-raising an exception get's rid of
> the line number of the causing statement.

We use a local variable to mark the segment of the code and then if an exception is raised, we pass the segment back to the caller for logging. We call the variable 'segment'. It may be more readable to use VARCHAR strings as the data assigned to segment variable.

BEGIN
  segment := 001; /* set position in code */

  /***************************************/
  /* create temporary reservation number */
  /***************************************/
  SELECT TEMP_RESERVATIONS_SEQ.NEXTVAL
  INTO trs_res_id
  FROM DUAL;
  segment := 002; /* set position in code */

>
> Is there an error stack I can examine?

I don't know. If you find one, let me know!

Jeff

-- 
Jeffery C. Cann
Senior Software Engineer
Fairway Systems, Inc.
Received on Thu Mar 26 1998 - 00:00:00 CET

Original text of this message