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

  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