Here are some queries that you may find useful in querying the audit log. Basically, there are two tables that are important. Table AUDIT_LOG contains summary information about a transaction: who did it, when, what table was updated, what its primary key is. Table AUDIT_LOG_COLUMN contains specific information about what columns were updated in what transaction and what the old values were. It is linked to AUDIT_LOG via a foreign key.


/* show any transactions done by joe schmo after May 1, 2004 */
select * from audit_log al
where al.user_name = 'joe schmo' and
al.audit_date > '2004-05-01';

/* show any updates that joe schmo did to an EST record */
select * from audit_log al, audit_log_column alc
where al.user_name = 'joe schmo' and
al.table_name = 'ELEMENT_SUBNATIONAL' and
al.audit_log_id = alc.audit_log_id;


/* show any updates that anybody did to EO.eo_id = 666 */
select * from audit_log al, audit_log_column alc
where al.table_name = 'EO' and
al.primary_key_id = 666 and
al.audit_log_id = alc.audit_log_id;


/* show updates to the EO.gen_desc field for EO.eo_id = 666 */
select * from audit_log al, audit_log_column alc
where al.table_name = 'EO' and
al.primary_key_id = 666 and
al.audit_log_id = alc.audit_log_id and
alc.column_name = 'GEN_DESC';


Remember when specifying table and column names for comparison, you must be sure and use the data model table and column names, NOT the window or the field label names. Example, in the query above, you must be sure and specify 'GEN_DESC' because that is the name of the column in the table, even though it appears on the screen as 'General Description'.