Sqlcode and sqlerrm

Source: Internet
Author: User

 

The built-in Oracle functions sqlcode and sqlerrm are especially used in the others processor to return the Oracle error code and error messages respectively.

The others processor should be the final exception processor in the exception processing block because it is used to capture all Oracle exceptions except for Exception Processing by other exception processors, so using an others processor at the outermost layer of the program ensures that all errors are detected.

In an internal exception, sqlcode returns the Oracle error serial number, while sqlerrm returns the corresponding error message. The error message first displays the error code. Sqlcode returns a negative number, unless the Oracle error is "ORA-01403: No data found" (translated: ORA-01403: No data found), when the Oracle error is "ORA-01403: No data found, the corresponding sqlcode is + 100. For user-defined exceptions, sqlcode returns + 1, while sqlerrm returns user-defined exception.

An Oracle error message can contain up to 512 bytes of error code. If no exception is triggered, sqlcode returns 0, sqlerrm returns "ORA-0000: Normal, successful completion ".

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.