desc user_source

col name format a20


select name, line, text

from user_source

where type = 'FUNCTION';



  * 유저가 생성한 함수의 개수 구하기


select count(distinct name)

from user_source

where type = 'FUNCTION';



   cf.) select count(name) --> distinct가 없는 경우

from user_source

where type = 'FUNCTION';



<Practice 2>

  a.

create or replace function get_job (p_empno emp.empno%type)

return varchar2

is

 v_ret emp.job%type;

begin

 select job into v_ret

 from emp

 where empno = p_empno;


 return v_ret;

end;

/

  b.

variable title varchar2(35)


exec :title := get_job(7788)

print title


select empno, ename, job

from emp

where empno = 7788;


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

15일차 # 3-10: PACKAGE BODY  (0) 2012.04.24
15일차 Chapter 3 - Packages I # 3-8: PACKAGE SPECIFICATION  (0) 2012.04.24
15일차 # 2-12  (0) 2012.04.24
15일차 # 2-11  (0) 2012.04.24
15일차 Chapter 2 - Functions  (0) 2012.04.24

+ Recent posts