drop table e1 purge;

create table e1 as select * from emp;

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


create or replace procedure e1_sal_update_proc (no e1.empno%type)

is

 v_ename   e1.ename%type;

 v_sal_inc number := 100;

begin

 update e1

 set sal = sal + v_sal_inc

 where empno = no;


 if sql%notfound then

   p('급여를 올려줄 사원 '||to_char(no)||'는 존재하지 않습니다.');

 end if;


end;

/

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


select empno, ename, sal from e1 where empno = 7788;

exec e1_sal_update_proc(7788)

select empno, ename, sal from e1 where empno = 7788;


exec e1_sal_update_proc(1234)


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

15일차 # 4-19: SQL Cursor = Implicit Cursor  (0) 2012.04.24
15일차 # 4-17: Merge (Upsert)  (0) 2012.04.24
15일차 # 4-12: Name Precedence  (0) 2012.04.24
15일차 # 4-5, 7: SELECT  (0) 2012.04.24
15일차 # 4-3: SQL Statements in PL/SQL  (0) 2012.04.24

+ Recent posts