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 LOOP;
|
||||||
END;
|
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
|
CURSOR roomCursor is
|
||||||
select br.ROOMNUMBER
|
SELECT br.ROOMNUMBER
|
||||||
from BOOKINGROOM br inner join (
|
FROM BOOKINGROOM br INNER JOIN (
|
||||||
select *
|
SELECT *
|
||||||
from BOOKING inner join CLIENT
|
FROM BOOKING INNER JOIN CLIENT
|
||||||
on BOOKING.CLIENTID = CLIENT.PERSONID
|
ON BOOKING.CLIENTID = CLIENT.PERSONID
|
||||||
where CLIENT.PERSONID = clientz and BOOKING.ARRIVALDATE >= add_months(sysdate, -months)
|
WHERE CLIENT.PERSONID = clientz AND BOOKING.ARRIVALDATE >= add_months(sysdate, -months)
|
||||||
) bookings on br.BOOKINGID = bookings.BOOKINGID;
|
) bookings ON br.BOOKINGID = bookings.BOOKINGID;
|
||||||
begin
|
BEGIN
|
||||||
FOR number IN roomCursor
|
FOR number IN roomCursor
|
||||||
LOOP
|
LOOP
|
||||||
DBMS_OUTPUT.PUT_LINE(number.ROOMNUMBER);
|
DBMS_OUTPUT.PUT_LINE(number.ROOMNUMBER);
|
||||||
END LOOP;
|
END LOOP;
|
||||||
end rooms;
|
END rooms;
|
||||||
|
|
||||||
CREATE OR REPLACE TRIGGER booking_created
|
CREATE OR REPLACE TRIGGER booking_created
|
||||||
BEFORE INSERT OR UPDATE
|
BEFORE INSERT OR UPDATE
|
||||||
|
@ -83,16 +83,16 @@ BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
create or replace trigger total_price
|
CREATE OR REPLACE TRIGGER total_price
|
||||||
after insert or update on BOOKING
|
AFTER INSERT OR UPDATE ON BOOKING
|
||||||
for each row
|
FOR EACH ROW
|
||||||
declare
|
DECLARE
|
||||||
total_price number;
|
total_price NUMBER;
|
||||||
nights number;
|
nights NUMBER;
|
||||||
begin
|
BEGIN
|
||||||
nights := :NEW.DEPARTUREDATE - :NEW.ARRIVALDATE;
|
nights := :NEW.DEPARTUREDATE - :NEW.ARRIVALDATE;
|
||||||
total_price := nights * :NEW.COST;
|
total_price := nights * :NEW.COST;
|
||||||
dbms_output.put_line('Gesamtpreis:');
|
dbms_output.put_line('Gesamtpreis:');
|
||||||
dbms_output.put_line(total_price);
|
dbms_output.put_line(total_price);
|
||||||
end;
|
END;
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,13 @@ BEGIN
|
||||||
DBMS_OUTPUT.PUT_LINE('Letzten Buchungen:');
|
DBMS_OUTPUT.PUT_LINE('Letzten Buchungen:');
|
||||||
getLastBookings(5);
|
getLastBookings(5);
|
||||||
--Output: 1-10
|
--Output: 1-10
|
||||||
end;
|
END;
|
||||||
BEGIN
|
BEGIN
|
||||||
--Test für die letzten 9 Monate:
|
--Test für die letzten 9 Monate:
|
||||||
DBMS_OUTPUT.PUT_LINE('Letzten Buchungen:');
|
DBMS_OUTPUT.PUT_LINE('Letzten Buchungen:');
|
||||||
getLastBookings(9);
|
getLastBookings(9);
|
||||||
--Output: 1-14
|
--Output: 1-14
|
||||||
end;
|
END;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,10 +40,10 @@ BEGIN
|
||||||
DBMS_OUTPUT.PUT_LINE('Gebuchte Zimmer:');
|
DBMS_OUTPUT.PUT_LINE('Gebuchte Zimmer:');
|
||||||
rooms(10, 5);
|
rooms(10, 5);
|
||||||
--Output: 8+9+10
|
--Output: 8+9+10
|
||||||
end;
|
END;
|
||||||
BEGIN
|
BEGIN
|
||||||
--Test für Client 3 und letzten 8 Monate:
|
--Test für Client 3 und letzten 8 Monate:
|
||||||
DBMS_OUTPUT.PUT_LINE('Gebuchte Zimmer:');
|
DBMS_OUTPUT.PUT_LINE('Gebuchte Zimmer:');
|
||||||
rooms(8, 8);
|
rooms(8, 8);
|
||||||
--Output: 5
|
--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);
|
INSERT INTO BOOKINGROOM VALUES (444, 8);
|
||||||
|
|
||||||
select * from CLEANINGPLAN where "date" = TO_DATE('2023-09-06', 'YYYY-MM-DD');
|
SELECT * FROM CLEANINGPLAN WHERE "date" = TO_DATE('2023-09-06', 'YYYY-MM-DD');
|
||||||
rollback;
|
ROLLBACK;
|
||||||
|
|
||||||
-- Cleaningplan kann nicht erstellt werden
|
-- 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);
|
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 (555, 8);
|
||||||
INSERT INTO BOOKINGROOM VALUES (556, 8);
|
INSERT INTO BOOKINGROOM VALUES (556, 8);
|
||||||
|
|
||||||
select * from CLEANINGPLAN where "date" = TO_DATE('2023-09-05', 'YYYY-MM-DD');
|
SELECT * FROM CLEANINGPLAN WHERE "date" = TO_DATE('2023-09-05', 'YYYY-MM-DD');
|
||||||
rollback;
|
ROLLBACK;
|
||||||
|
|
||||||
-- Cleaningplan kann nicht erstellt werden
|
-- 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);
|
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 BOOKINGROOM VALUES (888, 8);
|
||||||
|
|
||||||
INSERT INTO CLEANINGPLAN VALUES (cleaningplan_seq.nextval, TO_DATE('2023-09-04', 'YYYY-MM-DD'), 240, 8);
|
INSERT INTO CLEANINGPLAN VALUES (cleaningplan_seq.nextval, TO_DATE('2023-09-04', 'YYYY-MM-DD'), 240, 8);
|
||||||
rollback;
|
ROLLBACK;
|
||||||
|
|
||||||
-- Cleaningplan wird erfolgreich gebucht
|
-- Cleaningplan wird erfolgreich gebucht
|
||||||
INSERT INTO CLEANINGPLAN VALUES (cleaningplan_seq.nextval, TO_DATE('2023-11-09', 'YYYY-MM-DD'), 240, 8);
|
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');
|
SELECT * FROM CLEANINGPLAN WHERE "date" = TO_DATE('2023-11-09', 'YYYY-MM-DD');
|
||||||
rollback;
|
ROLLBACK;
|
||||||
|
|
||||||
-- Gesamtpreise werden angezeigt
|
-- 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 (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);
|
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