Professional Documents
Culture Documents
BAHRIA UNIVERSITY, (Karachi Campus) : Department of Software Engineering
BAHRIA UNIVERSITY, (Karachi Campus) : Department of Software Engineering
DATA OF PATIENT – Patient Name, Patient Id, Patient Blood Group, Patient Disease, Account
Creation date , Date of Birth
DATA OF DONOR – Donor Name, Donor Id, Donor Blood Group, Donor Medical report, Donor
Address, Donor Contact number, Date of Birth , Donation Count, Donation Date, Account Creation
date
DATA OF BLOOD BANK – Blood Bank Name, Blood Bank Address, Blood bank Donors name,
Blood Bank Contact Number, Blood Bank Address
Try to implement such scenario in a database and normalize or de-normalize it if needed, create an
object for patient diseases and implement following functions and procedure in a single
application using any method :
1. Show all donor and patient record.
2. Create a function which will increase donation count if user give donation.
3. Create a table of doctor which will hold doctor (Doctor Name, Doctor Id, and Doctor
Qualification) and it will hold reference of patient.
4. Create a procedure which will display Donor name, Account Creation Date, no day’s user
register, no of months up till now from donation date.
5. Create a function in which show list of hospitals using Varray.
Objects:
I have create Patient Info Object that contains all the common attributes needed
for Donor table and Patient Table
I have create Address Object that is used in every table / varray where the Address
is needed.
I have created Patient Disease object that is used inside the Patient table.
Tables:
I have create Patient table that uses Person Info object and Patient disease object.
I have create Donor table that uses Person Info object and Address object.
Insert Values:
Insert some dummy data in Patient Table
Donor Table:
Code:
select d.DonorInfo.PatientID,
d.DonorInfo.PatientName,d.DonorInfo.BloodGroup,d.DonorInfo.contact,d.DonorInfo.DOB,
d.DonorInfo.AccountCreationDate,
MedicalReport, d.DonorAddress.Houseno, d.DonorAddress.street,d.DonorAddress.city,
DonationCount, Donation from Donor d;
Patient Table:
Code:
select p.PInfo.PatientID,
p.PInfo.PatientName,p.PInfo.BloodGroup,p.PInfo.contact,p.PInfo.DOB,
p.PInfo.AccountCreationDate,
p.PDisease.Dname, p.PDisease.DType from Patient p;
Task # 2: Create a function, which will increase donation count if user give
donation.
Code:
Output:
Task # 3: Create a table of doctor which will hold doctor (Doctor Name, Doctor
Id, and Doctor Qualification) and it will hold reference of patient.
Task # 4: Create a procedure which will display Donor name, Account Creation
Date, no day’s user register, no of months up till now from donation date.
Code:
Output:
We have:
First Created Hospital_Type Object
Then, Created Array of Hospital_Type Object
And in last, Inserted and displayed values in varray
Code:
Output:
Code:
create table dept_A(
dept_name varchar2(25),
dept_id number(5),
dep_strength number,
company_profits float
);
insert into Employees values(e_sequence.nextval, 'Sadia', 'Sales And Profits', 22, '1027 E. Philadelphia
St')
insert into Employees values(e_sequence.nextval, 'Sadia', 'Sales And Profits', 22, '1027 E. Philadelphia
St')
pt_id number(5),
dep_strength number,
marketing_percentage float
);
insert into Employees values(e_sequence.nextval, 'Sadia', 'Sales And Profits', 22, '1027 E. Philadelphia
St')
end productivity;
procedure list_employees
is
cursor abc is select * from Employees;
begin
dbms_output.put_line('Sadia Afzal 02-131182-022');
for i in abc
loop
dbms_output.put_line('Employee Name :- ' || i.emp_name || ' Employee ID :- ' || i.emp_id || ' Employee
Department :- ' || i.emp_dept);
end loop;
end list_employees;
procedure list_deptA
is
cursor abc is select * from dept_A;
begin
dbms_output.put_line('Sadia Afzal 02-131182-022');
for i in abc
loop
dbms_output.put_line('Department Name :- ' || i.dept_name || ' Department ID :- ' || i.dept_id || '
Department Strength :- ' || i.dep_strength);
end loop;
end list_deptA;
procedure list_deptB
is
cursor abc is select * from dept_B;
begin
dbms_output.put_line('Sadia Afzal 02-131182-022');
for i in abc
loop
dbms_output.put_line('Department Name :- ' || i.dept_name || ' Department ID :- ' || i.dept_id || '
Department Strength :- ' || i.dep_strength);
end loop;
end list_deptB;
procedure list_deptC
is
cursor abc is select * from dept_C;
begin
dbms_output.put_line('Sadia Afzal 02-131182-022');
for i in abc
loop
dbms_output.put_line('Department Name :- ' || i.dept_name || ' Department ID :- ' || i.dept_id || '
Department Strength :- ' || i.dep_strength);
end loop;
end list_deptC;
procedure list_productivity
is
cursor abc is select * from dept_A;
cursor pqr is select * from dept_B;
cursor xyz is select * from dept_C;
Begin
dbms_output.put_line('Sadia Afzal 02-131182-022');
for i in abc
loop
dbms_output.put_line('Profits Generated By Department A :- ' || i.company_profits);
end loop;
for l in pqr
loop
dbms_output.put_line('Marketing Percentage of Department B :- ' || l.marketing_percentage);
end loop;
for k in xyz
loop
dbms_output.put_line('Production generated from Department C :- ' || k.production);
end loop;
end list_productivity;
end productivity;