I need to create a procedure that accepts first and last letter of a person's name and returns the totalcost and total items bought by him. I have no idea how to use the cursor with it also i'm thinking i have to use a for loop and exception handling since there can be many persons with the same starting and ending letter's.
So far I have come up with this:
create or replace procedure total_spent(v_fname IN
saleinv.cname%TYPE,v_lname IN saleinv.cname%TYPE.v_netspend OUT
saleinv.net%TYPE,v_totalpurch OUT NUMBER) AS
Begin
select sum(net+tax),count(net) into v_netspend,v_totalpurch from saleinv
where cname LIKE '&v_fname%&v_lname';
END;
/
ACCEPT p_fname PROMPT 'Enter The first letter of customer's name'
ACCEPT p_lname PROMPT 'Enter the last letter of customer's name'
BEGIN
totalspent('&p_fname',&'p_lname');