0
我在我的办公室运行Oracle 9i服务器。我正在处理一个将sys_refcursor作为out参数传递给另一个包(以及其他参数)的过程。我能够将类型定义为被调用过程在游标中返回的各个列的记录。然后我可以用这样的代码循环:从存储过程中的sys_refcursor获取特定字段?
LOOP
fetch o_results into v_rec;
exit when o_results%notfound;
dbms_output.put_line(v_rec.some_id);
end loop;
有没有办法只拉一列而不必声明整个rowtype?我试过类似的东西:
LOOP
fetch o_results.some_id into v_id;
exit when o_results%notfound;
dbms_output.put_line(v_id);
end loop;
但这并不奏效。任何其他想法?