-
Notifications
You must be signed in to change notification settings - Fork 0
/
8.GetRentHistory.sql
28 lines (23 loc) · 1005 Bytes
/
8.GetRentHistory.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
CREATE OR REPLACE PROCEDURE GetRentHistory(p_property_id in number) AS
st_date tenantDet.stDate%TYPE;
end_date tenantDet.EndDate%TYPE;
agency tenantDet.Agency%TYPE;
rent_per_month PROPINFO.rpm%TYPE;
rent_hike tenantDet.hike%TYPE;
CURSOR rent_history_cur IS
SELECT td.stDate, td.EndDate, td.Agency, pi.rpm, td.hike
FROM tenantDet td
INNER JOIN propinfo pi ON td.proid = pi.propID
WHERE td.proid = p_property_id;
BEGIN
DBMS_OUTPUT.PUT_LINE('Rent History for Property ID: ' || p_property_id);
DBMS_OUTPUT.PUT_LINE('--------------------------------------------------');
OPEN rent_history_cur;
LOOP
FETCH rent_history_cur INTO st_date, end_date, agency, rent_per_month, rent_hike;
EXIT WHEN rent_history_cur%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('Start Date: ' || st_date || ' | End Date: ' || end_date || ' | Agency: ' || agency || ' | Rent Per Month: ' || rent_per_month || ' | Rent Hike: ' || rent_hike);
END LOOP;
CLOSE rent_history_cur;
END;
/