create or replace procedure up_hp_format (a in out varchar2)

is

begin

 if length(trim(a)) = 11 then

   a := substr(a, 1, 3)||'-'||substr(a, 4, 4)||'-'||substr(a, 8);

 else

   a := substr(a, 1, 3)||'-'||substr(a, 4, 3)||'-'||substr(a, 7);

 end if;

end;

/



set autoprint on

var g_hp varchar2(30)


exec :g_hp := '0107779999'

exec up_hp_format(:g_hp)


exec :g_hp := '01077779999'

exec up_hp_format(:g_hp)

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

15일차 # 1-16: DEFAULT  (0) 2012.04.24
15일차 # 문제  (0) 2012.04.24
15일차 # 1-11  (0) 2012.04.24
15일차 # 1-10  (0) 2012.04.24
15일차 # 1-6  (0) 2012.04.24

+ Recent posts