Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q 4 . ( 1 5 points ) Note that Q 5 and Q 6 are based on this question Q 4 . Write a
Q points Note that Q and Q are based on this question Q
Write a PLSQL block, in that program, define a local procedure named DeptHeadname. This procedure lives in that block only, it is also called nested procedure.
This procedure will have one IN parameter called Deptno and one OUT parameter called headname. It accepts the DepartmentID as IN parameter, and its OUT parameter will pass back the full name of manager who is the head manager of that department to the invoking program.
In the executable section, the program will invoke this procedure DeptHeadname with the department ID of as IN parameter value. The program will print out the department ID and the full name of its manager.
You have the experience with this kind query before. When use this query in PLSQL block, you need to change the literal value into a variable name.Q pointsThis question is based on question This time, you will change the local procedure in Q into a standalone procedure. Your program will consist of two parts. The first part is a program of "create or replace procedure" that will create a standalone procedure called DeptHeadname. Same structure as in Q You should finish the compilation of this "create procedure" code before you invoke that procedure.
After having successfully compiled the stand alone procedure, you will write a separate PLSQL block, in its executable section, the program will invoke this procedure passing the value of of department ID to the procedure, your program will store the OUT parameter value into your local variable. Your program will then print out the result.
Simply say, change the code in make the procedure as a stand alone via create or replace it in the DB schema level. Then you may call it in your PLSQL block.
Q points Based on question
This time, you will print out the managers' full names for all the departments that have assigned manager.
Assuming that you have created the procedure in Q so you do not need to repeat your "create procedure" code, just write one PLSQL that will invoke standalone procedure.
In the PLSQL block, you will define a cursor that will return all the department ID's
from departments where managerid is not null run a loop, repeatedly invoke that procedure. Your program needs to provide the value of departmentid you get from cursor to the procedure, and assign the OUT parameter value from the procedure into your local variable. Then print out the info.
Please try to find out all the questions
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started