* NOT need: OPEN, FETCH, CLOSE, and variables to hold the fetched data
==> FOR LOOP 문에서 OPEN, FETCH, CLOSE가 자동적으로 실행됨
* implicit record ( ex. rec_emp_cur )
==> cursor for loop를 벗어나면 접근 불가
declare
cursor emp_cur is
select empno, ename, job, sal*1.3 as sal
from emp
where deptno = 10;
begin
for rec_emp_cur in emp_cur loop --> implicit record
p(rec_emp_cur.job||', '||rec_emp_cur.ename||'('||rec_emp_cur.empno
||')''s salary is '||rec_emp_cur.sal);
p(emp_cur%rowcount||' rows processed');
end loop;
-- p(emp_cur%rowcount||' rows processed');
-- p(rec_emp_cur.job||', '||rec_emp_cur.ename||'('||rec_emp_cur.empno
-- ||')''s salary is '||rec_emp_cur.sal);
end;
/
'Oracle > PL/SQL' 카테고리의 다른 글
15일차 # 7-21: Cursor with Parameters (0) | 2012.04.24 |
---|---|
15일차 # 7-20: (Implicit) Cursor For Loop using Subquery (0) | 2012.04.24 |
15일차 # 7-14: Cursor (0) | 2012.04.24 |
15일차 # 7-17: Explicit Cursor Attributes (0) | 2012.04.24 |
15일차 # 7-5: Controlling Explicit Cursors (0) | 2012.04.24 |