Re: What stupid mistake am I making with this onlogin trigger?

From: Kurt Franke <Kurt-Franke_at_web.de>
Date: Tue, 26 Feb 2008 12:16:12 +0100
Message-Id: <917027696@web.de>

code addings inline

>
> After going back an forth on this for a while today I figured a few more sets of eyes couldn't hurt.
>
> I need to track connections from a specific module (not SQL*Plus but that was easiest for testing purposes). This trigger compiles but does not create any rows. The insert statement works if run from a sql*plus prompt. I'm sure I'm missing something really obvious here...
>
> Does the onlogin trigger possibly execute as the user logging in as opposed to as sys?
>
> Trigger created:
> SQL> create or replace trigger sys.trace_php_onlogin after logon on database
DECLARE
  PRAGMA AUTONOMOUS_TRANSACTION;
begin

   insert into wsidba.php_logins
    select sid,username,module

      from sys.v_$session
      where sid = (select unique(sid) from v$mystat)
          and upper(module) like '%SQL%';
   commit;
EXCEPTION
  WHEN OTHERS THEN
  • must close the autonomous transaction to get the correct error message outside ROLLBACK; RAISE; end; /
    >
    > Trigger created.
    >
    >
    > Doesn't enter any data to table:
    > usnjc01urp001:/services/home/oracle<lass> $ sqlplus wsidba
    >
    ...
    >
    > TIA,
    > Jay Miller
    >

regards

kf

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Feb 26 2008 - 05:16:12 CST

Original text of this message