Subject Re: [firebird-support] Re: Major stumbling block: Lack of multiple-row insert capability
Author Ivan Prenosil
> Are you saying that I can send as one string: "EXECUTE BLOCK AS BEGIN
> INSERT INTO TABLE1(col1,col2) VALUES(1,2); INSERT INTO
> TABLE1(col1,col2) VALUES(3,4); END" and it will work?

Yes. You are limited by the max length of sql statement (i think 64k).
You can take advantage of full PSQL (stored procedures) syntax.
E.g. you can prepare single EXECUTE BLOCK statement for inserting 10 rows,
and add one extra parameter to specify how many rows are actually used:


EXECUTE BLOCK (num INTEGER=?, c11 INTEGER=?, c12 INTEGER=?,
c21 INTEGER=?, c22 INTEGER=?, ...) AS BEGIN
INSERT INTO TABLE1(col1,col2) VALUES(:c11,:c12);
IF (num>=2) THEN INSERT INTO TABLE1(col1,col2) VALUES(:c21,:c22);
IF (num>=3) THEN INSERT INTO TABLE1(col1,col2) VALUES(:c31,:c32);
...
END

Ivan
http://www.volny.cz/iprenosil/interbase/