Re: Trigger Question
From: Michael Milliron <~okana_at_msn.com>
Date: 1999/09/13
Message-ID: <khdD3.3444$R .20185717_at_news5.usenetserver.com>#1/1
END; Michael Milliron <~okana_at_msn.com> wrote in message ...
>This may be a stupid question:
>
>In using triggers - I am doing an insert into a separate table based
on an
>update or insert into a table. Is there a way to get the Oracle user
ID of
>the person performing the update from within the trigger to use in
the
>insert statment?
>
>
>Michael Milliron
>mikem_at_msamail.com
>okana_at_msn.com
>
>
>
>
Date: 1999/09/13
Message-ID: <khdD3.3444$R .20185717_at_news5.usenetserver.com>#1/1
thank you -
Jeff Hunter <jeffh_at_btitelecom.net> wrote in message
news:37dd2df2_at_defiant.btitelecom.net...
No question is a stupid question.
You can use the "user" keyword in your trigger PL/SQL block to return the current user. Although triggers run as the owner of the object, the user will return the user who is causing the trigger to fire...
SQL> select user, sysdate from dual;
USER SYSDATE ------------------------------ --------- SYSTEM 13-SEP-99
In a trigger it would look like:
CREATE OR REPLACE TRIGGER ANI AUDIT
AFTER INSERT OR UPDATE OR DELETE ON ANI REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW BEGIN IF INSERTING THEN INSERT INTO ANI AUDIT (user id, audit ts, action cd, id, ani) VALUES (user,sysdate,'INSERT',:new.id, :new.ani); END IF;
END; Michael Milliron <~okana_at_msn.com> wrote in message ...
>This may be a stupid question:
>
>In using triggers - I am doing an insert into a separate table based
on an
>update or insert into a table. Is there a way to get the Oracle user
ID of
>the person performing the update from within the trigger to use in
the
>insert statment?
>
>
>Michael Milliron
>mikem_at_msamail.com
>okana_at_msn.com
>
>
>
>
--Received on Mon Sep 13 1999 - 00:00:00 CEST