Oracle PL/SQL EXCEPTION -- WHEN OTHERS THEN

Source: Internet
Author: User

WHEN handling exceptions, pay special attention to the use of when others then, because when others then will eat all the exceptions. If no information is thrown after when others then, that is, when others then null, this may greatly increase the difficulty of program troubleshooting in the future, because even if an error occurs, there is no prompt. Therefore, we need to pay special attention to the when others then. In addition to one manual search, we can also use the following command to check during compilation:

  1. Alter session set plsql_warnings ='Enable: all';

Test example:

  1. Connected to Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
  2. ConnectedAsXxpo
  3. SQL>SetServeroutput on
  4. SQL> ALTER SESSION SET plsql_warnings ='Enable: all';
  5. Session altered
  6. SQL> @"D:/test/xxpotest. plb";
  7. Package body created
  8. SQL> sho err;
  9. ErrorsForPackage body xxpo. XXPO_TEST_PKG:
  10. LINE/COL ERROR
  11. -------- Success ----------------------------------------------------------------------------------------------------------
  12. 88/13 PLW-05004: identifier LOGIsAlso declaredInSTANDARD orIsA SQL builtin
  13. 285/5 PLW-07203: parameter'X _ message'May benefit from use of the NOCOPY compiler hint
  14. 504/5 PLW-07203: parameter'X _ message'May benefit from use of the NOCOPY compiler hint
  15. 569/5 PLW-07203: parameter'X _ message'May benefit from use of the NOCOPY compiler hint
  16. 1008/14 PLW-07204: conversion away from column type may resultInSub-optimal query plan
  17. 1027/14 PLW-07204: conversion away from column type may resultInSub-optimal query plan
  18. 2027/12 PLW-07204: conversion away from column type may resultInSub-optimal query plan
  19. 1667/14 PLW-06009: procedure"SET_STG_TBL"OTHERS handler does not endInRAISE or RAISE_APPLICATION_ERROR
  20. 1716/14 PLW-06009: procedure"SET_STG_TBL"OTHERS handler does not endInRAISE or RAISE_APPLICATION_ERROR
  21. 1773/14 PLW-06009: procedure"SET_STG_TBL"OTHERS handler does not endInRAISE or RAISE_APPLICATION_ERROR
  22. 1755/14 PLW-06009: procedure"SET_STG_TBL"OTHERS handler does not endInRAISE or RAISE_APPLICATION_ERROR
  23. 1737/14 PLW-06009: procedure"SET_STG_TBL"OTHERS handler does not endInRAISE or RAISE_APPLICATION_ERROR
  24. 1789/10 PLW-06009: procedure"SET_STG_TBL"OTHERS handler does not endInRAISE or RAISE_APPLICATION_ERROR
  25. 2046/10 PLW-06009: procedure"MAIN"OTHERS handler does not endInRAISE or RAISE_APPLICATION_ERROR
  26. 1910/11 PLW-06002: Unreachable code
  27. SQL>

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.