MS3 Final Version
This commit is contained in:
parent
531ca33851
commit
e958a66183
1 changed files with 35 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
--ALTER USER inf2801 IDENTIFIED BY "team23oracle";
|
||||
|
||||
--SELECT name FROM v$services;
|
||||
|
||||
--select value from v$parameter where name='service_names';
|
||||
|
||||
|
||||
CREATE OR REPLACE TYPE bookingIds AS TABLE OF NUMBER;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mostValuableClerk(months IN NUMBER) RETURN NUMBER
|
||||
|
@ -124,6 +131,34 @@ BEGIN
|
|||
INSERT INTO CLEANINGPLAN VALUES (cleaningplan_seq.nextval, cleaningDate, 90, :NEW.roomNumber);
|
||||
END;
|
||||
|
||||
/**
|
||||
CREATE OR REPLACE TRIGGER booking_created
|
||||
BEFORE INSERT OR UPDATE
|
||||
BEFORE INSERT OR UPDATE OR DELETE
|
||||
ON BOOKINGROOM
|
||||
FOR EACH ROW
|
||||
DECLARE
|
||||
cleaningDate DATE;
|
||||
BEGIN
|
||||
SELECT arrivalDate INTO cleaningDate FROM BOOKING
|
||||
WHERE BOOKING.BOOKINGID = :NEW.bookingId;
|
||||
cleaningDate := cleaningDate - 1;
|
||||
INSERT INTO CLEANINGPLAN VALUES (cleaningplan_seq.nextval, cleaningDate, 90, :NEW.roomNumber);
|
||||
IF INSERTING OR UPDATING THEN
|
||||
SELECT arrivalDate INTO cleaningDate FROM BOOKING
|
||||
WHERE BOOKING.BOOKINGID = :NEW.bookingId;
|
||||
cleaningDate := cleaningDate - 1;
|
||||
INSERT INTO CLEANINGPLAN VALUES (cleaningplan_seq.nextval, cleaningDate, 90, :NEW.roomNumber);
|
||||
ELSIF DELETING THEN
|
||||
SELECT arrivalDate INTO cleaningDate FROM BOOKING
|
||||
WHERE BOOKING.BOOKINGID = :OLD.bookingId;
|
||||
cleaningDate := cleaningDate - 1;
|
||||
DELETE FROM CLEANINGPLAN
|
||||
WHERE "date" = cleaningDate AND :OLD.roomNumber = CLEANINGPLAN.ROOMNUMBER;
|
||||
END IF;
|
||||
END;
|
||||
*/
|
||||
|
||||
CREATE OR REPLACE TRIGGER cleaning_while_booked
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON CleaningPlan
|
||||
|
|
Loading…
Add table
Reference in a new issue