开发者

Can I: loop through sql select and then fire off for each loop?

I'm probably missing something (looking at it too long), but in a stored procedure can I select all distinct values from one tab开发者_运维百科le and then do a for each loop based on each of those returned rows, which themselves build up sql statements based on the distinct values?

Cheers.


Yes, you can use a cursor.

Note that cursors are best avoided if possible. If it's possible to do what you need with a set-based query -- and it often is -- then you should do that instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜