----------综合例子 (过) (游标定义方法2中 / 跳出循环2中)
set serveroutput on

DECLARE
type re_sga is record( name V_$SGA.name%type );
type ru_sga is ref CURSOR;
-- cs_sga ru_sga;
te_sga re_sga;
CURSOR cs_sga IS select name from V_$SGA;
begin
-- open cs_sga for select name from V_$SGA;
open cs_sga ;
LOOP
FETCH cs_sga into te_sga.name;
-- exit when cs_sga%NOTFOUND; -- 想到与 if + break
-- exit when te_sga.name like 'Variable %';
if te_sga.name like 'Variable %' THEN
dbms_output.put_line(' if + break ');
exit;
end if;
dbms_output.put_line('name='||te_sga.name);
end LOOP;
close cs_sga;
dbms_output.put_line('end');
end;
/