How to locate the error row in Oracle

Source: Internet
Author: User

-- The location where exceptions and exceptions are captured in Oracle can be used to debug stored procedures, especially for a long time.
DECLARE
V_RATE NUMBER; -- Ratio
V_RETINFO VARCHAR2 (2000); -- exception information
BEGIN

SELECT 120/0 INTO V_RATE from dual;

-- Exception Handling
EXCEPTION WHEN OTHERS THEN
V_RETINFO: = SQLERRM | CHR (10) | SUBSTR (DBMS_UTILITY.FORMAT_ERROR_BACKTRACE,); -- Obtain the exception information and the initial location of the exception thrown [row]
DBMS_OUTPUT.PUT_LINE (V_RETINFO );
END;
Run the above Code in pl/SQL developer to view the output
 
ORA-01476: divisor is equal to zero
ORA-06512: at line 6

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.