Re: newbie needs error handling help

From: <pberetta_at_my-deja.com>
Date: Tue, 07 Dec 1999 01:13:10 GMT
Message-ID: <82hmv3$a31$1_at_nnrp1.deja.com>


Mitch,

Try what I plugged in below. the WHEN OTHERS is Oracle's catchall exception handler, the MESSAGE formats your %rowtype variable for display and displays it, the RAISE Form_Trigger_Failure exits the trigger with the exception.
Hope this helps,
Paul

In article <82grvl$l8o$1_at_nnrp1.deja.com>,   mitch23_at_hotmail.com wrote:
> I am trying to debug the attached function. When I run it, I get an
> ORA-06512 error. I'd like to find out what the value of the cursor is
> when this error occurs, so I added an EXCEPTION handler to trap the
> error and then display the contents of the cursor at that point (to
> assist me in debugging the error)
>
> Anyway, when I try to create the function, it is created with
> "compilation errors". I'm assuming this is due to the error handling
> code
> I added, since the function was created without errors before I added
> it.
>
> ----------------------------------------------------------------------
-
> CREATE OR REPLACE FUNCTION CONCAT_PROBLOGUPD(P_NUMBERPRGN IN VARCHAR2)
> RETURN VARCHAR2
> AS
> CURSOR C_STR(IN_NUMBERPRGN IN VARCHAR2) IS
> SELECT UPDATE_ACTION LOGUPD FROM HFS_PROBLEM_UPDATEACTION
> WHERE NUMBERPRGN = IN_NUMBERPRGN ORDER BY RECORD_NUMBER;
> --
> STR_REC C_STR%ROWTYPE;
> TEMP RAW(2000):=NULL;
> RCNT NUMBER := 0;
> BEGIN
> DECLARE numeric_error EXCEPTION;
> PRAGMA EXCEPTION_INIT(numeric_error, -6512);
> OPEN C_STR(P_NUMBERPRGN);
> LOOP
> FETCH C_STR INTO STR_REC;
> EXIT WHEN C_STR%NOTFOUND;
> TEMP := TEMP||STR_REC.LOGUPD;
> END LOOP;
> --
> RETURN TEMP;
> EXCEPTION
> <----need code here to display cursor contents

    WHEN OTHERS

      MESSAGE('Cursor contents: ' || str_rec.col1 || ' -- ' ||
      RAISE Form_Trigger_Failure;

str_rec.col2 <---- keep going till entire cursor displayed);
> END;
> /
>
> ----------------------------------------------------------------
> Thanks for any help.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Dec 07 1999 - 02:13:10 CET

Original text of this message