HELLO, in my database, i have the following table:
video_hire(vide_hire_id,, hire_date, video_code, Cust_membship_no, returning_date, hire_cost)
video_code is (fk) ref: to VIDEO_LIST,
cust_membship_no is(fk) ref: Customers
IM TRYING TO code a PROCEDURE or FUNCTION TO to calculate the ammount of hire from one customer, and print the total, as well the customer details.
for example, if the customer hired 2 videos, it would have to different hire cost, so it would calculate the values and print the total ammount to pay.
im just learn and i find difficult to get it righ, i have look all over the forum there is no such answer. PLEASE HELP ME IF YOU CAN.
he is how i have estart my code:
CREATE PROCEDURE TOTAL
RETURNS (Total_hire DECIMAL(8,2))
AS
BEGIN
SELECT SUM(hire_cost)
FROM video_hire
INTO :Total_hire;
END;
SET TERM;
I know there is other ways to do but i cant get it right.
THANKS EVERY ONE.