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

  Write sql queries to answer the following questions

Double the capacity of each DC-10 airplane.

  Write an sql statement to delete the nantucket record

Write an SQL statement to delete the Nantucket record. Write the SQL necessary to recreate the ocean table in the same way it was create for question 1 but add the constraint that PercentOfSurface must be Between 0 and 100.

  What is xml, and why is it useful

What are the differences between the characteristics of an operational database and a dimensional database?

  Write an sql drop statements that will drop the all tables

Write an SQL DROP statements that will drop the all tables. Add these statements to the appropriate location within the script file - Write a SQL CREATE TABLE statement to create the ALLOCATION table. Add the SQL statement to the appropriate locati..

  Write queries in sql if employee works on every project

Write the following queries in SQL: If an employee works on every project located in Houston, then list the employees social security number and name.

  Which of the sollowing is an accurate statement

Which of the subsequent is an accurate statement - When the LOWER function is used in a SELECT clause, it will automatically store the data in lower-case letters in the database table.

  Question 1 write a query to display the last name

question 1 write a query to display the last name department number and salary of any employee whose department number

  What three ways for identifying a dbms should nathan cover

Nathan is planning to describe at least three ways a database management system can be identified. What three ways for identifying a DBMS should Nathan cover?

  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.

  Write a script that creates and calls a stored procedure

Write a script that creates and calls a stored procedure named spInsertProduct that inserts a row into the Products table. This stored procedure should accept five parameters.

  Script that creates and calls a function named

Write a script that creates and calls a function named fnDiscountPrice that calculates the discount price of an item in the OrderItems table (discount amount subtracted from item price). To do that, this function should accept one parameter for th..

  Sql concepts and database design

The Strayer Oracle Server may be used to test and compile the SQL Queries developed for this assignment. Your instructor will provide you with login credentials to a Strayer University maintained Oracle server.

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