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:

RETURNS (Total_hire DECIMAL(8,2))
SELECT SUM(hire_cost)
FROM video_hire
INTO :Total_hire;

I know there is other ways to do but i cant get it right.


Re: oracle PROCEDURE OR fucntion to calculate total price 80 80

I will like you to read a bit on how to write a good function and then a good procedure to know what you really want to use to solve the problem. Note that functions have a return value but procedures do not have a return value. You should also sum the select that will display the videos bought by a person you should use the primary key of an individual and then use that to get all the videos that individual has purchased. I hope this helps. If you do not get something right. I will be willing to help. ;)


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.