declare cost float :=0; myFlav varchar2(20); cursor pastry(myFlavor goods.flavor%type) is select * from goods where flavor = myFlavor; myPastry pastry%rowtype; begin dbms_output.enable; for myPastry in pastry('Chocolate') loop cost := cost + myPastry.Price; end loop; dbms_output.put_line('Cost of all Chocolate items is '|| cost); end; /