EMP表在SCOTT用户下。用SCOTT/TIGER登录。


代码:

DECLARE
CURSOR C_JOB IS SELECT EMPNO, ENAME, JOB, SAL FROM EMP WHERE JOB = 'MANAGER';
C_ROW C_JOB%ROWTYPE;
BEGIN
  FOR C_ROW IN C_JOB LOOP
    DBMS_OUTPUT.put_line(C_ROW.EMPNO || '-' || C_ROW.ENAME || '-' || C_ROW.JOB || '-' || C_ROW.SAL);
  END LOOP;
END;



执行后输出:

7566-JONES-MANAGER-2975
7698-BLAKE-MANAGER-2850
7782-CLARK-MANAGER-2450