chore: capitalize keywords
This commit is contained in:
parent
5114f6f4c9
commit
f68cd3846f
3 changed files with 31 additions and 31 deletions
|
@ -37,23 +37,23 @@ BEGIN
|
|||
END LOOP;
|
||||
END;
|
||||
|
||||
create or replace procedure rooms(clientz in number, months in number)
|
||||
CREATE OR REPLACE PROCEDURE rooms(clientz IN NUMBER, months IN NUMBER)
|
||||
|
||||
is
|
||||
IS
|
||||
CURSOR roomCursor is
|
||||
select br.ROOMNUMBER
|
||||
from BOOKINGROOM br inner join (
|
||||
select *
|
||||
from BOOKING inner join CLIENT
|
||||
on BOOKING.CLIENTID = CLIENT.PERSONID
|
||||
where CLIENT.PERSONID = clientz and BOOKING.ARRIVALDATE >= add_months(sysdate, -months)
|
||||
) bookings on br.BOOKINGID = bookings.BOOKINGID;
|
||||
begin
|
||||
SELECT br.ROOMNUMBER
|
||||
FROM BOOKINGROOM br INNER JOIN (
|
||||
SELECT *
|
||||
FROM BOOKING INNER JOIN CLIENT
|
||||
ON BOOKING.CLIENTID = CLIENT.PERSONID
|
||||
WHERE CLIENT.PERSONID = clientz AND BOOKING.ARRIVALDATE >= add_months(sysdate, -months)
|
||||
) bookings ON br.BOOKINGID = bookings.BOOKINGID;
|
||||
BEGIN
|
||||
FOR number IN roomCursor
|
||||
LOOP
|
||||
DBMS_OUTPUT.PUT_LINE(number.ROOMNUMBER);
|
||||
END LOOP;
|
||||
end rooms;
|
||||
END rooms;
|
||||
|
||||
CREATE OR REPLACE TRIGGER booking_created
|
||||
BEFORE INSERT OR UPDATE
|
||||
|
@ -83,16 +83,16 @@ BEGIN
|
|||
END IF;
|
||||
END;
|
||||
|
||||
create or replace trigger total_price
|
||||
after insert or update on BOOKING
|
||||
for each row
|
||||
declare
|
||||
total_price number;
|
||||
nights number;
|
||||
begin
|
||||
CREATE OR REPLACE TRIGGER total_price
|
||||
AFTER INSERT OR UPDATE ON BOOKING
|
||||
FOR EACH ROW
|
||||
DECLARE
|
||||
total_price NUMBER;
|
||||
nights NUMBER;
|
||||
BEGIN
|
||||
nights := :NEW.DEPARTUREDATE - :NEW.ARRIVALDATE;
|
||||
total_price := nights * :NEW.COST;
|
||||
dbms_output.put_line('Gesamtpreis:');
|
||||
dbms_output.put_line(total_price);
|
||||
end;
|
||||
END;
|
||||
|
||||
|
|
|
@ -23,13 +23,13 @@ BEGIN
|
|||
DBMS_OUTPUT.PUT_LINE('Letzten Buchungen:');
|
||||
getLastBookings(5);
|
||||
--Output: 1-10
|
||||
end;
|
||||
END;
|
||||
BEGIN
|
||||
--Test für die letzten 9 Monate:
|
||||
DBMS_OUTPUT.PUT_LINE('Letzten Buchungen:');
|
||||
getLastBookings(9);
|
||||
--Output: 1-14
|
||||
end;
|
||||
END;
|
||||
|
||||
|
||||
|
||||
|
@ -40,10 +40,10 @@ BEGIN
|
|||
DBMS_OUTPUT.PUT_LINE('Gebuchte Zimmer:');
|
||||
rooms(10, 5);
|
||||
--Output: 8+9+10
|
||||
end;
|
||||
END;
|
||||
BEGIN
|
||||
--Test für Client 3 und letzten 8 Monate:
|
||||
DBMS_OUTPUT.PUT_LINE('Gebuchte Zimmer:');
|
||||
rooms(8, 8);
|
||||
--Output: 5
|
||||
end;
|
||||
END;
|
||||
|
|
|
@ -5,8 +5,8 @@ INSERT INTO BOOKING VALUES (444, TO_DATE('2023-09-07', 'YYYY-MM-DD'), TO_DATE('2
|
|||
|
||||
INSERT INTO BOOKINGROOM VALUES (444, 8);
|
||||
|
||||
select * from CLEANINGPLAN where "date" = TO_DATE('2023-09-06', 'YYYY-MM-DD');
|
||||
rollback;
|
||||
SELECT * FROM CLEANINGPLAN WHERE "date" = TO_DATE('2023-09-06', 'YYYY-MM-DD');
|
||||
ROLLBACK;
|
||||
|
||||
-- Cleaningplan kann nicht erstellt werden
|
||||
INSERT INTO BOOKING VALUES (555, TO_DATE('2023-09-03', 'YYYY-MM-DD'), TO_DATE('2023-09-05', 'YYYY-MM-DD'), 65, 'No Pension', 0, 15);
|
||||
|
@ -15,8 +15,8 @@ INSERT INTO BOOKING VALUES (556, TO_DATE('2023-09-06', 'YYYY-MM-DD'), TO_DATE('2
|
|||
INSERT INTO BOOKINGROOM VALUES (555, 8);
|
||||
INSERT INTO BOOKINGROOM VALUES (556, 8);
|
||||
|
||||
select * from CLEANINGPLAN where "date" = TO_DATE('2023-09-05', 'YYYY-MM-DD');
|
||||
rollback;
|
||||
SELECT * FROM CLEANINGPLAN WHERE "date" = TO_DATE('2023-09-05', 'YYYY-MM-DD');
|
||||
ROLLBACK;
|
||||
|
||||
-- Cleaningplan kann nicht erstellt werden
|
||||
INSERT INTO BOOKING VALUES (888, TO_DATE('2023-09-03', 'YYYY-MM-DD'), TO_DATE('2023-09-05', 'YYYY-MM-DD'), 65, 'No Pension', 0, 15);
|
||||
|
@ -24,14 +24,14 @@ INSERT INTO BOOKING VALUES (888, TO_DATE('2023-09-03', 'YYYY-MM-DD'), TO_DATE('2
|
|||
INSERT INTO BOOKINGROOM VALUES (888, 8);
|
||||
|
||||
INSERT INTO CLEANINGPLAN VALUES (cleaningplan_seq.nextval, TO_DATE('2023-09-04', 'YYYY-MM-DD'), 240, 8);
|
||||
rollback;
|
||||
ROLLBACK;
|
||||
|
||||
-- Cleaningplan wird erfolgreich gebucht
|
||||
INSERT INTO CLEANINGPLAN VALUES (cleaningplan_seq.nextval, TO_DATE('2023-11-09', 'YYYY-MM-DD'), 240, 8);
|
||||
select * from CLEANINGPLAN where "date" = TO_DATE('2023-11-09', 'YYYY-MM-DD');
|
||||
rollback;
|
||||
SELECT * FROM CLEANINGPLAN WHERE "date" = TO_DATE('2023-11-09', 'YYYY-MM-DD');
|
||||
ROLLBACK;
|
||||
|
||||
-- Gesamtpreise werden angezeigt
|
||||
INSERT INTO BOOKING VALUES (234, TO_DATE('2023-09-03', 'YYYY-MM-DD'), TO_DATE('2023-09-05', 'YYYY-MM-DD'), 65, 'No Pension', 0, 15);
|
||||
INSERT INTO BOOKING VALUES (456, TO_DATE('2023-09-06', 'YYYY-MM-DD'), TO_DATE('2023-10-01', 'YYYY-MM-DD'), 10, 'No Pension', 0, 15);
|
||||
rollback;
|
||||
ROLLBACK;
|
||||
|
|
Loading…
Reference in a new issue