Contents Index Statements allowed in batches Calling external libraries from procedures

ASA SQL User's Guide
  Using Procedures, Triggers, and Batches
    Statements allowed in batches

Using SELECT statements in batches


You can include one or more SELECT statements in a batch.

The following is a valid batch:

IF EXISTS(   SELECT *
            FROM SYSTABLE
            WHERE table_name='employee' )
THEN
   SELECT   emp_lname AS LastName,
            emp_fname AS FirstName
   FROM employee;
   SELECT lname, fname
   FROM customer;
   SELECT last_name, first_name
   FROM contact;
END IF

The alias for the result set is necessary only in the first SELECT statement, as the server uses the first SELECT statement in the batch to describe the result set.

A RESUME statement is necessary following each query to retrieve the next result set.


Contents Index Statements allowed in batches Calling external libraries from procedures