소리소문 없이... 사랑도 명예도 이름도 남김 없이...
DexCore.net

DataBase/Oracle

Oracle Cursor (for Loop)

탑~! 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);

728x90
반응형