Question: I am having some problems with selecting my dates in oracle sql, below i am inserting values using a procedure. the data type for parameters
I am having some problems with selecting my dates in oracle sql, below i am inserting values using a procedure. the data type for parameters check_in_date and scheck_out_date and reservation_date is 'date'.
insert into reservation (reservation_number, hotel_id, guest_fname, guest_lname, check_in_date, check_out_date, room_type, reservation_date, number_of_guests) values (res_num.NEXTVAL,Hotel, guests_fname, guests_lname, to_date(start_date , 'DD/MM/YYYY'), to_date(end_date, 'DD/MM/YYYY') , rooms_type, to_date(date_of_res, 'DD/MM/YYYY'), nbr_of_guests);
Here are the actual values I am inserting
set serveroutput on; begin make_res('H-0021', 'Dan', 'Angler', '23/Nov/2017', '27/Nov/2017', 'Double', trunc(SYSDATE), 2); end;
Here is a row that was created using my procedure
194 23-NOV-17 27-NOV-17 23-NOV-17 2 H-0021 Double Dan Angler P-2090
I trying to run this query but it is not reading the dates. If I take out the dates I get the value 'P-0290', which is right, but I recieve an empty boy when I leave the dates in there.
select room_number from reservation where check_in_date >= '23-NOV-2017' and CHECK_OUT_DATE <= '27-NOV-2017';
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
