Page title

ASSIGNMENT 2 SOLUTION WITH SOURCE CODE

Exception Handling

Contents:

  1. Set A
  2. Set B

Set A Consider the following entities and their relationships.
Wholesaler (w_no, w_name, address, city) Product (product_no, product_name, rate)
Relation between Wholesaler and Product is Many to Many with quantity as descriptive attribute.
Constraint: Primary key, rate should be more than 0.

Q 1. Write a function to accept quantity from user. Quantity must be within range 50-200. If user enters the quantity out of range then raise an user defined exception “quantity_out_of _range” otherwise enter the record in table

 Download code        Source code 

Q 2. Write a PL/SQL block which accept rate from user. If user enters rate less than or equal to zero then raise an user defined exception “Invalid_Rate_Value” otherwise display message “Correct Input”.

 Download code        Source code 

Q 3. Write a function to accept product name as parameter. If entered product name is not valid then raise an user defined exception”Invalid_Product_Name” otherwise display product details of specified product.

 Download code        Source code 

Set B

Consider the following entities and their relationships.
Student (rollno, sname, class, timetable, mobileno)
Lab (LabNo, LabName, capacity, equipment)
Relation between Student and Lab is Many to One.
Constraint: Primary Key, capacity should not be null.

Q 1. Write a function to accept lab number from user as parameter. ” if user enters invalid lab number then raise an user defined exception “Invalid_Lab_No” otherwise display the student details of the same lab.

 Download code        Source code 

Q 2. Write a PL/SQL block which accept a mobile number from user. If mobileno less than or more than 10 digits then raise an user defined exception “Invalid_Mobile No” otherwise display the “Correct input…! “.

 Download code        Source code 

Q 3. Write a PL/SQL block which accepts lab detail from user. If capacity is more than 40 then raise an user defined exception “Invalid_Capacity_Range” otherwise insert the record in the table.

 Download code        Source code