TUHRA Logo

Oracle JDeveloper 10g for Forms & PL/SQL Developers
Script

Chapter 15
Section Loading Audit Columns Using a Database Procedure and Application Context | Create the Database Objects
Code Script to create audit columns on the EMPLOYEES table
Return to listings...


Run the following script from SQL*Plus or a similar SQL worksheet. Connect as HR


ALTER TABLE employees
ADD (
   created_by    VARCHAR2(30),
   created_date  DATE,
   modified_by    VARCHAR2(30),
   modified_date  DATE);

UPDATE employees
SET created_by = 'HR',
    created_date = TO_DATE('01/01/1980 12:12','MM/DD/YYYY HH24:MI');

COMMIT;

ALTER TABLE employees
MODIFY ( created_by NOT NULL,
         created_date NOT NULL);