Oracle隐式游标:
不用明确建立游标变量,Oracle隐式游标分两种:
1.在PL/SQL中使用DML语言,使用ORACLE提供的名为“SQL”的隐示游标。
举例:
declare
begin
update departments set department_namedepartment_name=department_name;
--where 1=2;
dbms_output.put_line('update '|| sql%rowcount ||' records');
end;
/
2.CURSOR FOR LOOP,用于for loop 语句
举例:
declare
begin
for my_dept_rec in ( select department_name, department_id from departments)
loop
dbms_output.put_line(my_dept_rec.department_id || ' : ' || my_dept_rec.department_name);
end loop;
end;
/