declare counter integer :=1;
loop
  counter :=counter + 1;
  exit when counter=5;
  end loop;上面的是Plsql代码,下面是出错信息,望各位帮忙看看是什么问题ORA-06550: line 4, column 8:
PLS-00103: Encountered the symbol "WHEN" when expecting one of the following:   constant exception <an identifier>
   <a double-quoted delimited-identifier> table LONG_ double ref
   char time timestamp interval date binary national character
   nchar
ORA-06550: line 5, column 3:
PLS-00103: Encountered the symbol "END" 

解决方案 »

  1.   

    少了being,end关键字:
    set serveroutput on;
    declare 
    counter integer :=1;
    begin
    loop
      counter :=counter + 1;
      dbms_output.put_line(counter);
      exit when counter=5;
      end loop;
    end;
      

  2.   

    修改:DECLARE 
        counter INTEGER :=1;
    BEGIN    
        LOOP
            counter := counter + 1;
            EXIT WHEN counter = 5;
            DBMS_OUTPUT.PUT_LINE(counter);
        END LOOP;
    END; 
    结果:
      

  3.   

    啊,天哪,如此不小心,多谢了!!嘿嘿   兰兰姐好牛啊!
    兰兰姐是不是专门在CSDN上解决问题的,怎么每次发帖你都能赐教,真是谢谢你了