SQL Anywhere uses a RESULT clause to specify returned result sets. In Transact-SQL procedures, the column names or alias names of the first query are returned to the calling environment.
The following Transact-SQL procedure illustrates how Transact-SQL stored procedures returns result sets:
CREATE PROCEDURE ShowDepartment (@deptname varchar(30)) AS SELECT Employees.Surname, Employees.GivenName FROM Departments, Employees WHERE Departments.DepartmentName = @deptname AND Departments.DepartmentID = Employees.DepartmentID; |
The following is the corresponding SQL Anywhere procedure:
CREATE PROCEDURE ShowDepartment(in deptname varchar(30)) RESULT ( LastName char(20), FirstName char(20)) BEGIN SELECT Employees.Surname, Employees.GivenName FROM Departments, Employees WHERE Departments.DepartmentName = deptname AND Departments.DepartmentID = Employees.DepartmentID END; |
For more information about procedures and results, see Returning results from procedures.
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |