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

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


Returning multiple result sets from procedures

A procedure can return more than one result set to the calling environment.

By default, Interactive SQL does not show multiple result sets. To enable multiple result set functionality, you can use the Options window in Interactive SQL, or you can execute a SQL statement to set the isql_show_multiple_result_sets option. The setting takes effect immediately and remains in effect for future sessions until disabled.

 Enable multiple result set functionality (Interactive SQL)
  1. Connect to the database as a user with DBA authority.

  2. In Interactive SQL, click Tools » Options.

  3. Click SQL Anywhere.

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

  5. Click OK.

 Enable multiple result set functionality (SQL)
  1. Connect to the database as a user with DBA authority.

  2. Execute the following statement:

    SET OPTION isql_show_multiple_result_sets=On

After you enable this option, Interactive SQL shows multiple result sets.

If a RESULT clause is employed 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.

 See also