Stored Procedure Print verbose exception

Source: Internet
Author: User

1--1. Via raise popup (used during debugging)2--2by Sqlcode, SQLERRM these two built-in variables to view, for example:3       4 DECLARE5--declaring exceptions6Some_kinds_of_err EXCEPTION; --Exception to indicate an error condition7       8V_errorcode number; --Variable to hold the error message code9V_errortext VARCHAR2 (200); --Variable to hold the error message textTen        One BEGIN A--...   ---Throw Exception -IF (...) Then--(The conditions for throwing exceptions are filled in parentheses) the RAISE Some_kinds_of_err;  - END IF;  ---...   - EXCEPTION +--Catching exceptions - When Some_kinds_of_err then +         /*Do something to Handler the errors*/   A      NULL;  at--catch other exceptions and get the content that catches the exception - When OTHERS then -V_errorcode: =SQLCODE;  -V_errortext: = SUBSTR (SQLERRM, 1, 200);  ---Note the use of SUBSTR here.  -        inDbms_output.put_line (V_errorcode | | ':: ' | |v_errortext);  - END;  to        +        -     /**   the Sqlcode is the error code . * SQLERRM is a SQL error message.   Pay attention to use substr to intercept, otherwise the output is very difficult to see.  $       Panax Notoginseng     **/  

Stored Procedure Print verbose exception

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.