调整下顺序就好了,呵呵
create or replace procedure AA_mytest(P1 in varchar2, P2 out varchar2) is
cellcode varchar2(30);
taskno      varchar2(4);
     CURSOR CURSOR_TEMP(cp1 VARCHAR2) IS
     select cell_code from cmd_cell t where t.product_code=cp1;
begin
     open CURSOR_TEMP(P1);
     loop
       FETCH CURSOR_TEMP INTO cellcode;
       
       dbms_output.put_line(cellcode);
       select task_no into taskno from wcs_task t where t.cell_code=cellcode;
        IF CURSOR_TEMP%NOTFOUND THEN
          EXIT;
        END IF;
     end loop;
end AA_mytest;