0% found this document useful (0 votes)
23 views4 pages

Experiment No 8: Study and Implementation of Stored Procedures

The document describes stored procedures to retrieve patient data from a database table. The first procedure retrieves a patient ID from the PATIENT table where the D_ID is 4. The next procedures return: 1) the count of male patients by selecting patients where the sex is 'M', 2) the count of female patients where the sex is 'F', and 3) the count of patients under age 12 where the age is less than 12. Each procedure outputs the results.

Uploaded by

project mission
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views4 pages

Experiment No 8: Study and Implementation of Stored Procedures

The document describes stored procedures to retrieve patient data from a database table. The first procedure retrieves a patient ID from the PATIENT table where the D_ID is 4. The next procedures return: 1) the count of male patients by selecting patients where the sex is 'M', 2) the count of female patients where the sex is 'F', and 3) the count of patients under age 12 where the age is less than 12. Each procedure outputs the results.

Uploaded by

project mission
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

EXPERIMENT NO 8

Study and Implementation of Stored Procedures

1.(a)
 CREATE OR REPLACE PROCEDURE GETD
AS getP PATIENT.D_ID%TYPE;
BEGIN
SELECT P_ID INTO getP
FROM PATIENT
where D_ID=4;
DBMS_OUTPUT.put_line( getP );
END;
1.(C)
(i) Count of male patients:
 create or replace PROCEDURE GETD1
AS getP1 PATIENT. p_sex%TYPE;

BEGIN
SELECT count( P_ID) INTO getP1
FROM PATIENT
where p_sex='M';
DBMS_OUTPUT.put_line(getP1);
END;

(ii) Count of female patients:


 create or replace PROCEDURE GETD
AS getP PATIENT. p_sex%TYPE;

BEGIN
SELECT count( P_ID) INTO getP
FROM PATIENT
where p_sex='F';
DBMS_OUTPUT.put_line(getP);
END;
(iii) Count of patients under age 12.
create or replace PROCEDURE GETD2
AS getP PATIENT.P_AGE%TYPE;

BEGIN
SELECT count( P_ID) INTO getP
FROM PATIENT
where P_AGE<12;
DBMS_OUTPUT.put_line(getP);

END;

You might also like