Question: 1. Create a table with two columns. Name the table First Initial _ Last Name. Using Oracle SQL TABLES THAT I CREATED Table 1 CREATE

1. Create a table with two columns. Name the table First Initial _ Last Name. Using Oracle SQL

TABLES THAT I CREATED

Table 1 CREATE TABLE a_will( Id int NOT NULL PRIMARY KEY, FirstName varchar(50) NULL, LastName varchar(50) NULL );

Table 2 CREATE TABLE a_will_log( EventId varchar(100) NULL, TimeExecuted date NULL, QueryCommand varchar(200) NULL );

Table 3 CREATE TABLE a_will_history( Id int NOT NULL, LogEventId varchar(100) NULL, OldValue varchar(100) NULL, NewValue varchar(100) NULL, ColumnName varchar(100) NULL );

2. You have to audit all DML statements on your table. To do this you write two triggers and provide test cases.

Trigger1. To log any DML statements that users might run on this table. The results must be stored in the First Initial _ Last Name _ Log table

The table should have unique event ID, values for both the Oracle and the system user who ran the query, the time it was executed and the type of DML query user ran.

Trigger2 To capture any data that was changed in the table. The results must be stored in the First Initial _ Last Name _ History table

The table should reference the event ID from the log table, and store both old and new values for both columns.

NEED HELP WITH TRIGGERS AND TEST CASES

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!