日期:2014-05-17 浏览次数:20974 次
conn scott/tiger
drop table t1 purge;
create table t1 as select ename,deptno from emp;
alter table t1 add(dname varchar2(18));
select * from t1;
--For update游标,所更改的行既是当前游标所指定的行。
DECLARE
CURSOR c1 is select * from t1 for update;
v1 dept.dname%type;
BEGIN
for n1 in c1 loop
select dname into v1 from dept where deptno=n1.deptno;
update t1 set dname=v1 WHERE CURRENT OF C1;
end loop;
END;
/