You are on page 1of 1

DECLARE

a number(7,2):=0.0;
d number(7,2):=0.0;
c number(1):=0;
buff number(7,2):=0.0;
no number(10):=0;
c_bsk bb_basket1.idbasket%type;
c_quan bb_basket1.quantity%type;
c_order bb_basket1.orderplaced%type;
c_shp bb_basket1.idshopper%type;
c_total bb_basket1.total%type;
CURSOR c_cust is
SELECT idbasket, quantity, orderplaced, idshopper,total FROM bb_basket1;
BEGIN
OPEN c_cust;
LOOP
FETCH c_cust into c_bsk, c_quan, c_order, c_shp, C_total;
EXIT WHEN c_cust%notfound;
if c_total<=a then
dbms_output.put_line('');
ELSE
a := C_total;
End if;
if c_quan<=c then
dbms_output.put_line('');
ELSE
c:=c_quan;
End if;
buff:=C_total;
d:=buff+d;
no := no+1;
END LOOP;
dbms_output.put_line('The highest total order is: '||a||'');
dbms_output.put_line('The largest number of items on an order is customer: '||c|
|'');
dbms_output.put_line('The average amount for all customers is: '||d/no||'');
CLOSE c_cust;
END;

You might also like