Andrew,
I've seen reservation systems that put a temporary hold on seats when someone inquired. Instead of asking for the 'availability' of 4 seats, you add 4 reservations with a temporary code and THEN get the availability. If it's > 0 you know that all 4 seats are open and the client can make a permanent reservation if he wishes. If it's less than 0 you inform the client that there are not 4 seats available and release the temporary reservation immediately
The temporary code holds them for a given time, and then is released. This way no-one else will see those 4 seats as available until you have either confirmed the sale or released them back into the 'pool'.
HTH
Barbara
>Hi Marcel,
>
>I guess I didn't explain things as well as I should have, or else I really don't understand your reply!
>
>I want the Database to enforce the following rule: "You can't accept reservations for more seats then are available"
>
>Why would I do this via the update trigger instead of a row rule?
>
>I've been playing around with this a bit and have come up with the following concept that has worked ok in my initial testing:
>
>Have a local view with parameters for the trip number, and the number of the reservation (current reservation) currently being tested for validity.
>
>The local view calculates the number of seats booked for the trip with the exception of those in the current reservation.
>
>It's then easy to add the seats reported booked by the view and the number of seats in the current reservation. If they exceed the seats available for the trip, then validation fails.
>
>That said, I am uneasy with this technique because of the possibility of two reservations being updated at the same time, and the view in each validation indicating that there were seats available, when in fact the two reservations being entered cause the total reserved to exceed availability. Am I being paranoid?
>
>Any thoughts?
>
>
>
>>Hi Andrew
>>
>>I think you have no way to solve your problem at the client side
>>( what you try to do with views )
>>You need to use the update trigger to check the reservation status. ( at the server side ) and handle trigger error and the client side.
>>
>>Marcel