A batch is a group of statements you submit as one unit for execution. The precompiler executes all Transact-SQL statements between the exec sql and ; keywords in batch mode.
Although the precompiler saves stored procedures, it does not save batches for re-execution. The batch is effective only for the current execution.
The precompiler supports only batch mode statements that return no result sets.
exec sql insert into TABLE1 values (:val1)
insert into TABLE2 values (:val2)
insert into TABLE3 values (:val3);
The three insert statements are processed as a group, which is more efficient than being processed individually. Use the get diagnostics method of error handling with batches. For details, see “Using get diagnostics”.
These statements are legal within a batch because none of them returns results. See the Adaptive Server Enterprise Transact-SQL Users Guide.