Use Duration and booking date to stop bookings during this time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Yew12
    New Member
    • Mar 2008
    • 23

    Use Duration and booking date to stop bookings during this time

    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.
    Last edited by debasisdas; Apr 3 '08, 12:09 PM. Reason: added code=oracle tags.
Working...