As in Transact-SQL, you can batch several SQL statements in a single exec sql statement. Batches are useful and more efficient when an application executes a fixed set of Transact-SQL statements each time it runs.
For example, some applications create temporary tables and indexes when they start up. You could send these statements in a single batch. See the Adaptive Server Enterprise Reference Manual for rules about statement batches.
The following restrictions apply to statement batches:
Statements in a batch cannot return results to the program. That is, a batch cannot contain select statements.
All statements in a batch must be valid Transact-SQL statements. You cannot place Embedded SQL statements such as declare cursor and prepare in a statement batch.
The same rules that apply to Transact-SQL batches apply to Embedded SQL batches. For example, you cannot put a use database statement in an Embedded SQL batch.