Anda di halaman 1dari 2

Example

Create a package which stores the procedures for insert and delete for the given
table.
Applicant(Aid,Aname,Addr,Adob)
Solution
Package Specification
create or replace package ins_del
as
procedure ins_data(ano in applicant.aid%type,an in applicant.Aname%type,ad in
applicant.addr%type,abdt in applicant.adob%type);
procedure del_data(ano in applicant.aid%type);
end ins_del;
Package Body
create or replace package body ins_del
as
procedure ins_data(ano in applicant.aid%type,an in applicant.Aname%type,ad in
applicant.addr%type,abdt in applicant.adob%type)
is
begin
insert into applicant values(ano,an,ad,abdt);
end ins_data;
procedure del_data(ano in applicant.aid%type)
is
begin
delete from applicant where aid=ano;
end del_data;
end ins_del;
Calling Package
begin
ins_del.del_data('1');
ins_del.ins_data(1,'AAA','SSS','1-DEC-2011');
end;

Example
Write a Package to count the total number of applicant whose age is less then
the input value of years in one function and display the applicants satisfying
this condition in another procedure.
Solution

Anda mungkin juga menyukai