Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - SQL Usage » Stored procedures, triggers, batches, and user-defined functions » Result sets


Returning multiple result sets

You can use Interactive SQL to return more than one result set from a procedure.


There are no prerequisites for this task.

Contexte et remarques

By default, Interactive SQL does not show multiple result sets.

  1. In Interactive SQL, connect to the database.

  2. Click Tools » Options.

  3. Click SQL Anywhere.

  4. On the Results tab, click Show All Result Sets.

  5. Click OK.


After you enable this option, Interactive SQL shows multiple result sets. The setting takes effect immediately and remains in effect for future sessions until it is disabled.


If a RESULT clause is included in a procedure definition, the result sets must be compatible: they must have the same number of items in the SELECT lists, and the data types must all be of types that can be automatically converted to the data types listed in the RESULT clause.

If the RESULT clause is omitted, a procedure can return result sets that vary in the number and type of columns that are returned.


The following procedure lists the names of all employees, customers, and contacts listed in the database:

RESULT ( Surname CHAR(36), GivenName CHAR(36) )
   SELECT Surname, GivenName
   FROM Employees;
   SELECT Surname, GivenName
   FROM Customers;
   SELECT Surname, GivenName
   FROM Contacts;

 See also