Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Need current transaction information
A copy of this was sent to "Gerry West" <gwest_at_skyconnect.com>
(if that email address didn't require changing)
On Thu, 4 Feb 1999 15:35:46 -0700, you wrote:
>Hi,
>
>I'd like to perform a transaction from a trigger
>and then capture
> - the OS user that performed the transaction,
USER
> - the type of transaction
if ( updating ) then
trans_type := 'update';
elsif ( inserting ) then
trans_type := 'insert';
else
trans_type := 'delete';
end if;
> - the table the transaction touched.
>
a trigger is on a table so you know the table....
>I realize this information is available in dba_audit_trail,
>but how do you select for the current (right now) information
>for the current transaction ?
>
putting it together:
create or replace trigger emp_trigger
after insert or update or delete
on emp
declare
trans_type varchar2(25);
begin
if ( updating ) then
trans_type := 'update';
elsif ( inserting ) then
trans_type := 'insert';
else
trans_type := 'delete';
end if;
insert into your_audit_table values ( USER, trans_type, 'EMP' ); end;
>Thanks in advance,
>Gerry
>
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Sat Feb 06 1999 - 08:04:30 CST