to masterz(www.fruitfruit.com)我知道怎么写select语句,我是不知道怎么写PROCEDURE,能不能写个完整的PROCEDURE,谢谢!
CREATE OR REPLACE PROCEDURE count_proc AS BEGIN insert into table3 select name,sum( case when flag2=1 then num else 0 end) as count1,sum(case when flag2=2 then num else 0 end) as count2 from table2 group by name; commit; END;
CREATE OR REPLACE PROCEDURE pro_test AS BEGIN insert into table2 select * from table1; insert into table3 select name,sum( case when flag2=1 then num else 0 end) as count1,sum(case when flag2=2 then num else 0 end) as count2 from table2 group by name; commit; END;
BEGIN
insert into table3 select name,sum( case when flag2=1 then num else 0 end) as count1,sum(case when flag2=2 then num else 0 end) as count2 from table2 group by name;
commit;
END;
BEGIN
insert into table2 select * from table1;
insert into table3 select name,sum( case when flag2=1 then num else 0 end) as count1,sum(case when flag2=2 then num else 0 end) as count2 from table2 group by name;
commit;
END;