Hi,
In school we have an assigment we use Oracle in. I can use some help on the next question.
A travel agency has guides who are assigned to groups. A guide cannot be assigned to a group when he is already assigned to one, during a certain time.
How can I make this trigger?
thanks
Sanne
Hi
You will have some field to identify a guide assigned to a group. Either in the GUIDE master table or the GROUP table. You invoke the trigger while assigning the Guide.
CREATE OR REPLACE TRIGGER Assign_Guide
BEFOR UPDATE OR INSERT ON GUIDE
FOR EACH ROW
DECLARE nRecCount Number;
BEGIN
SELECT COUNT(*) INTO nRecCount FROM GUIDE where GUIDE = :NEW.GUIDE;
IF nRecCount>0 THEN
-----GUIDE already exists
ELSE
-----You can assin GUIDE
END IF;
Try, I just made a guess!!!
Regards
Reshmi