Using SELECT Statements in Batches

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

See SQL Anywhere Server - SQL Usage > Stored Procedures and Triggers > Using procedures, triggers, and batches > Statements allowed in procedures, triggers, events, and batches > Using SELECT statements in batches.

Note: This reference points to SQL Anywhere documentation.

Sybase IQ Example

Note: For examples, use the Sybase IQ demo database iqdemo.db.
IF EXISTS(   
			SELECT * FROM SYSTAB            
						WHERE table_name='Employees' )
THEN   
			SELECT Surname AS LastName, 
						GivenName AS FirstName   
			FROM Employees;   
			SELECT Surname, GivenName   
			FROM Customers;   
			SELECT Surname, GivenName   
			FROM Contacts;
ELSE   
			MESSAGE 'The Employees table does not exist'   
			TO CLIENT;
END IF