怎么写存储过程

如何写存储过程
点击右边红色标题查看本文完整版:如何写存储过程

表a有 a1(string) a2(data) 字段
将表a中每条记录的a1添加到表b中的b1字段 a2字段则每加办年添加到b2字段,并自动生成序号列 到10年止

即如果有 表a有 记录 name 2006-4-5

则表b有 1 name 2006-10-5
2 name 2007-4-5
3 name 2007-10-5
...
(序号) name 2016-4-5

如何写存储过程?
------如何写存储过程 解决方法--------------------
declare
i number:=1;
begin
for v_row in (select * from testA)
loop
while i<=10
loop
insert into testB
select i,v_row.a1,add_months(v_row.a2,6*i) from dual;
i:=i+1;
end loop;
i:=1;
end loop;
commit;
exception
when others then
rollback;

end;