java 代码
- create or replace procedure test_cursor(row_count in number) is
- my_id number;
- row_index number;
- CURSOR c_cursor IS select id from mytable order by id;
- begin
- row_index := 0;
- open c_cursor;
- LOOP
- exit when row_index >= row_count;
- row_index := row_index + 1;
- FETCH c_cursor INTO my_id;
- dbms_output.put_line(my_id);
- if(c_cursor%NOTFOUND) then
- close c_cursor;
- open c_cursor;
- end if;
- end loop;
- close c_cursor;
- end test_cursor;