| Oracle® PL/SQL® Interactive Workbook, Second Edition By Benjamin Rosenzweig, Elena Silvestrova | | Table of Contents | | | Appendix A. Answers to Self-Review Questions |
Lab 11.1 Self-Review Answers | | | A1: | | Questions | Answers | Comments |
|---|
| 1) | C | RAISE_APPLICATION_ERROR associates an error number with an error text. Therefore, when working with the RAISE_APPLICATION_ERROR there is no need to create an exception name. |
| | | | A2: | | Questions | Answers | Comments |
|---|
| 2) | C | RAISE_APPLICTION_ERROR has two required parameters, error_number and error_text. The keep_error is an optional parameter that is usually omitted. |
| | | | A3: | | Questions | Answers | Comments |
|---|
| 3) | A | Generally, Oracle associates negative numbers with runtime errors. For user-defined exceptions, the range of such numbers is from -20,000 to -20,999. |
| | | | A4: | | Questions | Answers | Comments |
|---|
| 4) | A | When the RAISE_APPLICATION_ERROR procedure is used, control is always passed to the host environment. For example, if an exception is raised in an inner block, it never propagates to the outer block. |
| | | | A5: | | Questions | Answers | Comments |
|---|
| 5) | C | |
| Lab 11.2 Self-Review Answers | | | A1: | | Questions | Answers | Comments |
|---|
| 1) | B | EXCEPTION_INIT pragma is a special instruction to the compiler. It allows handling of unnamed internal exceptions. Such exceptions can also be handled with the help of OTHERS. |
| | | | A2: | | Questions | Answers | Comments |
|---|
| 2) | B | Because pragma is a special instruction to the compiler, it is processed during compilation time. |
| | | | A3: | | Questions | Answers | Comments |
|---|
| 3) | C | Some Oracle errors do not have names, and as a result they cannot be referenced in a program. The EXCEPTION_INIT pragma allows you to associate an Oracle error number with a user-defined error. |
| | | | A4: | | Questions | Answers | Comments |
|---|
| 4) | C | In order to associate an Oracle error with a user-defined exception, the EXCEPTION_INIT pragma requires both error number and name. |
| | | | A5: | | Questions | Answers | Comments |
|---|
| 5) | C | Error_number is a numeric parameter and should contain any valid Oracle error number; 'ORA' is not a part of an error number. |
| Lab 11.3 Self-Review Answers | | | A1: | | Questions | Answers | Comments |
|---|
| 1) | A | |
| | | | A2: | | Questions | Answers | Comments |
|---|
| 2) | A | |
| | | | A3: | | Questions | Answers | Comments |
|---|
| 3) | C | |
| | | | A4: | | Questions | Answers | Comments |
|---|
| 4) | C | |
| | | | A5: | | Questions | Answers | Comments |
|---|
| 5) | B | When no exception is raised, the SQLCODE function returns 0. When there is a NO_DATA_FOUND exception, SQLCODE function returns 100. |
| |
|
| |