Solved

Cannot select V$SESSION in before LOGOFF trigger

Posted on 2007-12-06
4
1,057 Views
Last Modified: 2008-02-01
Do you know why I cannot compile this trigger?

CREATE OR REPLACE TRIGGER LOGOFF_TRIGGER
BEFORE LOGOFF ON DATABASE
DECLARE
BEGIN
  insert into TEST
  (USERNAME)
  select distinct USERNAME
  from V$SESSION;
END;
/
0
Comment
Question by:Zopilote
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Expert Comment

by:joebednarz
ID: 20422654
Not sure "why" it does that... but try this instead:

create trigger logoff_trigger
before logoff on database
begin
  insert into test values(sys_context('userenv','session_user'));
end;
/
0
 
LVL 5

Author Comment

by:Zopilote
ID: 20423682
Problem solved. No direct grant.
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 50 total points
ID: 20423683
whomever owns the trigger doesn't have select access on v$session.

I was able to compile your trigger fine and it ran correctly as well.
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 20423687
sorry, didn't see your post.  yes, you are correct, that's "why"

sys_context is a good workaround too
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question