PL/SQL Exception Handling exercises: Handle Common Exceptions in PL/SQL
PL/SQL Exception Handling [ 16 exercises with solution ]
1. Write a PL/SQL block to handle the exception when a division by zero occurs.
2. Handle the NO_DATA_FOUND exception when retrieving a row from a table and no matching record is found.
3. Handle the TOO_MANY_ROWS exception when retrieving multiple rows instead of a single row from a table.
4. Handle the INVALID_NUMBER exception when converting a non-numeric value to a number.
5. Handle the DUP_VAL_ON_INDEX exception when inserting a duplicate value into a table with a unique constraint.
6. Handle the VALUE_ERROR exception when assigning an incompatible value to a variable.
7. Handle the PROGRAM_ERROR exception when a PL/SQL program encounters an internal error.
8. Handle the CURSOR_ALREADY_OPEN exception when trying to open a cursor that is already open.
9. Handle the INVALID_CURSOR exception when referencing an invalid or closed cursor.
10. Handle the COLLECTION_IS_NULL exception when trying to access elements from a NULL collection.
11. Handle the CASE_NOT_FOUND exception when no branch matches the value of a CASE statement.
12. Handle the INVALID_TRANSACTION exception when a transaction is in an invalid state.
13. Handle the SUBSCRIPT_BEYOND_COUNT exception when accessing an array element beyond its declared size.
14. Handle the ROWTYPE_MISMATCH exception when assigning values to variables of incompatible row types.
15. Handle the ACCESS_INTO_NULL exception when trying to access a NULL record.
16. Handle the NO_DATA_NEEDED exception when a query retrieves more data than required.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/plsql-exercises/exception-handling/index.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics