Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Capturing ORA errors and inserting into a table.
Hello,
In the exception;
First Way: Read the ora-error with Substr(Sqlerrm,1,100) and move this to a variable. Then simply code an Insert statement.
Second Way: Or you may create a procedure with some parameters which inserts to the error table and then you may call this procedure within the exception.(Of course sending "Substr(Sqlerrm,1,100)" as parameter)
Regards
M.Emre HANCIOGLU
Masterfoods Services GmbH
ISI Application Support
Tel : +49 2162 500-576
Fax: +49 2162 41497
E-Mail: emre.hancioglu_at_eu.effem.com
Denham Eva <EvaD_at_tfmc.co.za>
tfmc.co.za
Sent by: root_at_fatcity.com
08.05.02 12:33
Please respond to ORACLE-L
To:
Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
cc:
Subject:
Capturing ORA errors and inserting into a table.
Hello List
Hope someone can help.
Trying to write a procedure where an event, such as a insert or update is
done.
However I would like to capture any oracle error (ORA-......) that is
generated, into a table for instance..
i.e.
DECLARE
somevars VARCHAR2(10);
BEGIN
SELECT stuff INTO somevars FROM testtbl; BEGIN INSERT INTO anothertbl (col1) VALUES(somevars); EXCEPTION WHEN OTHERS *take oracle ORA error and do something* *like insert it into a error table. Not just Output to screen.* END;
#####################################################################################This e-mail message has been scanned for Viruses and Content and cleared by MailMarshal
#####################################################################################
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Denham Eva INET: EvaD_at_TFMC.co.za Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-LReceived on Wed May 08 2002 - 07:03:37 CDT
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: emre.hancioglu_at_eu.effem.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).