postgresql函数存储过程实现数据批量插入
创建函数:
create function insert_page(text,char,char,
char,char,text,text,text,text,text,text,text,
text,text,text,text,text,text,text,real,real,
text,text,text,char,timestamp,text,int) returns bool as '
declare
url alias for $1;
touurl alias for $27;
i int;
urll text;
begin
i :=0;
urll := url;
while i < $28 loop
urll := touurl || i || urll;
insert into page_t
values(urll,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,
$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26);
urll := url;
i := i + 1;
end loop;
if i < $28 then
return false;
else
return true;
end if;
end;
'language 'plpgsql'; 删除函数:drop function insert_page(text,char,char,
char,char,text,text,text,text,text,text,text,
text,text,text,text,text,text,text,real,real,
text,text,text,char,timestamp,text,int);