Write a function which accepts employee name and prints the details of the project which the employee works on.


Write a function which accepts employee name and prints the details of the project which the employee works on. 






Write a function which accepts employee name and prints the details of the project which the employee works on. 


-->>>>


create or replace function ep(v varchar(50)) returns int as

'

declare

r1 record;

 ch int := 0;

begin

for r1 in select  pname,stratdate, status from employee,project where  employee.pno=project.pno AND ename= v

 loop

 raise notice ''% % %  '', r1.pname,r1.stratdate, r1.status;

ch := ch+1;

end loop;

return ch;

end;

'language'plpgsql';



Out put of function


Acode2=# select ep ('Acode');


o\p 


Acode2=# select ep ('Acode');

NOTICE:  aa 2020-11-05 xyz  

 ep 

----

  1

(1 row)




Post a Comment

0 Comments