游标的语法:
DECLARE cursor_name CURSOR [ LOCAL | GLOBAL ]
[ FORWARD_ONLY | SCROLL ]
[ STATIC | KEYSET | DYNAMIC | FAST_FORWARD ]
[ READ_ONLY | SCROLL_LOCKS | OPTIMISTIC ]
[ TYPE_WARNING ]
FOR select_statement
[ FOR UPDATE [ OF column_name [ ,...n ] ] ]
[;] 在建立游标的时候常用的写法: DECLARE MyCursor CURSOR FOR select,此时在递归调用中就是提示 'MyCursor' 已经存在,我们创建了一个全局(GLOBAL)的游标,
此时我们要创建非全部的游标: DECLARE MyCursor CURSOR LOCAL FOR select ,这时在递归调用的时候就正确了。