当前位置: 代码迷 >> Oracle技术 >> oracle developer中调用返回游标的过程,该怎么解决
  详细解决方案

oracle developer中调用返回游标的过程,该怎么解决

热度:114   发布时间:2016-04-24 08:32:07.0
oracle developer中调用返回游标的过程
例如:过程
create   or   replace   procedure   sp_test
(v_a   int,
v_cur   sys_refcursor)
as

begin
    if   Nvl(v_a,   0)   =   0   then
    open   cursor   for   select   *   from   test1;
    end   if;
end;

如何在oracle   developer中调用该过程

------解决方案--------------------
注意:在下面FETCH INTO的时候,必须写清楚字段和它对应的变量名,不然Oracle自己识别不出来*的内容:
SQL code
set serveroutput on;declare col1 varchar2(10); col2 varchar2(10); M sys_refcursor;begin  sp_test (0, M);  fetch M into col1, col2;  DBMS_OUTPUT.PUT_LINE(col1);  DBMS_OUTPUT.PUT_LINE(col2);  close M;end;
  相关解决方案