Using the Batch Functions in isql

From InterBase
Jump to: navigation, search

Go Up to Using Batch Updates to Submit Multiple Statements


In isql, SQL statements to be executed in batch mode must be surrounded by the new BATCH START and BATCH EXEXCUTE commands. For example:

BATCH START; 
...
(allowed DDL/DML statements)
...
BATCH EXECUTE;

The BATCH EXECUTE command sends the statements between BATCH START and BATCH EXECUTE to the server. To begin another batch operation, you must issue another BATCH START command.

The following demonstrates a specific example of using batch mode with isql.

BATCH START; 
INSERT INTO t1(f1, f2) VALUES (0,1);
UPDATE t1 SET f1=1 WHERE f2=1;
BATCH EXECUTE;

The first SQL statement in the example inserts a new row into table t1. The second statement updates the newly inserted row with a new value. Both of these statements are executed in one API call.

For details on how to use the batch_excute and batch_execute_immed functions, see Chapter 15 of the InterBase API Guide.

Note: The AUTOCOMMITDDL mode of isql must be turned off in order to use batch updates.

Advance To: