从存储过程返回游标
您好,我需要从 STORED PROCEDURE
返回一个 CURSOR
我是这样处理的
create proc pps @return_cursor cursor VARYING OUTPUT As
DECLARE cursor_name CURSOR FOR
SELECT id FROM table_name
现在我的问题是捕获返回的 Cursor
DECLARE cur_ret CURSOR
cur_ret = 执行pps
但执行方法给出错误
我的问题是如何从存储过程返回游标并捕获它
Hi i need to return a CURSOR
from a STORED PROCEDURE
i approached like this
create proc pps @return_cursor cursor VARYING OUTPUT As
DECLARE cursor_name CURSOR FOR
SELECT id FROM table_name
Now my problem is to capture the return Cursor
DECLARE cur_ret CURSOR
cur_ret = exec pps
but execute approach give an error
My problem is How to Return a CURSOR from a Stored procedure and capture it
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看在输出参数中使用光标数据类型
Have a look at Using the cursor Data Type in an OUTPUT Parameter
我发现可以这样做
I have figured out it can be do like this
请参阅链接中的“SQL Server 游标作为存储过程的输出”部分 https://www.mssqltips.com/sqlservertip/6308/ Different-ways-to-write-a-cursor-in-sql-server/
--从存储过程检索游标结果集输出的代码
Refer the section "SQL Server Cursor as Output of a Stored Procedure" in the link https://www.mssqltips.com/sqlservertip/6308/different-ways-to-write-a-cursor-in-sql-server/
-- Code to retrieve the cursor resultset output from the stored procedure