我寫了一個簡單的cursor語句
declare 
cursor sfb is select sfb01 from sfb_file order by sfb01;
sfba sfb_file.sfb01%type;
begin
open sfb;
loop
fetch sfb into sfba;
dbms_output.put_line('Input:'||sfba);
exit when sfb%notfound;
end loop;
  CLOSE sfb;
  dbms_output.put_line('Input:');
end;當我按F5時,畫面出現:PL/SQL 程序順利完成.
我想不通為什麼沒有數據返回
我的sfb_file表中有數據啊請問高手哥們是怎么回事
能不能給我完整的例子,這個oracle真是比ms sql要難學多了.

解决方案 »

  1.   

    CREATE OR REPLACE procedure ll_04 is
           user_id       VARCHAR2(10); 
           cursor arr_content is select area_id from b_areas;
                              
       v_i int;
    begin
         OPEN arr_content;  
               LOOP
                  
               FETCH arr_content INTO user_id;      
       v_i:=   arr_content%rowcount     ;      
                  EXIT WHEN arr_content%NOTFOUND;                 
               END LOOP;
       dbms_output.put_line(v_i);
         CLOSE arr_content;      
               
    end ll_04;
      

  2.   

    可能是你的output的显示没有打开如果你用toad  
    选择dbms output
    有个红色的原点
    按一下变成绿色
      

  3.   

    declare 
    cursor sfb is select sfb01 from sfb_file order by sfb01;
    sfba sfb_file.sfb01%type;
    begin
    open sfb;
    loop
    fetch sfb into sfba;
    exit when sfb%notfound;
    dbms_output.put_line('Input:'||sfba);
    end loop;
    CLOSE sfb;
    end;
      

  4.   

    謝謝大哥們指點
    我上午用toad也是一樣沒反應
    原因是set serverout on;沒有寫這個語句
    暈,這是低級錯誤,
    哈哈,不過我是新手。