Week9 - Cursors / Assess | E-BOX DBMS

Week9 - Cursors / Assess | E-BOX DBMS

Week9 - Cursors / Assess

The questions can come in any order, so make sure you are selecting right option for all questions.

Create a procedure named 'select_booking' that is used to display the details of the booking of a particular customer.
This procedure takes cus_id as input and returns the booked_date,delivery_date,Car_Model_model_code of the booking under given cus_id. Display the details in ascending order by Car_Model_model_code. The booking details should be returned as 'sys_refcursor'.
The details must include the following:
booked_date,delivery_date,Car_Model_model_code.

Procedure name: select_booking
Input parameter : cus_id
Output parameter: booking_details with data type as SYS_REFCURSOR.

    CREATE OR REPLACE PROCEDURE select_booking(
        cus_id IN NUMBER,
        booking_details OUT SYS_REFCURSOR
    ) IS
    BEGIN
        OPEN booking_details FOR
            SELECT booked_date, delivery_date, Car_Model_model_code
            FROM Booking b
            WHERE customer_id = cus_id
            ORDER BY Car_Model_model_code ASC;
    END select_booking;
    /