Z
zqssoft
Unregistered / Unconfirmed
GUEST, unregistred user!
如何利用存储过程,批量添加数据,我下面的怎么添加不进去呢?
ET TERM ^ ;
CREATE PROCEDURE INSERT_TABLEBLOB3 (
ID Integer,
NAME Varchar(255),
TEXT Blob sub_type 1,
DATETIME Timestamp )
AS
DECLARE I INT = 0;
DECLARE N INT = 300000;
BEGIN
WHILE (i < N) DO
BEGIN
i = i + 1;
Insert into tablevarchar(id,name,text,datetime)values
id,:name,:text,:datetime);
SUSPEND;
END
end^
SET TERM ; ^
procedure TForm1.Button5Click(Sender: TObject);
var
i,l: integer;
s,t,a: widestring;
s1,s2:string;
begin
// randomize;
s :=trim(Memo1.Text);
t:='';
for i := 0 to length(s)-1 do
begin
a:= s[Random(Length(s)-1)+1];
t := t +a ;
delete(s,pos(a,s),length(a));
end;
// randomize;
l:=random(length(memo1.Text)-1);
s1:=copy(t,0,l);
// randomize;
l:=random(20);
s2:=copy(t,0,l);
IBStoredProc1.StoredProcName:='INSERT_TABLEBLOB3';
IBStoredProc1.ParamByName('ID').AsInteger:=GetMaxID1;
IBStoredProc1.ParamByName('NAME').AsString:=s2;
IBStoredProc1.ParamByName('TEXT').AsString:=s1;
IBStoredProc1.ParamByName('DATETIME').AsDateTime:=Now;
IBStoredProc1.ExecProc;
Application.ProcessMessages;
end;
ET TERM ^ ;
CREATE PROCEDURE INSERT_TABLEBLOB3 (
ID Integer,
NAME Varchar(255),
TEXT Blob sub_type 1,
DATETIME Timestamp )
AS
DECLARE I INT = 0;
DECLARE N INT = 300000;
BEGIN
WHILE (i < N) DO
BEGIN
i = i + 1;
Insert into tablevarchar(id,name,text,datetime)values
id,:name,:text,:datetime);
SUSPEND;
END
end^
SET TERM ; ^
procedure TForm1.Button5Click(Sender: TObject);
var
i,l: integer;
s,t,a: widestring;
s1,s2:string;
begin
// randomize;
s :=trim(Memo1.Text);
t:='';
for i := 0 to length(s)-1 do
begin
a:= s[Random(Length(s)-1)+1];
t := t +a ;
delete(s,pos(a,s),length(a));
end;
// randomize;
l:=random(length(memo1.Text)-1);
s1:=copy(t,0,l);
// randomize;
l:=random(20);
s2:=copy(t,0,l);
IBStoredProc1.StoredProcName:='INSERT_TABLEBLOB3';
IBStoredProc1.ParamByName('ID').AsInteger:=GetMaxID1;
IBStoredProc1.ParamByName('NAME').AsString:=s2;
IBStoredProc1.ParamByName('TEXT').AsString:=s1;
IBStoredProc1.ParamByName('DATETIME').AsDateTime:=Now;
IBStoredProc1.ExecProc;
Application.ProcessMessages;
end;