Question 2)     Maintaining an Audit Trail of Product Table Changes   The accuracy of product table data is critical, and the Brewbean’s owner wants to have an audit file containing information on all DML activity on the BB_PRODUCT table. This information should include the ID of the user performing the DML action, the date, the original values of the changed row, and the new values. This audit table needs to track specific columns of concern, including PRODUCTNAME, PRICE, SALESTART, SALEEND, and SALEPRICE. Create a table named BB_PRODCHG_AUDIT to hold the relevant data, and then create a trigger named BB_AUDIT_TRG that fires an update to this table whenever a specified column in the BB_PRODUCT table changes.     Preparation :   Step1: ALTER TRIGGER sales_date_trg DISABLE;   Step2: CREATE TABLE bb_prodchg_audit  (user_id VARCHAR2(10),   chg_date DATE,   name_old VARCHAR2(25),   name_new VARCHAR2(25),   price_old NUMBER(5,2),   price_new NUMBER(5,2),   start_old DATE,   start_new DATE,   end_old DATE,   end_new DATE,   sale_old NUMBER(5,2),   sale_new NUMBER(5,2) );       Step3: Your Trigger code comes here. Make sure you compile your trigger without any syntax error                 Step4: test the process . Run below command to see if it will generate any activity Audit log or not.       UPDATE bb_product  SET salestart = '05-MAY-07',      Saleend = '12-MAY-07',      saleprice = 9  WHERE idProduct = 10;       Step5: Test with SELECT statement to see any record goes into Audit table   SELECT * FROM bb_prodchg_audit;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Question 2)     Maintaining an Audit Trail of Product Table Changes  

The accuracy of product table data is critical, and the Brewbean’s owner wants to have an audit

file containing information on all DML activity on the BB_PRODUCT table. This information

should include the ID of the user performing the DML action, the date, the original values of the

changed row, and the new values. This audit table needs to track specific columns of concern,

including PRODUCTNAME, PRICE, SALESTART, SALEEND, and SALEPRICE. Create a table

named BB_PRODCHG_AUDIT to hold the relevant data, and then create a trigger named

BB_AUDIT_TRG that fires an update to this table whenever a specified column in the

BB_PRODUCT table changes.

 

 

Preparation :

 

Step1: ALTER TRIGGER sales_date_trg DISABLE;

 

Step2:

CREATE TABLE bb_prodchg_audit

 (user_id VARCHAR2(10),

  chg_date DATE,

  name_old VARCHAR2(25),

  name_new VARCHAR2(25),

  price_old NUMBER(5,2),

  price_new NUMBER(5,2),

  start_old DATE,

  start_new DATE,

  end_old DATE,

  end_new DATE,

  sale_old NUMBER(5,2),

  sale_new NUMBER(5,2) );

 

 

 

Step3: Your Trigger code comes here. Make sure you compile your trigger without any syntax error

 

 

 

 

 

 

 

 

Step4: test the process . Run below command to see if it will generate any activity Audit log or not.

 

 

 

UPDATE bb_product

 SET salestart = '05-MAY-07',

     Saleend = '12-MAY-07',

     saleprice = 9

 WHERE idProduct = 10;

 

 

 

Step5: Test with SELECT statement to see any record goes into Audit table

 

SELECT * FROM bb_prodchg_audit;

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Table
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education