您的位置:首页 > 数据库

postgresql函数存储过程实现数据批量插入

2008-07-04 09:07 621 查看
创建函数:

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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: