Create the trigger with the provided code

Assignment Help PL-SQL Programming
Reference no: EM133043843

Assignment 9-1: Creating a Trigger to Handle Product Restocking

Brewbean's has a couple of columns in the product table to assist in inventory tracking. The REORDER column contains the stock level at which the product should be reordered. If the stock falls to this level, Brewbean's wants the application to insert a row in the BB_PRODUCT_REQUEST table automatically to alert the ordering clerk that additional inventory is needed. Brewbean's currently uses the reorder level amount as the quantity that should be ordered. This task can be handled by using a trigger.

1. Take out some scrap paper and a pencil. Think about the tasks the triggers needs to perform, including checking whether the new stock level falls below the reorder point. If so, check whether the product is already on order by viewing the product request table; if not, enter a new product request. Try to write the trigger code on paper. Even though you learn a lot by reviewing code, you improve your skills faster when you create the code on your own.

2. Open the c9reorder. . txt file in the Chapter09 folder. Review this trigger code, and determine how it compares with your code.

3. In SQL Developer, create the trigger with the provided code.

4. Test the trigger with product ID 4. First, run the query shown in Figure 9-36 to verify the current stock data for this product. Notice that a sale of one more item should initiate a reorder.

2322_Stock Information2.jpg

FIGURE 9-36 Checking stock data

5. Run the UPDATE statement shown in Figure 9-37. It should cause the trigger to fire. Notice the query to check whether the trigger fired and whether a product stock request was inserted in the BB_PRODUCT_REQUEST table.

1517_Stock Information3.jpg

FIGURE 9-37 Updating the stock level for product 4

6. Issue a ROLLBACK statement to undo these DML actions to restore data to its original state for use in later assignments.

7. Run the following statement to disable this trigger so that it doesn't affect other projects:
ALTER TRIGGER bb_reorder_trg DISABLE;

Reference no: EM133043843

Questions Cloud

What are seductive details : What are seductive details? Should they be included in the delivery of a training program? If yes, explain how to do this and give an example.
What the total assets that will appear in the statement : The total assets of the Sufian Company (subsidiary) appeared in the book at 220,000 dinars. What the total assets that will appear in the statement
Pain points of such concert-going experiences : What are the pain points of such concert-going experiences? Who are the customers of traditional classical concerts? Andre Rieu Case
Advice mrs naidu if she her plans to pay down the home loan : The investment property is earning a profit before tax of $12,000. Advice Mrs Naidu if she her plans to pay down the home loan is appropriate
Create the trigger with the provided code : Review trigger code, and determine how it compares with your code - create the trigger with the provided code.
Post-covid-19 work environment : 1. Provide practical and creative recommendations for organizations about how to prepare for a post-Covid-19 work environment in a Canadian workplace environmen
What is the greatest amount you can borrow : Assume that you want to buy a new car and your credit score is 650; the interest rate you are offered is 10.50% APR, What is the greatest amount you can borrow
Coordinating the corporate compensation : The compensation and benefits manager plays a vital role in coordinating the corporate compensation and benefits department. With reference to theory and exampl
Common problems that employee assistance program : Briefly explain any FIVE (5) the common problems that an Employee Assistance Program (EAP) can address in the organisation. Use relevant examples to substantiat

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Problem of select command in sql

Write a SELECT statement that returns these columns from the Products table: The ListPrice column A column that uses the CAST function to return the ListPrice column with 1 digit to the right of the decimal point A column that uses the CONVERT fun..

  Perform the steps for sql coding and tuning efficiency

Perform the steps for SQL coding and tuning efficiency (focus on tying the query to the business need). Including what complexities, they possess.

  Consultant to assist in streamlining the data processing

Imagine that you have been hired as a consultant to assist in streamlining the data processing of an international based organization that sells high-end electronics.

  Create data dictionary that includes data type of each field

Create a data dictionary that includes the data type of each field and A label, as required, if the attribute is a primary key or foreign key.

  Write a program in towers of hanoi

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

  Create a problem definition for williwonk

Create a problem definition for Williwonk's, as described in Problem 1. Estimate the weights of importance. Include at least one requirement and one constraint.

  Describe what is a sequence

What is a sequence. Which clause of a sequence cannot be changed with an alter statement

  Compare and interpret test results

M6A2 Lab: Interpret Static Analysis Reports. In this activity, you will compare and interpret test results using the Fortify On Demand Tool

  Return names of all elementary school players with rating

Return number of players registered for Baltimore January Action. Return names of all elementary school players with rating over 1000.

  Find the customers whose balance is greater

Show sums of line totals for each invoice and Locate the record in the vendor table that does not have a value for the attribute V_STATE

  Assignment on tour operator agency database

Part 1: Design a data model that will conform to the following criteria: Question 1: a) Propose an efficient data structure that may hold the tour operator's data using a normalization process. Describe each step of the process that will enable yo..

  Write a select statement that returns two columns

Write a SELECT statement that returns these two columns - CategoryName The CategoryName column from the Categories 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