Write a trigger that is fired after an INSERT statement is executed for the STUDENT table. The trigger writes the new student’s ID, user’s name, and system’s date in a table called TRACKING. (Note: You must create the TRACKING table first)

What will be an ideal response?


```
SQL> CREATE TABLE tracking
2 (StudentId CHAR(5),
3 UserName VARCHAR2(15),
4 TransDate DATE);

Table created.

SQL> CREATE OR REPLACE TRIGGER student_ai_trigger
2 AFTER INSERT ON student
3 FOR EACH ROW
4 DECLARE
5 v_studentid student.StudentId%TYPE;
6 BEGIN
7 v_studentid := :NEW.StudentId;
8 INSERT INTO tracking
9 VALUES (v_studentid, USER, SYSDATE);
10 END;
11 /

Trigger created.

SQL> INSERT INTO student VALUES
2 ('00110','Shah', 'Henna', '747 Valley Road', 'Maplewood',
3 'NJ', '07040', 'SP03', '13-JAN-1975', 123, 500, '9739332628')
4 /

1 row created.

SQL> SELECT * FROM tracking;

STUDE USERNAME TRANSDATE
----- --------------- ---------
00110 NSHAH 17-JUL-04
```

Computer Science & Information Technology

You might also like to view...

A ________ is a device that connects multiple devices on a LAN

A) bus B) switch C) router D) repeater

Computer Science & Information Technology

The quality of a scanner is measured by its resolution.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

In the figure above, which number refers to the Make work path from a selection button?

A. 3 B. 4 C. 5 D. 6

Computer Science & Information Technology

____________________ is severe hand or wrist pain due to inflammation of tendons in a user's hand and wrist.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology