I'm trying to use PL/SQL to create a trigger that will stop bookings. Based on a duration field and a start time.
I have had a go at trying to do this but I'm sure that im well off from where I need to be.
[CODE=oracle]
Create or Replace Trigger multiple_appoin tments
Before insert on appointment
Begin
IF (NEW.toNumber(A DATE) between toNumber(ADATE + "Duration(M in)" from Appointmenmt)
and toNumber(ADATE + "Duration(M in)" from appointment)
Then
RAISE_APPLICATI ON_ERROR (-20500, 'There is already a appointment schedualled for this time');
End IF;
END;[/CODE]
Any help would be great thank you very much.
I have had a go at trying to do this but I'm sure that im well off from where I need to be.
[CODE=oracle]
Create or Replace Trigger multiple_appoin tments
Before insert on appointment
Begin
IF (NEW.toNumber(A DATE) between toNumber(ADATE + "Duration(M in)" from Appointmenmt)
and toNumber(ADATE + "Duration(M in)" from appointment)
Then
RAISE_APPLICATI ON_ERROR (-20500, 'There is already a appointment schedualled for this time');
End IF;
END;[/CODE]
Any help would be great thank you very much.