Fix the store procedure so that it is able to display that execution result similar to the
Question:
Fix the store procedure so that it is able to display that execution result similar to the photo
Create or Replace PROCEDURE Insurance_Grouping IS
v_Customer_type VARCHAR2 (10);
v_Insurance_option_desc VARCHAR2(25) ;
v_Insurance_Option_ID Number(1);
CURSOR Insurance_group IS
SELECT
Customer.Customer_type,
Insurance_Option.Insurance_option_desc,
Count (Insurance_option.Insurance_option_ID) as "Numer of Rentals"
FROM Customer
JOIN Rental
ON Customer. Customer_id = Rental.Rental_Customer_ID
JOIN Insurance_Option
ON Insurance_option.Insurance_option_ID = Rental.Insurance_option_ID
where Customer.Customer_type = customer_type group by Customer.Customer_type, Insurance_Option.Insurance_option_desc;
BEGIN
OPEN Insurance_group;
LOOP
FETCH Insurance_group INTO v_Customer_type, v_Insurance_option_desc, v_Insurance_Option_ID;
EXIT WHEN Insurance_group%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('Insurance group info ' ||v_Customer_type|| ' | ' ||v_Insurance_option_desc|| ' | ' ||v_Insurance_Option_ID);
END LOOP;
CLOSE Insurance_group;
END Insurance_Grouping;