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;
/

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.