--%>

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 TCP endpoint TCP endpoint : It

    TCP endpoint: It is the combination of an IP address and Transmission Control Protocol (abbreviated as TCP) port number.

  • Q : Meaning of SBI of an object in the

    Describe the meaning of SBI of an object in the programming?

  • Q : Explain Multiple inheritance Multiple

    Multiple inheritance: The capability of a class or interface to expand more than one interface or class. In Java, multiple inheritance is only accessible in the circumstances which are shown below: An interf

  • Q : What is Java What is Java: It is a

    What is Java: It is a portable high level programming language introduced by Sun Microsystems.

  • Q : Explain One Dimensional array One

    One Dimensional array:1) An array is a continuous memory location having similar kind of data in a single row or single column. Declaration in c++ is as under: const int size = 20;int a[size] or int a[2

  • Q : Maintaining audit trail of product

    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,

  • Q : What are the difference between XSLT

    What are the difference between XSLT and XPath?

  • Q : Explain Sign extension Sign extension :

    Sign extension: Whenever an integer value from a type with a specific range is stored in a variable with a larger range, Java employs sign extension to determine the resultant value. The most important bit in the original value is employed to fill the

  • Q : What is Binary operator Binary operator

    Binary operator: It is an operator taking two operands. Java has numerous binary operators, like the arithmetic operators +, -, *, / and %, and the Boolean operators &&, || and ^, among others.

  • Q : Define Finally clause Finally clause :

    Finally clause: This is a part of try statement which is always executed, either subsequent the handling of caught exception, and normal termination of the protected statements.