create or replace procedure up_emp_ename_sal (

   a in  emp.empno%type

 , b out emp.ename%type

 , c out emp.sal%type

)

is

begin

 select ename, sal into b, c

 from emp

 where empno = a;

end;

/


  --------------

  > 사용방법 1 <

  --------------


var g_empno number

exec :g_empno := 7788


var g_ename varchar2(30)

var g_sal   number


exec up_emp_ename_sal(:g_empno, :g_ename, :g_sal)                  --> positional

print g_ename g_sal


exec up_emp_ename_sal(a => :g_empno, c => :g_sal, b => :g_ename)   --> named

print g_ename g_sal


exec up_emp_ename_sal(:g_empno, c => :g_sal, b => :g_ename)        --> combination

print g_ename g_sal


  --------------

  > 사용방법 2 <

  --------------


set serveroutput on


declare

 v_ename emp.ename%type;

 v_sal   emp.sal%type;

begin

 up_emp_ename_sal(7788, v_ename, v_sal);

 p(v_ename);

 p(v_sal);

end;

/


'Oracle > PL/SQL' 카테고리의 다른 글

15일차 # 1-11  (0) 2012.04.24
15일차 # 1-10  (0) 2012.04.24
15일차 PL/SQL Program Unit Chapter 1 - Procedures  (0) 2012.04.24
15일차 # 8-22: [5] RAISE_APPLICATION_ERROR 프로시져  (0) 2012.04.24
15일차 # 8-18: [4] define  (0) 2012.04.24

+ Recent posts