Maintaining audit trail of product table modifications

The accuracy of product table data is crucial and the Brwebean’s. owner prefers to have an audit file which contains information regarding all DML activity on the BB_PRODUCT table. This information must point out the user id of the user running a DML statement, the date, the original values of the modified rows and the new values. The audit table requires to track specific columns of concern, comprising PRODUCTNAME, PRICE, SALESTART, SALEEND, and SALEPRICE. Build a table named BB_PRODCHG_AUDIT which can hold the relevant data. Then create a trigger named BB_AUDIT_TRG which fires on update to this table whenever one of the particular columns in the BB_PRODUCT table is modified.
 
Utilize the following update statement to test your trigger. Then, complete a rollback and disable the trigger whenever finished so that it does not affect other assignment questions.

Update bb_product set salestart = ’05-MAY-03’, saleend = ’12-MAY-03’, saleprice = 9 where idproduct = 10;

E

Expert

Verified

CREATE TABLE  "BB_PRODCHG_AUDIT"
   (    "PRODUCTNAME" VARCHAR2(25),
    "PRICE" NUMBER(6,2),
    "SALESTART" DATE,
    "SALEEND" DATE,
    "SALEPRICE" NUMBER(6,2)
   )

CREATE OR REPLACE TRIGGER  "BB_AUDIT_TRG"
BEFORE
update on "BB_PRODUCT"
for each row
begin
INSERT INTO BB_PRODCHG_AUDIT VALUES (:NEW.IDPRODUCT,:NEW.PRICE,:NEW.SALESTART,:NEW.SALEEND,:NEW.SALEPRICE);
end;
/
ALTER TRIGGER  "BB_AUDIT_TRG" DISABLE
/

   Related Questions in Programming Languages

  • Q : Define Inconsistent state Inconsistent

    Inconsistent state: A state which an object must not be in. A class requires to be carefully designed in order to make sure that none of its examples can get into a conflicting state. An illustration of an inconsistent state may be a football team wit

  • Q : Define the term XML Canonicalization

    Define the term XML Canonicalization?

  • Q : What are good examples of XHTML

    What are the good examples of XHTML elements along with contents?

  • Q : Limit the Use of Pre-processor

    Limit the Use of Pre-processor Directives: The C pre-processor is powerful, but unrestricted use of it can lead to code that is hard to understand and analyze. Limit its use to inclusion of header files and simple macro definitions. Avoid features suc

  • Q : Explain different cursors types in ADO

    What are the different cursors types in ADO and illustrated them?

  • Q : What is Homogeneous collection

    Homogeneous collection: A group of objects with similar dynamic type. Arrays are the most general homogeneous collection objects.

  • Q : Define Zip file Zip file : It is a file

    Zip file: It is a file employed to store compressed versions of the files. In connection with Java bytecode files, such have mostly been superseded by the Java Archive (abbreviated as JAR) files.

  • Q : Compute the Total Shopper Spending in

    Most of the reports produced from the system compute the total dollars in purchases for a shopper. Process the following steps to build a function named TOT_PURCH_SF which accepts a shopper id as input and returns the total dollars which the shopper has spent with com

  • Q : Use of System Dynamic and System Runtime

    What is the use of System.Dynamic and System.Runtime.CompilerServices namespaces?

  • Q : What are ORB-IOR-a servant-a POA manager

    In CORBA, what are i) an ORB ii) an IOR iii) a servant iv) a POA and v) a POA manager?

©TutorsGlobe All rights reserved 2022-2023.