Programs Procedures and Functions
Programs Procedures and Functions
Programs on Functions
INPUT:
declare
num number;
count1 number;
begin
num:=#
count1:=prime(num);
if count1>2 then
dbms_output.put_line(num||''||'is not a prime number');
else
dbms_output.put_line(num|| ''||'is prime');
end if;
end;
Write a program to check for the existence of P# in the table parts
INPUT:
declare
n p.p#%type;
i number;
begin
n:='&n';
i:=ex(n);
if i=1 then
dbms_output.put_line('given'||''||n||'is in the table');
end if;
exception
when no_data_found then
dbms_output.put_line('given'||''||n||'is not in the table');
end;
Programs on Packages
a) To insert an Employee
b) To delete an Employee
c) To List employees in a given Dept (Deptno/Dept name)
Package Specification:
Package Body:
Procedure
1.Write a procedure to update salary of given employee by 10%
2. Write a procedure to count number of students taken the given course
3.Write a procedure to list the number courses taken by the given instructor
4. Write a procedure to find the sum of salaries of employees belongs to given department
name
Functions
1. Write a function to find the given number is palindrome or not
2. Write a function to count number of students taken the given course
3. Write a function to average salary of the given department
4. Write a function to find the employees working under given manager
Create a student package which find the total courses, total credits ,name of the course opted by
the student