Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: AFTER LOGON System Trigger
On 07/12/2004 10:32:54 PM, Mark Burgess wrote:
> Hi,
>
> I am trying to record the logon even for a certain
> user with the following trigger code:
>
> CREATE OR REPLACE TRIGGER SESS_JOB_QUEUE AFTER LOGON
> ON DATABASE
>
> BEGIN
>
> IF sys.login_user = 'DISCO_SCH' THEN
> do something;
> end if;
>
> END;
Without the slightest intention of being fresh, may I ask why
SYS_CONTEXT ('USERENV', 'SESSION_USER') or simple "USER" function/variable
aren't sufficient in this case? Here is your example, revorked a
bit:
SQL> select user from dual;
USER
Table created.
SQL> create public synonym logon_something for logon something; create public synonym logon_something for logon something
*ERROR at line 1:
SQL> create public synonym logon_something for logon_something;
Synonym created.
SQL> grant insert,select on logon_something to public;
Grant succeeded.
SQL> ed
Wrote file /tmp/buffer.sql
1 CREATE OR REPLACE TRIGGER TEST_USR AFTER LOGON
2 ON DATABASE
3 BEGIN
4 insert into logon_something
5 values(user||'''s mama wears army boots!');
6* END;
7 /
Trigger created.
SQL> select * from logon_something;
SOMETHING
SQL> Of course, I logged in as scott in another window.
-- Mladen Gogala Oracle DBA ---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Mon Jul 12 2004 - 22:31:17 CDT