CREATE OR REPLACE PROCEDURE Ll_02 (p_cursor OUT sys_refcursor) IS
BEGIN
   OPEN p_cursor FOR
         SELECT * FROM B_AREAS;
END Ll_02;
-------------------------------------------------------------DECLARE 
  P_CURSOR sys_refcursor;
  v_row B_AREAS%ROWTYPE;
BEGIN 
  -- P_CURSOR := NULL;  Modify the code to initialize this parameter  ET_STATISTICS.Ll_02 ( P_CURSOR );
  LOOP
  FETCH p_cursor INTO v_row;
  
     EXIT WHEN p_cursor%NOTFOUND;
     DBMS_OUTPUT.PUT_LINE(v_row.area_id);
  END LOOP;
  
  --COMMIT; 
END; --
O
E
S
M
W
N
H

解决方案 »

  1.   

    直接查询 SELECT * from module_tree 有数据的
      

  2.   

    我运行 test 
    一直是 Executing....
    但是 module_tree 里有9条数据
      

  3.   

    象下面这样呢
    也是一直运行么别的存储过程运行就都是好的么
    -------------------------------------------------------------DECLARE 
      P_CURSOR sys_refcursor;
      v_row B_AREAS%ROWTYPE;
    BEGIN 
      -- P_CURSOR := NULL;  Modify the code to initialize this parameter  ET_STATISTICS.Ll_02 ( P_CURSOR );
      LOOP
      FETCH p_cursor INTO v_row;
      
         EXIT WHEN p_cursor%NOTFOUND;
         DBMS_OUTPUT.PUT_LINE(v_row.area_id);
      END LOOP;
      
      --COMMIT; 
    END; 
      

  4.   

    我刚学 oracle,
    我把你的code copy 到 pl/sql 运行报错
      

  5.   

    CREATE OR REPLACE PROCEDURE Ll_02 (p_cursor OUT sys_refcursor) IS
    BEGIN
       OPEN p_cursor FOR
             SELECT * FROM B_AREAS;  --换乘你的数据库表
    END Ll_02;
    -------------------------------------------------------------DECLARE 
      P_CURSOR sys_refcursor;
      v_row B_AREAS%ROWTYPE;   --换成你的表记录类型
    BEGIN 
      -- P_CURSOR := NULL;  Modify the code to initialize this parameter  ET_STATISTICS.Ll_02 ( P_CURSOR );   --换成你的用户,存储过程名
      LOOP
      FETCH p_cursor INTO v_row;
      
         EXIT WHEN p_cursor%NOTFOUND;
         DBMS_OUTPUT.PUT_LINE(v_row.area_id);  ----换成你的表记录的字段阿
      END LOOP;
      
      --COMMIT; 
    END; 
      

  6.   

    在 DECLARE 这行提示错误 
    Encountered the symbol "DECLARE"
      

  7.   

    create or replace procedure TEST2(strBig In Char) is
     v_module_small module_tree.module_small%Type;
      CURSOR result IS
       SELECT module_small FROM module_tree WHERE module_big = strBig;
          Test_Result   result%ROWTYPE;
    BEGIN
       
      OPEN result ;  loop
      
       FETCH result INTO Test_Result ;
       v_module_small:= Test_Result.module_small;
       EXIT  WHEN result%NOTFOUND ;
      end loop;end TEST2;我改成这样为什么还是在Executing