Which type of database constraint does the following trigger implement? a.Key constraint b.Dynamic integrity constraint c.Static integrity constraint d.Inter-relational integrity constraint

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter6: Additional Database Objects
Section: Chapter Questions
Problem 6HOA: A new table has been requested to support tracking automated emails sent to customers. Create the...
icon
Related questions
icon
Concept explainers
Question

Which type of database constraint does the following trigger implement?

a.Key constraint
b.Dynamic integrity constraint
c.Static integrity constraint
d.Inter-relational integrity constraint
DELIMITER $$
CREATE TRIGGER TRG_BEFORE_UPDATE_ON_part
BEFORE UPDATE ON part FOR EACH ROW
BEGIN
DECLARE errorMessage VARCHAR (255) ;
SET errorMessage = CONCAT ( ' The new selling price of ',
NEW.part_sellingprice,
' cannot be 2 times greater than the current selling
price of ',
OLD.part_sellingprice);
IF NEW.part_sellingprice > OLD.part_sellingprice * 2 THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = errorMessage;
END IF;
END $$
DELIMITER;
Transcribed Image Text:DELIMITER $$ CREATE TRIGGER TRG_BEFORE_UPDATE_ON_part BEFORE UPDATE ON part FOR EACH ROW BEGIN DECLARE errorMessage VARCHAR (255) ; SET errorMessage = CONCAT ( ' The new selling price of ', NEW.part_sellingprice, ' cannot be 2 times greater than the current selling price of ', OLD.part_sellingprice); IF NEW.part_sellingprice > OLD.part_sellingprice * 2 THEN SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = errorMessage; END IF; END $$ DELIMITER;
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr