diff --git a/SQL/PLSQL.sql b/SQL/PLSQL.sql index 4abbf7e..8a1d3c0 100644 --- a/SQL/PLSQL.sql +++ b/SQL/PLSQL.sql @@ -35,4 +35,20 @@ BEGIN LOOP DBMS_OUTPUT.PUT_LINE(booking.BOOKINGID); END LOOP; -END; \ No newline at end of file +END; + +create or replace procedure rooms(clientz in number, months in number) + +is + startMonth date; +begin + startMonth := add_months(sysdate, months); + + 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 >= startMonth + ) bookings on br.BOOKINGID = bookings.BOOKINGID; +end rooms;