declare

   cost float :=0;
   myFlav  varchar2(20);  
   money float := 0;
   ct binary_integer:=0;
  
   cursor pastry(val float) is 
                 select * from goods where price <= val;

  
   myPastry pastry%rowtype;

begin
  dbms_output.enable;

  myFlav := 'Chocolate';
  money := 5.00;
  open pastry(money);
 
  loop
    fetch pastry into myPastry;
    exit when pastry%notfound;
    cost := cost + myPastry.Price;
    ct:= ct+1;
  end loop;    
  
  close pastry;

  dbms_output.put('There are '|| ct ||' items that cost $');
  dbms_output.put_line(money||' or less');
  dbms_output.put_line('Their prices add up to '|| cost);
  
  
end;
/
