PL/SQL Function to Accept Emp No and Returns Employee Details

PL/SQL Function to Accept Emp No and Returns Employee Details:

create or replace function detail(no in number)
return varchar is tot_det varchar(50);
vid number;
vname varchar(15);
vsal number;
begin
select id,name,salary into vid,vname,vsal from employee where id=no;
tot_det:=vid||' '||vname||' '||vsal;
return(tot_det);
end;

Calling Function:

select detail(1) from dual;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.