create or replace function f1(p_deptno1 number,p_deptno2 number)
return varchar2
is
v_con1 number(3);
v_con2 number(3);
v_dname varchar2(20);
begin
select count(*) into v_con1 from emp where deptno=p_deptno1;
select count(*) into v_con2 from emp where deptno=p_deptno2;

if v_con1>v_con2 then
select dname into v_dname from dept where deptno=p_deptno1;
else
select dname into v_dname from dept where deptno=p_deptno2;
end if;
return v_dname;
end;

/

declare
v_dname varchar2(20);
begin
v_dname := f1(30,20);
dbms_output.put_line(v_dname);
end;