create or replace procedure up_emp_sawon (
p_empno in emp.empno%type
, p_emp_rec out emp%rowtype
)
is
begin
select * into p_emp_rec
from emp
where empno = p_empno;
end;
/
----------
> 활용 1 <
----------
declare
emp_rec emp%rowtype;
begin
up_emp_sawon(7788, emp_rec);
p(emp_rec.ename);
p(emp_rec.sal);
end;
/
----------
> 활용 2 <
----------
declare
emp_rec emp%rowtype;
begin
for r in (select empno from emp) loop
up_emp_sawon(r.empno, emp_rec);
p(emp_rec.ename||' '||emp_rec.job||' '||emp_rec.sal);
end loop;
end;
/
'Oracle > PL/SQL' 카테고리의 다른 글
15일차 # 1-13 (0) | 2012.04.24 |
---|---|
15일차 # 1-11 (0) | 2012.04.24 |
15일차 # 1-6 (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 |