游标的使用 Oracle 中Cursor 是非常有用的,用于遍历临时表中的查询结果。

 

将emp表中"ename"和"deptno"查询出,存放到cusor_01游标中。for循环迭代游标集合。每次迭代的结果存到‘c’中。


Oracle的存储过程编程 第八讲:游标的使用

 create or replace procedure test01 is
 
   
       cursor cusor_1 is select ename,deptno from emp ;--定义一个游标
 
begin
 
       for c in cusor_1 loop
           dbms_output.put_line('员工姓名:'||c.ename||'  部门编号:'||c.deptno);
       end loop;
  
    
 
end test01;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

相关文章:

  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
  • 2022-12-23
  • 2021-04-28
  • 2021-12-28
  • 2021-12-21
猜你喜欢
  • 2021-08-14
  • 2022-12-23
  • 2021-07-27
  • 2022-12-23
  • 2021-09-26
  • 2022-01-13
  • 2022-12-23
相关资源
相似解决方案