need to ban entries between specific Date and time in oracle forms

Viewed 26

i am working on Hotel reservation Form..my Problem is i want to write a code in which i have to stop my form to book same room again in specific time that already booked Here's my code

declare
   x_id varchar2(1000);
begin
   begin
      select GURANTEE_ID  into x_id
      from gl_bank_m
      where ( to_char(:date_of_issue,'DD-Mon-YYYY HH:MM:SS') 
      between to_char(date_of_issue,'DD-Mon-YYYY HH:MM:SS') and to_char(expiry_date,'DD-Mon-YYYY HH:MM:SS')  -- rule 1
      OR to_char(:expiry_date,'DD-Mon-YYYY HH:MM:SS') between to_char(date_of_issue,'DD-Mon-YYYY HH:MM:SS') and to_char(expiry_date,'DD-Mon-YYYY HH:MM:SS'));
   exception when no_data_found then null;
   end;
   if x_id is not null then 
      message('this slot is already booked');
      message('this slot is already booked');
   else
      raise Form_Trigger_Failure;
   end if;
end;

i would appreciate Any kind of help

0 Answers
Related