v_orderid %type;
cursor c_orderitem is select ISBN, quantity from orderitem where order_id=v_orderid; v_ISBN %type; v_quantity %type; v_retail %type;
v_sumnum number(6,2):=0; begin
open c_orderid; LOOP
fetch c_orderid into v_orderid; exit when c_orderid%NOTFOUND; for v_orderitem in c_orderitem LOOP if >10 then
select retail into v_retail from books where ISBN = ; ('1----'||v_retail||; elsif <=10 then
select retail into v_retail from books where ISBN = ; ('2----'||v_retail||; else
('number of book is error!'); end if;
v_sumnum:= v_sumnum+*v_retail; ('3*****'||v_sumnum); end LOOP; end LOOP; close c_orderid; return v_sumnum; end get_sumnum; /
set serveroutput on declare
v_totalMoney %type; v_customer number; begin end; /
v_customer :=&x;
v_totalMoney:=get_sumnum(v_customer); (v_customer||'的数量是'||v_totalMoney);
4 实验总结
本次实验难度大,代码多,锻炼了我的代码的书写能力和逻辑思维能力,实验过程遇到许多的困难,通过上网查询和求助同学最终将大部分问题解决。

