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 : Explain the relationship between XHTML

    Explain the relationship between XHTML and HTTP?

  • Q : What is an Assembly language Assembly

    Assembly language: This is a symbolic language closely analogous to the instruction set of a Central Processing Unit. The program employed to translate a program written in assembly language is termed an assembler.

  • Q : Meaning of active and passive objects

    Illustrate in brief the meaning of active and passive objects?

  • Q : What is Avoid Redundancy Avoid

    Avoid Redundancy: While not every form of redundancy is as bad from a verification perspective as it is from a maintenance point of view, behavioral redundancy to re-create (local) state can impose problems because the model checker does not distingui

  • Q : Define Single line comment Single line

    Single line comment: A comment is in the form:     // this line will be avoided by the compiler.

  • Q : Database management information system

    How much would it cost to create a simple database management information system by utilizing MySQL and PHP?The proposal of the system should include the following: Background narrative of setting and background of problem m

  • Q : State the term non-XML resources State

    State the term non-XML resources?

  • Q : What is Parsing Parsing : Generally

    Parsing: Generally applied to the action of a compiler in examining a program source file for syntax errors. This is too employed more broadly to mean the analysis of the structure of input.

  • Q : Define the term Blank final variable

    Blank final variable: A final variable which is not initialized as portion of its declaration. This variable should be initialized in either an instance initialization block or every of the constructors for its class before it is employed. A static bl

  • Q : Define Stream class Stream class : An

    Stream class: An input stream class is one which delivers data from its source (frequently the file system as a series of bytes. Likewise, an output stream class will write byte-level data. The stream classes must be contrasted with the operation of r

©TutorsGlobe All rights reserved 2022-2023.