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 sql statement to produce single column

Write an SQL statement to produce a single column called ItemLocation that combines the SKU_Description,the phrase "is located in."

  Script that creates and calls a stored

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

  Write a pl-sql block

Write a PL/SQ block - Select the average salary of all employees in department number 20.

  Create a pivottable on a new worksheet using the data

Use the data on the Christensen worksheet in the range A1:J19 to create a PivotChart on a new sheet. Use the Type, Issue Price, and Est. Value fields and the default locations. Find the average issue price and average estimated value.

  Stored procedure named spinsertcategory

Write a script that creates and calls a stored procedure named spInsertCategory. First, code a statement that creates a procedure that adds a new row to the Categories table. To do that

  How does the order of joins in an sql statement

How does the order of joins in an SQL statement affect the performance of the join and what can the DBA do to determine the preferred order of joins for an SQL statement that includes the join of at least three tables?

  Pl-sql block to display last name and salary

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.

  Create and populate the database system using sql server

Global Car Club (GCC) is a small individually owned club which loans cars to its members. GCC first formed in 2009; has over more than 100 good mixes of members and counting.

  Write a pl/sql block and declare a variable v_sal

Write a PL/SQL block and declare a variable  v_sal  of the type NUMBER. Include the following statement in the Execution section:

  Provide sql statements to create the database

Provide SQL statements to create the database and populate it with sample data (at least four rows per table).

  Write a select statement that returns these columns

Write a SELECT statement that returns these columns from the Products table: The date_added column A column that uses the CAST function to return the date_added column with its date only (year, month, and day)

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