-- 将游标中的数据 读取到table中 根据部门编号获得emp所有信息。 declare cursor c(no emp.deptno%type)is select * from emp where deptno=no; --1.定义游标 type emp_table_type is table of emp%rowtype index by binary_integer; --2.定义table emp_table emp_table_type; --4.使用 table row1 emp%rowtype; --3.定义 rowtype begin open c(30); --输入部门编号 fetch c bulk collect into emp_table; --批量导入 for i in emp_table.first..emp_table.last -- for 循环便利 从table中的 first 到 last emp_table.first..emp_table.last loop dbms_output.put_line( 'cursor 编号'||i|| '------员工编号=='||emp_table(i).empno|| '------员工姓名=='||emp_table(i).ename ); end loop; close c; end;
plsql 将游标读取到table中
猜你喜欢
转载自www.cnblogs.com/ZXF6/p/11234104.html
今日推荐
周排行