oracle遊標批次處理資料

EPIHPANY發表於2024-07-25
declare
  cursor cur_emp is
    select * from emp;
  type type_cur_emp_list is table of cur_emp%rowtype;
  v_emp_rows type_cur_emp_list;
begin
  open cur_emp;
  loop
    exit when cur_emp%notfound;
    fetch cur_emp bulk collect
      into v_emp_rows limit 5;
    for i in 1 .. v_emp_rows.count loop
      dbms_output.put_line(v_emp_rows(i).ename);
    end loop;
  end loop;
  close cur_emp;
end;
/

相關文章