ed empCnt
create or replace function empCnt
(v_number in number)
return varchar2
is
v_cnt number;
v_empcnt varchar2(100);
v_page number;
begin
select count(*) into v_cnt from emp;
v_page :=ceil(v_cnt/v_number);
v_empcnt := v_cnt || '/'|| v_page;
return v_empcnt;
end;
/
-------------------------------------------
create or replace function empno_mgr
(v_empno emp.empno%type)
return varchar2
is
v_mgr varchar2(100);
v_deptno number;
v_ename varchar2(100);
v_dname varchar2(100);
begin
select mgr,deptno into v_mgr,v_deptno from emp where empno=v_empno;
select ename into v_ename from emp where empno=v_mgr;
select dname into v_dname from dept where deptno=v_deptno;
dbms_output.put_line('사원번호:'||v_mgr);
dbms_output.put_line('성 명:'||v_ename);
dbms_output.put_line('부 서 명:'||v_dname);
return v_mgr;
end;
/
'개발 > sql' 카테고리의 다른 글
oracle sql procedure (0) | 2015.10.08 |
---|---|
oracle sql function,procedure (0) | 2015.10.08 |
oracle sql 서브쿼리,function,no_data_found,too_many_rows,others (0) | 2015.10.07 |
oracle sql function, dual,upper (0) | 2015.10.06 |
oracle sql cursor update,delete, 무결성 제약조건 (0) | 2015.10.06 |
댓글