CREATE OR REPLACE PROCEDURE pro_test
AS
  CURSOR my_cursor IS SELECT * FROM table1;
  my_record my_cursor%ROWTYPE;
BEGIN
  FOR my_record IN my_cursor LOOP
    DBMS_OUTPUT.PUT_LINE('output:'||my_record.field1);
  END LOOP;
END;

解决方案 »

  1.   

    create or replace procedure pro
    is
      cursor My_cursor is
        select Field1 from Table1;
        
    begin
      for My_record in My_cursor loop
        MyProcedure(My_record.Field1);
      end loop;
    end;
    /
    MyProcedure视功能建立
      

  2.   

    create or replace procedure ptest
    is
      cursor my_cursor is select field1 from table1;
    begin
      for my_record in My_cursor loop
        MyProcedure(my_record.field1);
      end loop;
    end;
      

  3.   

    CREATE OR REPLACE PROCEDURE pro_test
    AS
      CURSOR my_cursor IS SELECT field1 FROM table1;
      my_cursor_r my_cursor%ROWTYPE;
    BEGIN
      FOR my_cursor_r IN my_cursor LOOP
        DBMS_OUTPUT.PUT_LINE('output:'||my_cursor_r.field1);
      END LOOP;
    END;
      

  4.   

    create or replace procedure procname
    as 
      cursor My_cursor is
        select Field1 from Table1;    
    begin
      for My_record in My_cursor loop
        MyProcedure(My_record.Field1);
      end loop;
    end;
    /