/*============================================================
示例7. 本地动态SQL 通过游标
============================================================*/
--查询部门30号的员工信息
DECLARE
TYPE emp_cur IS REF CURSOR;
my_emp_cur emp_cur;
my_emp_rec emp%ROWTYPE;
BEGIN
OPEN my_emp_cur FOR 'select * from emp where deptno=:x' USING 30;
LOOP
FETCH my_emp_cur INTO my_emp_rec;
EXIT WHEN my_emp_cur%NOTFOUND;
dbms_output.put_line(my_emp_rec.ename||'→'||my_emp_rec.sal);
END LOOP;
END;