Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: AFTER LOGON System Trigger

Re: AFTER LOGON System Trigger

From: Mladen Gogala <gogala_at_sbcglobal.net>
Date: Mon, 12 Jul 2004 23:34:28 -0400
Message-ID: <20040713033428.GA1682@medo.noip.com>

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



OPS$MGOGALA   SQL> create table logon_something( something varchar2(256));  

Table created.  

SQL> create public synonym logon_something for logon something; create public synonym logon_something for logon something

                                                *
ERROR at line 1:
ORA-00933: SQL command not properly ended    

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



SCOTT's mama wears army boots!  

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US