Create or replace Procedure  updatenine   
  is  
  begin
       declare
       cursor   mycursor   is   select   id   from   secendresult;  
       id_lat_lng   secendresult.id%type;
      open   mycursor;
      loop  
      Fetch next mycursor into id_lat_lng; 
      exit when   mycursor%notfound; 
       if mycursor%found then   
          DBMS_OUTPUT.PUT_LINE('添加记录='||id_lat_lng||'条');   
      end if;    
      end  LOOP;
      close  mycursor;  
  end updatenine;编译的时候  FETCH 那里错误

解决方案 »

  1.   


    --多看看储存过程的语法吧
    Create or replace Procedure updatenine
    is
    --在 is 或者是 as后面定义变量 不需要用declare了 
      cursor mycursor is select id from secendresult;
      id_lat_lng secendresult.id%type;
    begin
      open mycursor;
      loop
      Fetch mycursor into id_lat_lng;  
    --Fetch next mycursor 你想当然了吧  exit when mycursor%notfound;
    --  if mycursor%found then 多次一举
      DBMS_OUTPUT.PUT_LINE('添加记录='||id_lat_lng||'条');
    -- end if;
      end LOOP;
      close mycursor;
    end updatenine;
      

  2.   

     Fetch next mycursor into id_lat_lng;  
    不用next吧
      

  3.   


    Fetch /*next--去掉*/ mycursor into id_lat_lng;