在mysql中有这样两个表:
create table table1{
a int primary key auto_increment,
b int,
c int
}create table table2{
idx int primary key auto_increment,
col1 int,
col2 int,
col3 float
}
mysql存储过程如下(主要部分):
insert into table2(col1,col2,col3) select a,sum(b),avg(c) from table1 where a<100 group by (a);
如何转换为oracle存储过程或函数
create table table1{
a int primary key auto_increment,
b int,
c int
}create table table2{
idx int primary key auto_increment,
col1 int,
col2 int,
col3 float
}
mysql存储过程如下(主要部分):
insert into table2(col1,col2,col3) select a,sum(b),avg(c) from table1 where a<100 group by (a);
如何转换为oracle存储过程或函数
insert语句不用改
另外序列是存在跳号的 有可能不联系 但是能保证唯一
insert into table2(idx,col1,col2,col3) select seq.nextval, a,sum(b),avg(c) from table1 where a<100 group by (a);
insert into table2(idx,col1,col2,col3) select seq.nextval, a,sum(b),avg(c) from table1 where a<100 group by (a);
--commit;
end;