declare AALEVEL_ number;temp_ number;PARENT_DOP_ORDER_ID_ number;tempa_ number;
 begin
 select DOP_STRUCTURE_LEVEL,QTY_PER_ASSEMBLY,PARENT_DOP_ORDER_ID 
 into AALEVEL_,temp_,PARENT_DOP_ORDER_ID_ from X_CPWLXHQD where PART_NO='15010011' and DOP_ORDER_ID='22';
 end;  WHILE AALEVEL_<>0 LOOP
   begin
     select DOP_STRUCTURE_LEVEL,QTY_PER_ASSEMBLY,PARENT_DOP_ORDER_ID 
     into AALEVEL_,tempa_,PARENT_DOP_ORDER_ID_ from X_CPWLXHQD
     where DOP_ORDER_ID=21 and DOP_STRUCTURE_LEVEL=3;
     temp_:=tempa_*temp_;
     AALEVEL_:=AALEVEL_-1;
   end loop;
这是本人在oracle的一个函数中的一段代码,在调试时出现这个错误:
ORA-06550:line 7,coumln 3:
PLS-00103:Encounttered the symbol "WHILE"
请教这个错误是什么错误,应如何解决

解决方案 »

  1.   

    loop
       exit while AALEVEL_ =0;
      

  2.   

    loopend loop;
    是一对啊,期间写不循环的判断
      

  3.   

    ORA-06550:line 7,coumln 3: 
    PLS-00103:Encounttered the symbol "WHILE" 应该没问题啊,检查下拼写标点呢
      

  4.   

    declare
      AALEVEL_             number;
      temp_                number;
      PARENT_DOP_ORDER_ID_ number;
      tempa_               number;
    begin
      select DOP_STRUCTURE_LEVEL, QTY_PER_ASSEMBLY, PARENT_DOP_ORDER_ID
        into AALEVEL_, temp_, PARENT_DOP_ORDER_ID_
        from X_CPWLXHQD
       where PART_NO = '15010011'
         and DOP_ORDER_ID = '22';  WHILE AALEVEL_ <> 0 LOOP
      
        select DOP_STRUCTURE_LEVEL, QTY_PER_ASSEMBLY, PARENT_DOP_ORDER_ID
          into AALEVEL_, tempa_, PARENT_DOP_ORDER_ID_
          from X_CPWLXHQD
         where DOP_ORDER_ID = 21
           and DOP_STRUCTURE_LEVEL = 3;
        temp_    := tempa_ * temp_;
        AALEVEL_ := AALEVEL_ - 1;
      end loop;
    end;
      

  5.   

    前面begin...end表示代码已经结束了吧。为什么在while前面有end呢?应该放在最后吧?
      

  6.   

    应该就是 begin 和end 的原因 ,典型的 SQLserver 的写法