Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

developed. The following two blocks contain a variety of exception handlers. Exp

ID: 3757446 • Letter: D

Question

developed. The following two blocks contain a variety of exception handlers. Explain tho different types for the new employee. A new part-time programming employee has been reviewing some P/SQL code Block 1: DECLARE ex_prod_update EXCEPTION; BEGIN UPDATE bb product SET description - 'Mill grinder with 5 grind settings! WHERE idProduct = 30; iF SQL%NOTFOUND THEN RAISE ex_prod_update END IF; EXCEPTION WHEN ex_prod_update THEN DBMS OUTPUT.PUT_LINE('Invalid product ID entered'); END; Block 2 DECLARE TYPE type basket IS RECORD (basket bb basket.idBasket TYPE created bb-basket. dt created%TYPE,

Explanation / Answer

Here you go as requested I have provided a detailed description of the exceptions in the above added code.

If there is any further query kindly add it as a comment.


***************************************Description for Block 1***********************************

General Description of the PLSQL code written in Block 1

Here in this block the user is trying to update the description of a product whose id is 30 in bb_product.
If the productid 30 is not found in bb_product (if SQL%NOTFOUND) then a user defined exception with the name ex_prod_update is thrown.
The definition of this exception is provided under the EXCEPTION block.
Where a string is printed stating "Invalid product ID entered"

***************************************Description for Block 2***********************************

General Description of the PLSQL code written in Block 2

Here in this block the user is trying to read the idBasket, dtcreated, quantity, subtotal from bb_product where the idShopper=26 and orderplaced =0.
If the above query is not satisfied and no data is found for that particular shopper id then NO_DATA_FOUND exception is thrown
The definition of this exception is provided under the EXCEPTION block.
Where a string is printed stating "You have no saved baskets!"
If any other condition is not met in the above query then the exception thrown is catched by the deafult WHEN OTHERS THEN exception.
This exception handles all the default exceptions thrown by the code.
Where a string is printed stating "A problem has occured."
"Tech Support will be notified and will contact you via e-mail."

**************************************************************************************************
In general there are two types of exceptions:
1. User defined
2. System defined

There are multiple other exceptions that can be used for instance:
1. PROGRAM_ERROR: this is raised when there is an internal error in PLSQL
2. VALUE_ERROR: It is raised when some calculation or arithmatic statement is invalid or does not hold good for a particular value.

In the above queries following are

1. User defined exception: ex_prod_update

2. System defined exception: NO_DATA_FOUND and WHEN OTHERS THEN

**************************************************************************************************