declare
cursor ca is
select id_no, name from user where ym=201401;
begin
for cb in ca loop
update path set ename=cb.name where id_no=cb.id_no;
end loop;
commit;
end;
-------------
declare
--游标结构
cursor ca is select * from emp where deptno = 10;
--游标变量
carec ca%rowtype;
begin
-----------------
declare
--游标结构
cursor ca is select * from emp where deptno = 10;
--游标变量
onerow ca%rowtype;
begin
--打开游标
open ca;
loop
fetch ca into onerow;
exit when ca%notfound;
dbms_output.put_line(onerow.ename);
end loop;
close ca;
end;
-------------
declare
cursor ca(dno emp.deptno%type) is select * from emp where deptno = dno;
carec ca%rowtype;
begin
for carec in ca(10) loop
dbms_output.put_line(carec.ename);
end loop;
end;
--动态游标
declare
--动态游标数据类型
type cur is ref cursor;
--游标结构变量
mycur cur;
--行变量
cdept dept%rowtype;
cemp emp%rowtype;
begin
--动态游标绑定select * form dept;
open mycur for select * from dept;
loop
fetch mycur into cdept;
exit when mycur%notfound;
dbms_output.put_line(cdept.dname);
end loop;
dbms_output.put_line('--------------------------------');
open mycur for select * from emp;
loop
fetch mycur into cemp;
exit when mycur%notfound;
dbms_output.put_line(cemp.ename);
end loop;
close mycur;
end;
建议你百度.google吧