简体   繁体   English

从游标中获取特定的列到db2存储过程中的变量中

[英]Fetch specific columns from cursor into variables in db2 stored procedure

I have written a stored procedure where a cursor holds the results of a select that returns approx 20 columns. 我编写了一个存储过程,其中光标保存返回约20列的select结果。

I need to perform additional processing which only needs to look at the values in 3 of the columns so I am looking to fetch only those 3 columns into 3 variables instead of all 20, but I can't seem to get the syntax correct. 我需要执行其他处理,该处理仅需要查看3列中的值,因此我希望仅将3列中的值提取到3个变量中,而不是全部20个中,但是我似乎无法获得正确的语法。

Eg 例如

FETCH cursor1.field1, cursor1.field2, cursor1.field3 INTO variable1, variable2, variable3

Thanks for any help 谢谢你的帮助

fetch next from cursor into @a1,@a2,@a3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM