Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create table Product in Oracle. The table must have at least four columns ProductID, ListPrice, StandardCost and ProductDescription. It must also have at least 10

Create table Product in Oracle. The table must have at least four columns ProductID, ListPrice, StandardCost and ProductDescription. It must also have at least 10 rows.

Your assignment is to create the Product_Price_Check trigger that fires on the update of ListPrice column. The trigger should not allow a new list price be less than StandardCost + 20%. This trigger should allow any price increase.

You have to test your trigger and provide screenshots to prove that it works correctly:

    • correctly discards changes if price is too low

    • correctly changes the price if price is not low

You have to provide the trigger code, code you used to create the table and insert records. (2 points)

You should have only one trigger that will work for both updates correctly

update Product set ListPrice=42 where ProductID=112;

2 points

and

update Product set ListPrice=61;

6 points (2 points for each test case)

The second update statement should update price only for products with standartcost below $50 (because $50.83 * 1.2 = $61), for all other products the price change should be ignored. In your report show price changes as a result of the trigger. Test your trigger thoroughly. Note: The use of raise application error will prevent the second query from updating allowed prices. Check PL/SQL Trigger Example 1 to see how to prevent price change.

Sample output:

image text in transcribed

select * from product; set serveroutput on; update product set listprice=99 where productid - 514; Script Output * Query Result x O S Task completed in 0 seconds 1 rows updated. the price can't be below 118.524 the price stays 98.77

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions