create or replace function parent_insert
return number           就是在此处出错.莫名其妙.
aschild_item_no part_temp_bse.item_no_child%TYPE;
parnet_item_no part_temp_bse.item_no_parent%TYPE;
parnet_item_no2 MFG_BOM_MASTER.BKC_CD%TYPE;
cursor item_cur is
select item_no_child,item_no_parent
from part_temp_bse;begin
 
 open item_cur;
 fetch item_cur into child_item_no,parnet_item_no;
 while item_cur%found
 loop
      if parnet_item_no is null then
    begin
            SELECT D.BKC_CD
            into parnet_item_no2
               FROM (SELECT * FROM MFG_BOM_MASTER
               CONNECT BY PRIOR CHILD_ITEM_CD=BKC_CD
               START WITH CHILD_ITEM_CD='A1605830A') D,ITEM_MASTER I
               WHERE D.BKC_CD=I.ITEM_NO
               AND I.ITEM_TYPE=21;
      
               insert into part_temp_bse
                       ( item_no_parent  )
                  values
                       ( parnet_item_no2   ); 
   
   end;            

end if;
   end loop;
 close item_cur;
 return 0;
 
   exception
      when others then
          if  SQL%NOTFOUND then
              return -1403;
          end if;
    return SQLCODE;
end;

解决方案 »

  1.   

    问题搞定了吗>?PLS-00103 found 'string' but expected one of the following: 'string'"},Cause: This error message is from the parser. It found a token (language element) that is inappropriate in this context.Action: Check previous tokens as well as the one given in the error message. The line and column numbers given in the error message refer to the end of the faulty language construct.
      

  2.   

    还有一问:
    上面代码中
    while item_cur%found
     loop
               .......
              end loop为什么item_cur的值为(Rowcount = 0, %open, %notfound, first iteration)
    表里有一条数据啊.