我如何将存储过程中的结果集放入DB2的临时表中 [英] How i can put a result set from a stored procedure in a temporary table in DB2
问题描述
我认为标题非常具有描述性...下一个是我的情况。我需要将来自存储过程的结果集(例如,具有6列和可变行的结果集)的结果放入某个临时表中,以便对该新表进行一些操作。
我在Web上找到了一些示例,但在DB2中却什么也没有...
最大的问题是如何用调用存储过程的restult集合填充新表
The title is very descriptive i think... My scenario is the next. I need to put the result of a result set (for example a result set with 6 columns and variable rows) from a stored procedure in some temporary table to make some operations over this new table. I find some examples in the web but nothing in DB2... The big problem is how to populate that new table with the restult set of a called stored procedure
推荐答案
DECLARE GLOBAL TEMPORARY TABLE可能完成了您想要的工作。您可以在存储过程中创建这种类型的临时表。它仅对当前会话可见,并在会话结束时为您清除。
DECLARE GLOBAL TEMPORARY TABLE probably accomplishes what you want. You can create this type of temporary table inside a stored procedure. It is visible only to the current session and is cleaned up for you when the session ends.
这篇关于我如何将存储过程中的结果集放入DB2的临时表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!