Oracle Stored Procedure Error Tracking (saving error row numbers, error codes, error messages)

Source: Internet
Author: User


Oracle Stored Procedure Error Tracking (saving error row numbers, error codes, error messages) 1. create table 1 create table TBL_PROC_ERRMSG2 (3 BIZ_CODE VARCHAR2 (50), 4 ERR_LINE VARCHAR2 (10), 5 ERR_CODE VARCHAR2 (10 ), 6 MSG VARCHAR2 (200), 7 CRT_TM date default SYSDATE8 www.2cto.com); 2. 01 create or replace procedure PROC_SAVE_ERRMSG (bizcode in VARCHAR2, 02 errorline in VARCHAR2, 03 errorcode in VARCHAR2, 04 msg in VARCHAR2) IS05/* must use autonomous transactions, otherwise commit will affect the calling program transaction */06 PRAGMA AUTONOMOUS_TRANSACTION; 07BEGIN08 insert into partition (BIZ_CODE, ERR_LINE, ERR_CODE, MSG) 10 VALUES11 (BIZCODE, ERRORLINE, ERRORCODE, MSG); 12 www.2cto.com COMMIT; 13END; 3. use Example 1 -- the Stored Procedure implements subject 2EXCEPTION3 when others THEN4 PROC_SAVE_ERRMSG (biz_code/* this variable is used to find error record mark */, DBMS_UTILITY.format_error_backtrace, sqlcode, SQLERRM;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.