create or REPLACE procedure proc_alt
as
 cursor cur_query is
 SELECT * FROM pet
 inner join pet_type
 on pet.petid = pet_type.ids;
 
begin
  --打开游标
  from item  in cur_query loop
  dbms_output.put_line('宠物编号:'||item.pet_ids||',宠物名称:'||item.Pet_petname||',宠物类型:'||item.type_peytype||',宠物生命:'||item.pet_petpower);
  end loop;
  CLOSE cur_query;
end;错误(11,3): PLS-00103: 出现符号 "FROM"在需要下列之一时:  begin case    declare exit for goto if loop mod null pragma raise return    select update while with <an identifier>    <a double-quoted delimited-identifier> <a bind variable> <<    close current delete fetch lock insert open rollback    savepoint set sql execute commit forall merge pipe 符号 "for在 "FROM" 继续之前已插入。 

解决方案 »

  1.   

    神人也
    FROM ITEM IN CUR_QUERY
    --修改为:
    FOR ITEM IN CUR_QUERY--删除:CLOSE cur_query;  因为for 循环对游标自动打开自动关闭。
      

  2.   

    from item in cur_query loop
    改为
    for item in cur_query loop
      

  3.   

    你这个是游标型for循环
    1)from item in cur_query loop
      改为:for ittem ....
    2)把CLOSE cur_query删除