通过游标操纵数据库
数据在硬盘,游标在内存。
游标的定义
语法
CURSOR 游标名
IS select 列1,列2..
FROM 表
WHERE 条件
FROM updat[OF column][NOWAIT]
declare
cursor student_cursor
is
select *
from student
where dept = 'math'
for update of age;
begin
for student_record
in student_cursor
loop
dbms_output.put_line(student_record.sno||','||student_record.sname);
if student_record.age<18 then
update student
set age = 18
where current of student_cursor;
end if;
end loop;
end;
/