-
Notifications
You must be signed in to change notification settings - Fork 1
/
show_transaction.sql
26 lines (26 loc) · 1.02 KB
/
show_transaction.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
CREATE OR REPLACE
PROCEDURE show_transaction
(
start_date IN DATE,
end_date IN DATE
)
AS
CURSOR transaction_by_date
IS
SELECT *
FROM c_order natural join customer natural join shipping where (order_date>=start_date) and (order_date<=end_date) order by order_date desc;
BEGIN
if(start_date<=end_date)
then
DBMS_OUTPUT.PUT_LINE('c_id o_id p_id price o_date s_date track_id city amount');
DBMS_OUTPUT.PUT_LINE('----------------------------------------------------------------------------------------------');
FOR transc
IN transaction_by_date
LOOP
DBMS_OUTPUT.put_line (
transc.customer_id ||' '|| transc.order_id ||' '|| transc.product_id ||' '|| transc.total_price ||' '||transc. order_date ||' '||transc.shipping_date ||' '|| transc.track_id||' '||transc.city' '||transc.amount);
END LOOP;
else
RAISE_APPLICATION_ERROR(-20000,'Date entry not correct');
end if;
END;