Write a trigger and two test sql statements

Assignment Help PL-SQL Programming
Reference no: EM13333190

Write the following constraints using triggers.

1. An employee handles at most 5 orders.

2. The required shipping date of a suborder cannot be earlier than the order date of the order to which the suborder belongs.

3. Only a staff member or a manager can handle orders. Here, the classification of an employee is one of {secretary, staff, manager}.

4. First, create a table with five columns which can keep the following audit information. Whenever a suborder is shipped later than the required shipping date, enter the following entry in the above table: (1) empId of an employee who handled the order, (2) orderNo, (3) suborderNo, (4) required shipping date, and (5) actual shipping date.

For each of the first three constraints:

If an operation is attempted (after initial population) which would violate the constraint, the operation should not be performed and an appropriate error message must be issued. Write a trigger and two test sql statements. The first statement should succeed and the second statement should fail (i.e., the second statement violates the constraint and your trigger must block it and issue an error message). Include create trigger statement and two test sql statements in your
submission

For the fourth constraint:

Whenever an insert operation (into the suborder table) violates the constraint, the information will be entered into an audit table. Note that the operation itself is allowed. Write a create table statement for the audit table. Write two test sql statements that insert tuples into the suborder table. The first insert statement has the actual shipping date that is not later than the required shipping date (so this is not recorded in the audit table). The second insert statement has the actual shipping date that is later than the required shipping date (so this should be recorded in the audit table). Include the create table statement, create trigger statement, and two test sql statements in your submission.

2-SUBMISSION:

Scripts of all FOUR triggers along with their test SQL statements and the RESULTS after you run the test in SQL developer for Oracle 11g.
3-Important:

I will test the triggers on the database I created based on tables and tuples I send you. Tables and Tuples created in Oracle 11g SQL developer. I didn't SQL plus. Please test the triggers in SQL developer for Oracle 11g.

 

 

Reference no: EM13333190

Questions Cloud

Find the direction of this the magnetic force : A group of particles is traveling in a magnetic field of unknown magnitude and direction. What is the direction of this the magnetic force
Explain extraction of an aqueous solution : suppose that you are performing an extraction of an aqueous solution with an organic solvent that has a density less than water. Propose a method to identify and collect only the organic solvent. Assume that water and your solvent of interest are ..
Sheet metal roofing on large warehouse structure : Smith Roofing Company installs sheet metal roofing on large warehouse structures. This is done by placing a bundle of sheet metal "decking" on the roof, and then taking the top sheet of the bundle and putting it in place while standing on the bundle.
Determine the recoil speed of the nucleus : The carbon isotope 14C is used for carbon dating of archeological artifacts. 14C ( mass 2.34×10?26kg) decays by the process known as beta decay in which the nucleus emits an electron, What is the recoil speed of the nucleus
Write a trigger and two test sql statements : Write a trigger and two test sql statements. The first statement should succeed and the second statement should fail (i.e., the second statement violates the constraint and your trigger must block it and issue an error message).
Determine what is the internal rate of return : The cash inflows generated by the project are estimated at $76,000 for the first two years and $30,000 for the following two years. What is the internal rate of return
Explain the reducing agent and what is the oxidixing agent : In the following reaction, Zn (s) + CuSO4 (aq) ? ZnSO4 (aq) + Cu (s) What is the reducing agent and what is the oxidixing agent
What is the yield today for 2-year treasury securities : If the pure expectations theory is correct, what is the yield today for 2-year Treasury securities?
Explain how many he atoms are in the balloon : A 6.9L balloon is filled with He at 1.00 bar pressure at 298k. How many He atoms are in the balloon?

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Write pl-sql block to display the last name of people

Write a PL/SQL block that displays the last name and salary of the following people. Each of these can be done separately as PL/SQL, first to test and get the output lines then encapsulated in the procedure.

  Indicate the changes

Indicate the changes (using the shorthand representation) that you would need to make to the original Premiere Products database design to support the following requirements. There is no relationship between customers and sales reps.  When a custo..

  Create a pl-sql block using the hr schema

Create a PL/SQL block to achieve the following using the HR schema and select the name, salary, and department of the employee with the maximum salary.

  Write sql create table statement to create pet table

Write an SQL CREATE TABLE statement to create the PET table without referential integrity constraint on OwnerID in PET.

  Sql statements to create tables using sql ddl statements

Write SQL statements to create the above tables using SQL DDL statements. Write an INSERT statement to add two new records to each table.

  Describe what changed in the ddl for each table

Make sure that the 3 additional tables you added in Unit 3 are also shown and have established primary and foreign keys to appropriate tables.

  Create a view named productsummary

Create a view named ProductSummary that uses the view you created in exercise 4. This view should return some summary information about each product.

  Sql statement which select names and owners of great danes

Write SQL statement which would select each of the following: names and owners of all Great Danes and all attributes of poodles whose balance is no greater than $50.

  Question for database schema

The patient information along with the ID of any prescribing doctor for each patient and the prescription information along with patient name, DOB, medication brand name, and prescribing doctor name sorted by most recent date.

  Write sql statement to create stored procedure

Write SQL statement which creates stored procedure with one int input parameter. The stored procedure selects the supplierId field and the total of all Count field values for each group of supplierId's from the Part table.

  Write a program in towers of hanoi

How to write a program in towers of hanoi using pl/sql language

  Display the customerid from the orders table

Display the CustomerID from the Orders table and the sum of the associated ItemPrice multiplied by Quantity using Gross Sales (with a space) as the column name from the OrderItems table.

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