
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
INFO 2303
Assignment # : PL/SQL Procedure & Function Practice
Note: PL/SQL can be executed in SQL*Plus or SQL Developer or Oracle Live SQL.
Write a function that takes patient date of birth. If the patient born after 30th June 1990 then he/she will be required to set appointment for immunization. Call this function from anonymous block to allow the user to enter the patient ID.
Expected output:
Enter the patient ID: 168
The status of X-immunization : REQUIRED

Transcribed Image Text:CREATE TABLE PATIENT
(PT_ID
PT LNAME
PT FNAME
PTDOB
DOC ID
NEXTAPPTDATE
NUMBER(3),
VARCHAR2(15),
VARCHAR2(15),
DATE,
NUMBER(3).
DATE,
DATE,
LASTAPPTDATE
CONSTRAINT PATIENT_PT_ID PK PRIMARY KEY
(PT_ID),
CONSTRAINT PATIENT_DOC_ID_FK FOREIGN
KEY(DOC_ID)
REFERENCES DOCTOR);
INSERT INTO patient VALUES(168, James', "Paur.
TO DATE('14-MAR-97'), 432.
TO DATE(01-JUL-03'), TO DATE(01-JUN-03'):
INSERT INTO patient VALUES(331, 'Anderson', 'Brian',
TO DATE(06-MAR-48'), 235.
TO DATE(01-JUL-03'). TO DATE(01-JUN-03')):
INSERT INTO patient VALUES(313, James', "Scott.
TO DATE(01-MAR-33'). 235.
TO DATE(20-JUL-03'). TO DATE(20-JUN-03'):
INSERT INTO patient VALUES(816, 'Smith', "Jason',
TO DATE('12-DEC-99), 509.
TO DATE('15-NOv-03). TO DATE('15-MAY-03'):
INSERT INTO patient VALUES(314, Porter, "Susan',
TO DATE('14-NOV-67), 235.
TO DATE(01-0CT-03). TO DATE(01-MAR-03'):
INSERT INTO patient VALUES(315. 'Saillez', "Debbie',
TO DATE(09-SEP-55'), 235,
TO DATE(01-JUL-03'). TO_DATE(01-JUN-03'):
INSERT INTO patient VALUES(719, "Rogers', "Anthony.
TO DATE(07-DEC-41). 504.
TO DATE(01-NOv-03), TO DATE(01-JAN-03'):
INSERT INTO patient VALUES(264, Walters', "Stephanie",
TO DATE(01-JAN-45'),
504, TO DATE('12-DEC-03'), TO DATE(12-DEC-02):
INSERT INTO patient VALUES(267, Westra', Lynn',
TO DATE('12-JUL-57'), 235.
TO DATE(02-FEB-04'), TO DATE(02-FEB-03')):
INSERT INTO patient VALUES(103, Poole', "Jennifer,
TO DATE('13-MAY-02'), 389,
TO DATE(01-DEC-03'), TO DATE(01-JUN-03')):
INSERT INTO patient VALUES(108, Baily. Ryan',
TO DATE(25-DEC-77'), 235.
TO DATE(06-JUN-05), TO DATE(06-JUN-03):
INSERT INTO patient VALUES(943, Crow, Lewis',
TO DATE(16-OCT-49'), 235.
TO DATE(01-JUL-05'). TO DATE(01-MAR-02);
INSERT INTO patient VALUES(847, 'Cochran', "John',
TO DATE('03-MAR-48'), 356.
TO DATE(02-DEC-05), TO DATE(01-JAN-02'):
INSERT INTO patient VALUES(163, Roach', "Becky',
TO DATE('08-SEP-75'), 235,
TO DATE(01-DEC-05), TO DATE(01-JAN-02):
INSERT INTO patient VALUES(504, 'Jackson', "John',
TO DATE('14-OCT-43'), 235.
TO DATE('21-JUL-03'). TO DATE(10-NOV-02'):
INSERT INTO patient VALUES(809, Kowalczyk', "Paul,
TO_DATE('12-NOV-51), 558,
TO DATE(29-JUL-03'). TO DATE(19-JUN-03'):
INSERT INTO patient VALUES(703, Davis', Linda',
TO DATE('17-JUL-02'), 509
TO DATE(21-JUL-03'), TO DATE(22-MAY-03):
INSERT INTO patient VALUES(307, Jones', 'J.C.,
TO DATE('17-JUL-02'), 509,
TO DATE(21-JUL-03'), TO DATE(22-MAY-03'):
INSERT INTO patient VALUES(439, Wright, "Chasity,
TO DATE(23-APR-73), 235,
TO_DATE("), TO DATE("):
INSERT INTO patient VALUES(696, Vanderchuck', Keith',
TO DATE(08-AUG-68').
504, TO DATE("). TO_DATE(15-JUN-03):
INSERT INTO patient VALUES(966, 'Moginnis', 'Allen',
TO DATE('03-MAY-59), 504,
TO DATE("). TO DATE(15-JUN-03'):
INSERT INTO patient VALUES(669, 'Sakic', 'Joe',
TO DATE('16-SEP-76'), 504,
TO DATE("). TO_DATE(15-JUN-03')):

Transcribed Image Text:4. Write a function that takes patient date of birth. If the patient born
after 30h June 1990 then he/she will be required to set appointment
for immunization. Call this function from anonymous block to allow
the user to enter the patient ID.
Expected output:
Enter the patient ID: 168
The status of X-immunization : REQUIRED
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Why would you assume that two select statements from the same database are consistent?arrow_forwardC++ Write a program that will allow a user to enter students into a database. The student information should include full name, student ID, GPA and status. The program should allow delete any student based on student ID.arrow_forwardCalculating the number of days that have passed between your birthday and the current date requires the usage of an Oracle function, which you should make advantage of.arrow_forward
- Develop a PL/SQL block that would go through all the employees from EMPLOYEES table who work in department id= 90 (there is suppose to be 3 employee who work in Department 90)- IN BEGIN END END SECTION; Execute 3 separate of SELECT statement one after the other. Each SELECT will pull first name. salary of each employee and store them in local variables.+ SELECT LOAD INTO v_firstname1, v_salarxlWHERE emrlexee.id=100 Then second WHERE emploxee.id3101+ SELECT first_name, salary INTO v_firstname2, v_salary2 Then third + SELECTSELECTI tirst.name, salary INTO v_firstname3, v_salary3 iin WHERE emploxee id=102 ..... You must now have 6 local variables. DECLARE all of them accordingly in DECLARE section and use them in BEGIN and END.+ Then add another SELECT statement in BEGIN-END to find company average salary SELECT xa(salary) INTO aKasal FROM EMPLOYEES; !!! Do not forget to create y avgsal local variable in DECLARE section.arrow_forwardTranslate the following pandas statement in Python to a SQL query so that it can be executed on the SQL database. dfdata[(10*dfdata['cases']>dfdata['cases'])&(dfdata['date']=='2020-10-10')]['county']arrow_forwardYou should use an Oracle function to determine the number of days since your birthday.arrow_forward
- Write three functions that are the “inverses” of to_secs:1. hours_in returns the whole integer number of hours represented by a total number ofseconds.2. minutes_in returns the whole integer number of left over minutes in a total number ofseconds, once the hours have been taken out.3. seconds_in returns the left over seconds represented by a total number of seconds.You may assume that the total number of seconds passed to these functions is an integerarrow_forwardWrite a script that creates and calls a function named fnStudentUnits that calculates the total course units of a student in the StudentCourses table. To do that, this function should accept one parameter for the student ID, and it should return the sum of the course units for the student. The SELECT statement that calls the function should return the StudentID from the StudentCourses table, the CourseNumber and CourseUnits from the Courses table, and the value return by the fnStudentUnits function for that student.arrow_forwardPlease provide examples of how calls and returns work together.arrow_forward
- Code should be in Python Prompt the user for a title for data. Output the title.Ex: Enter a title for the data: Number of Novels Authored You entered: Number of Novels Authored Prompt the user for the headers of two columns of a table. Output the column headers.Ex: Enter the column 1 header: Author name You entered: Author name Enter the column 2 header: Number of novels You entered: Number of novels Prompt the user for data points. Data points must be in this format: string, int. Store the information before the comma into a string variable and the information after the comma into an integer. The user will enter -1 when they have finished entering data points. Output the data points. Store the string components of the data points in a list of strings. Store the integer components of the data points in a list of integers.Ex: Enter a data point (-1 to stop input): Jane Austen, 6 Data string: Jane Austen Data integer: 6 Perform error checking for the data point entries. If any of the…arrow_forwardYou should use an Oracle function to determine the number of days that have transpired between your birthday and the current date.arrow_forwardNeed help writing SQL statements for these, I'm getting some errors for my returns.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education