Question
Question: Make a reservation: Input parameters: Hotel, guests name, start date, end dates, room type, date of reservation, etc. Output: reservation ID (this is called
Question: Make a reservation: Input parameters: Hotel, guests name, start date, end dates, room type, date of reservation, etc. Output: reservation ID (this is called confirmation code in real-life ). NOTE: Only one guest per reservation. However, the same guest can make multiple reservations.
Below is the code I have so far. I can create the sequence and the function, but I can't figure out how to get it to actually execute. Here is what I have so far:
drop sequence reserv_seq;
create sequence reserv_seq
start with 1
increment by 1;
CREATE OR REPLACE FUNCTION new_reserv (hotel_ID in varchar2, g_ID in int,
date_reserv_made in date, discount_type in varchar2, reserv_start in date,
reserv_end in date, room_number in varchar2)
return number IS
reservation_ID number;
BEGIN
reservation_ID := reserv_seq.nextval;
INSERT INTO Reservation(reservation_ID, hotel_ID, g_ID,
date_reserv_made, discount_type, reserv_start, reserv_end, room_number)
VALUES(reservation_ID, hotel_ID, g_ID, date_reserv_made, discount_type,
reserv_start, reserv_end, room_number);
RETURN reservation_ID;
END;
BEGIN
dbms_output.put_line(new_reserv('2847', 128, to_date('12-APR-18', 'DD-MON-YY'),
'contract', to_date('12-APR-18', 'DD-MON-YY'), to_date('12-APR-18', 'DD-MON-YY'), '106B'));
END;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started