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 : What is an Operand Operand : An operand

    Operand: An operand is an argument of the operator. Expressions comprise combinations of operands and operators. The value of an expression is determined by exerting the operation stated by each and every operator to the value of its operands.

  • Q : State Space Reduction in Java PathFinder

    State Space Reduction: JPF is a so-called explicit-state model checker, as it enumerates all visited states, and therefore suffers from the state explosion problem inherent in analyzing large programs. It also contains garbage collection, because a ty

  • Q : Explain the COM components Explain the

    Explain the COM components?

  • Q : What is validating parser What is

    What is validating parser? Answer: A parser makes sure that an XML document is valid additionally to being well formed.

  • Q : Alice 2.2 bucking bronc How do i create

    How do i create the bucking bronco in alice 2.2

  • Q : Double clock signal in synchronous

    Describes the cases where you need to double clock a signal before presenting this to a synchronous state machine?

  • Q : Define the term Inheritance Inheritance

    Inheritance: It is a feature of object-oriented programming languages in which a sub-type inherits methods and variables from its super-type. The Inheritance is most generally employed as a synonym for class inheritance {class!inheritance}, however in

  • Q : Define Out of scope Out of scope : It

    Out of scope: It is a variable is in scope as long as the program's flow of control is in the variable's defining block. Or else, this is out of scope.

  • Q : Meaning of active and passive objects

    Illustrate in brief the meaning of active and passive objects?

  • Q : Explain Return statement Return

    Return statement: It is a statement employed to terminate the execution of the method. The method with void return type might only have return statements of the form as: return;

©TutorsGlobe All rights reserved 2022-2023.