1.
1个入参 返回值
function get_****t(p_deptid varchar2) return varchar2 as
o_result varchar2(50);
begin
select a.emp_no || '/' || a.emp_name
into o_result
from employee a
inner join **** b
on a.emp_id = b.emp_id
inner join **** c
on c.id = b.dept_position_id
inner join **** d
on d.id = c.dept_id
where exists (select 0
from ****
where form_kind = '****'
and field_name = '****'
and item_value = c.position_id)
and a.active = 'Y'
and rownum < 2
and d.dept_id = p_deptid;
return(o_result);
exception
when others then
return('');
end;
2. procedure get_****(p_deptid in varchar2, check_person out varchar2) as begin select get_****(p_deptid) into check_person from dual; --若无,获取 if check_person is null then select get_****(p_deptid) into check_person from dual; end if; --若无,则获取 if check_person is null then select get_****(p_deptid) into check_person from dual; end if; --若无,则获取 if check_person is null then select get_****(p_deptid) into check_person from dual; end if; end;