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