상세 컨텐츠

본문 제목

Oracle Cursor (for Loop)

DataBase/Oracle

by 탑~! 2012. 8. 9. 11:14

본문


Oracle Cursor 


CREATE OR REPLACE PROCEDURE p_emp_info
          (p_dept_id s_emp.dept_id%TYPE)
IS
          CURSOR  c_emp_sal  IS
                    SELECT last_name, salary
                    FROM s_emp
                    WHERE dept_id = p_dept_id;
BEGIN
          FOR emp_rec  IN  c_emp_sal  LOOP
                    DBMS_OUTPUT.PUT_LINE(emp_rec.last_name ||  ' ' || emp_rec.salary);

관련글 더보기