Subject Re: Steps for Bulk insert / upload text file for INSERT from EXT TABLE
Author blizzardb2001
"Don't use components like TTable or TQuery for this."
What component should I be using (I am actually using Devart's Interbase Access Components so I am using TIBCTable or TIBCQuery and I have tested performance on both these datasets)?
From what I read somewhere, Firebird doesn't support bulk insertion such as sending multiple INSERT statements in one block of SQL - and that I should use a stored procedure or upload a text file.
That's kind of what I need help with.

As for uploading a string of the seat numbers, again, i would need a stored procedure to parse this for me. Any idea? I will ask around.

So far someone has given me a stored procedure to play with, but I have to test it on Firebird, and the Text file upload might be better?

SET TERM ^ ;

create or alter procedure CreateSeats (
i_id varchar(10),
i_rows integer,
i_columns integer)
as
declare variable fcounterc integer;
declare variable fcounterr integer;
declare variable fvalue varchar(10);
declare variable fletters varchar(20);
begin
fcounterc = 1;
fcounterr = 1;
fletters = 'ABCDEFGHIJKLMNOP';
while (:fcounterc <= :i_columns) do
begin
while (:fcounterr <= :i_rows) do
begin
if (:i_columns < 10) then
fvalue = '0' || :fcounterc || substring(:fletters from :fcounterr for 1);
else
fvalue = :fcounterc || substring(:fletters from :fcounterr for 1);
insert into tbl_seats(deviceid, SeatNumber) values (:i_id, :fvalue);
fcounterr = :fcounterr + 1;
end
fcounterr = 1;
fcounterc = :fcounterc + 1;
end
end^

SET TERM ; ^