Write an anonymous block which uses an explicit cursor

Assignment Help PL-SQL Programming
Reference no: EM131307051

Question :

1. Create a package, DEPT_PKG, with the following:

a) A public procedure called NEW_DEPT to enter a new department row into the DEPARTMENTS table. The procedure should accept four parameters - one for each column in the DEPARTMENTS table. Use the parameter values in your INSERT command.

b) A public procedure called UPD_DEPTMGR to update the manager for a specific department ID in the DEPARTMENTS table. The procedure should provide two parameters: the department ID, and a new manager ID. Add exception handling to account for an invalid department ID.

c) A public function called GET_DEPARTMENT_COUNT to retrieve the total number of employees assigned to a specific department. The function should accept the department ID as a parameter and return the number of employees in that department. Add error handling to account for an invalid department ID.

2. Write an anonymous block that invokes the procedure NEW_DEPT to add a new department to the DEPARTMENTS table with dept ID 88, department name of "IT". You may choose any value for location_id that is valid. Add an exception handler that will display the current error message that raised the exception.

3. Execute the UPD_DEPTMGR procedure and change the manager number of the new department you just added. Query the DEPARTMENTS table to view your changes.

4. Write an anonymous block which uses an explicit cursor to process all departments. Retrieve the department name and call the GET_DEPT_COUNT function from your package to return the total count by department. Simply call DBMS_OUTPUT.PUT_LINE and print the department name and number of employees for all departments.

5. Write a SELECT statement to display all department information for all departments using a SELECT statement which also invokes the GET_DEPT_COUNT function to return the total employee count for each department.

6. Query the code from your package, DEPT_PKG, (both parts) from the data dictionary.

7. Create a trigger which will always use the next value of the sequence, bb_prodid_seq, as the idproduct column when a new record is inserted into the BB_PRODUCT table. Test your trigger.

Reference no: EM131307051

Questions Cloud

Find the stresses due to pressure : Find the position (x) along the length of the fuselage that experiences the maximum bending moment. At this section, find the normal stress in the fuselage due to the weight and lift loads, as a function of vertical position in the section (z).
What research supports these theories and concepts : How do I define and employ the four basic metaparadigms of nursing theory in my professional practice?What are the major concepts I employ that are unique to my professional practice?What philosophies and theories from the literature of nursing and ..
How responsibility and accountability are addressed : Explain how responsibility and accountability are addressed in the various management system standards. Use one management system standard as an example.
What is present value of the annuities for the cohort of 65 : What is the present value of the annuities for the cohort of 65 if each person in the cohort has an annuity of $430 per year?
Write an anonymous block which uses an explicit cursor : Create a trigger which will always use the next value of the sequence, bb_prodid_seq, as the idproduct column when a new record is inserted into the BB_PRODUCT table. Test your trigger.
How much must he deposit annually if the money is worth : Robert would like his wife to receive a pure endowment of $100,000 when she retires at 55, 15 years from now. How much must he deposit annually if the money is worth 5%?
Find the magnitude and location of the maximum moment : How do the magnitudes of the biceps force B and joint reaction J change if the total weight w of the forearm and hand are included in the analysis and are assumed to act at the midpoint of the forearm?
How much of a premium would he have to pay if he is 53 now : If a person wants to purchase a whole life annuity so that he can be paid $3,600 at the end of each year for the rest of his life, how much of a premium would he have to pay if he is 53 now?
Apply holt-winters double exponential smoothing : Apply Holt-Winters Double exponential smoothing (without seasonality) to forecast the values of sales X for periods 12 and 13, using α = 0.2 and β = 0.3. Assume 12 months of sales data.

Reviews

inf1307051

12/14/2016 7:43:20 AM

Interested in having the solution for this problem. Please let me the quote for this material. In the 7 th question the corresponding table is not provided. In the last question there is bb_product and sequence it is not there in the sql code provided. Per email below, I am enclosing the sql script for bb_product table for question 7. Please let me know if you need anything else. Please provide the solution of Q7 as soon as possible.

Write a Review

PL-SQL Programming Questions & Answers

  Create a database model

Create a database model and Submit the table creation statements for the Database Model.

  Write pl-sql procedures and functions

Write PL/SQL procedures and functions to populate and query that database

  Sql questions

Write a query to display using the employees table the EMPLOYEE_ID, FIRST_NAME, LAST_NAME and HIRE_DATE of every employee who was hired after to 1 January, 1995.

  Run the lab_03_01.sql script

Run the lab_03_01.sql script in the attached file to create the SAL_HISTORY table. Display the structure of the SAL_HISTORY table.

  Write sql queries

Write a query to display the last name, department number, and salary of any employee whose department number and salary both match the department number and salary of any employee who earns a commission.

  Explaining sql insert statement to insert new row in cds

Write down a SQL insert statement to insert new row in "CDS" table.

  Write down name of actors in ascending order

Write down actors (or actress, your choice, but not both) who have won at least two (2) Academy Awards for best actor/actress. Provide the actor name, movie title & year. Order the result by actor name."

  What is an sql injection attack

What is an SQL injection attack? Explain how it works, and what precautions must be taken to prevent SQL injection attacks.What are two advantages of encrypting data stored in the database?

  Determine resonant frequency in series rlc resonant circuit

Given the series RLC resonant circuit in the figure, operating at variable frequency, determine: The resonant frequency ω o ,  The circuit’s quality factor Q , The cut-off frequencies, f 1  & f 2  and the bandwidth BW

  Query that uses cube operator to return lineitemsum

Write summary query which uses CUBE operator to return LineItemSum (which is the sum of InvoiceLineItemAmount) group by Account(an alias for AccountDesciption).

  Query to show customers were missing for existing orders

As DBA, your manager called a meeting and asked why there are so many orders for customers that don't exist in the customer table. Write query which would shows which customers were missing for existing orders. Use a join or a subquery.

  Sql query into a relational algebra statement

Turn this SQL query into a relational algebra statement? SELECT Request.reqfor, Ordering.invamt, Ordering.invnbr, Ordering.invdat

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd