Oracle 中的游标用法
循环将游标中的数据提取出来并放置2个变量中输出
SQL> declare2 cursor dept_cur is select d.deptno,d.dname from scott.dept d;3 dno scott.dept.deptno%type;4 dnm scott.dept.dname%type;5begin6 open dept_cur;7 loop8 fetch dept_cur into dno,dnm;9 exit when dept_cur%notfound; 10 dbms_output.put_line(dno||' '||dnm); 11 end loop; 12 close dept_cur; 13end; 14/ 10 ACCOUNTING20 RESEARCH30 SALES40 OPERATIONS
页:
[1]