Wednesday, September 30, 2020

RDBMS PLSQL Program 24 Function to count number of employees in emp table and program to call it

Function

============================================

 CREATE OR REPLACE FUNCTION totalemps

RETURN number IS 

   total number(3) := 0; 

BEGIN 

   SELECT count(*) into total 

   FROM emp; 

    

   RETURN total; 

END; 

Program to call above function

======================================

set serveroutput on

DECLARE 

   e number(3); 

BEGIN 

   e := totalemps(); 

   dbms_output.put_line('Total no. of Employees: ' || e); 

END; 

/

No comments:

Post a Comment

Thanks for showing your interest
I will shortly get back to you