我需要创建一个程序来接受一个人姓名的第一个和最后一个字母,并返回他购买的总成本和总物品。我不知道如何使用光标,我也在想我必须使用 for 循环和异常处理,因为可能有很多人具有相同的开始和结束字母。
到目前为止,我想出了这个:
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');