世娱网
您的当前位置:首页OraclePLSQL在游标中用while循环实例程序

OraclePLSQL在游标中用while循环实例程序

来源:世娱网


//实例二

关于cursor循环,有两种方式:
1. 使用loop, exit (不用while)
如:
loop
fetch emp_cur into v_emp;
exit when emp_cur%notfound;
dbms_output.put_line(v_emp.ename);
end loop;
2. 使用while, 这时先要fetch
fetch emp_cur into v_emp;
while (emp_cur%found)
loop
dbms_output.put_line(v_emp.ename);
fetch emp_cur into v_emp;
end loop;

?>

显示全文