示例数据库为postgre:
# 1. insert :
create or replace function aa1() returns
void AS $$declare num integer;
declare sname char;
begin
num := 0;
while num <=44 loop
insert into system values(num+10 ,'s' ,1);
num :=num+1;
end loop;
end;
$$ LANGUAGE plpgsql;
select aa1()
# 2.update
create or replace function aa1() returns
void AS $$
declare num integer;
declare sname char;
begin
num := 0;
while num <=43 loop
update table_system set systemid = (select id from table_name limit 1 offset num) where id =num+10;
num :=num+1;
end loop;
end;
$$ LANGUAGE plpgsql;