| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Trigger Question
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;
![]() |
![]() |