/*
OPEN, FETCH, CLOSE, %FOUND煙 覿覿 螳 .
RPAD() 2覯讌 襷り覲 覈 襷 3覯讌 襷り覲 蠍襯 豈譴.
*/
DECLARE CURSOR cur_emp IS
SELECT empno, ename, deptno FROM emp;
BEGIN
DECLARE row_count PLS_INTEGER;
BEGIN
DBMS_OUTPUT.PUT_LINE(RPAD('empno', 5, ' ') || ' ' ||
RPAD('ename', 10, ' ') || ' ' ||
RPAD('deptno', 6, ' '));
DBMS_OUTPUT.PUT_LINE('-----' || ' ' || '----------' || ' ' || '------');
<>
FOR cur IN cur_emp LOOP
--empno : 4, ename : 10, deptno : 2
DBMS_OUTPUT.PUT_LINE(RPAD(cur.empno, 4, ' ') || ' ' ||
RPAD(cur.ename, 10, ' ') || ' ' ||
RPAD(cur.deptno, 2, ' '));
row_count := cur_emp%ROWCOUNT; --For 襭 覓旧朱 貉れ襯 螻
--覦覲牛蠍 覓語 伎螳 伎 .
END LOOP cursor_loop;
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('ROW COUNT : ' || row_count);
END;
END;
/
====
蟆郁骸
====
empno ename deptno
----- ---------- ------
7369 SMITH 20
7499 ALLEN 30
7521 WARD 30
7566 JONES 20
7654 MARTIN 30
7698 BLAKE 30
7782 CLARK 10
7788 SCOTT 20
7839 KING 10
7844 TURNER 30
7876 ADAMS 20
7900 JAMES 30
7902 FORD 20
7934 MILLER 10
ROW COUNT : 14
PL/SQL 豌襴螳 朱 襭給.