Collection Contents 上一页 下一页 PDF

ASA SQL 用户指南

Transact-SQL 兼容性

从 Transact-SQL 过程中返回结果集


Adaptive Server Anywhere 使用 RESULT 子句来指定所返回的结果集。在 Transact-SQL 过程中,第一个查询的列名或别名将返回到发出调用的环境中。

Transact-SQL 过程的示例 

以下 Transact-SQL 过程说明了 Transact-SQL 存储过程如何返回结果集:

CREATE PROCEDURE showdept (@deptname varchar(30))
AS
   SELECT employee.emp_lname, employee.emp_fname
   FROM department, employee
   WHERE department.dept_name = @deptname
   AND department.dept_id = employee.dept_id
Watcom-SQL 过程的示例 

下面是相应的 Adaptive Server Anywhere 过程:

CREATE PROCEDURE showdept(in deptname varchar(30))
RESULT ( lastname char(20), firstname char(20))
BEGIN
   SELECT employee.emp_lname, employee.emp_fname
   FROM department, employee
   WHERE department.dept_name = deptname
   AND department.dept_id = employee.dept_id
END

有关过程和结果的详细信息,请参见从过程返回结果


Collection Contents 上一页 下一页 PDF