Hi,

I'm a newbie in the H2 database and I'd like to ask a question regarding 
trigger. 
I created a table for hotel reservations in the sql with the following 
script


CREATE TABLE Reservierung(
RID INTEGER PRIMARY KEY,
customername VARCHAR(50) NOT NULL,
roomnumber VARCHAR(50) NOT NULL,
Start_date DATE NOT NULL,
To_date DATE NOT NULL,
reserved boolean not null,
check(To_date),
check (reserved='true'));

And I'd like to add some kind of trigger that prevents inserting a 
reservation with a room number in the date range which has already been 
reserved. 

E.g. 
I add a reservation for the room number 124 between the dates ยด2017-09-09' 
and '2017-09-16' 
and I'd like to add some kind of error  if i insert a second reservation 
with the same room number between 2017-09-10' and '2017-09-15' .

I tried to do it with the check constraint but it didn't work.

Since triggers don't work in the H2 I'd like to ask you whether someone 
knows how to solve this problem (I've been trying to find a solution for 
hours but can't find the right answer)

Thanx

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to