要解决与第二种方法相关的问题,您需要使用
游标变量和打开游标并获取数据的显式方式。它不是
允许在
FOR循环中使用游标变量:
declare l_sql varchar2(123); -- variable that contains a query l_c sys_refcursor; -- cursor variable(weak cursor). l_res your_table%rowtype; -- variable containing fetching data begin l_sql := 'select * from your_table'; -- Open the cursor and fetching data explicitly -- in the LOOP. open l_c for l_sql; loop fetch l_c into l_res; exit when l_c%notfound; -- Exit the loop if there is nothing to fetch. -- process fetched data end loop; close l_c; -- close the cursorend;
了解更多
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)