create table temp (
  pno       char(6),
  totqty    integer
);

insert into temp (pno, totqty)
  select pno, sum(qty) from sp group by pno;

select * from temp;

drop table temp;
