Pando,

I think the V$OPEN_CURSOR view shows only cursors that are still open. So if a user has no open cursors but is still connected to the DB, you will not see anything in V$OPEN_CURSOR for that user.

V$SQLTEXT hangs onto stuff as long as it is still in the cache, so you are more likely to find the last executed
query by your 2nd query that you posted.

-John

ps. this is the query I use in EZSQL to look for the last
executed query (or currently executing query) by a
session - it is basically the same

select sql_text
from V$sqltext_with_newlines
where address = (select sql_address
from V$session
where username = :uname
and sid = :snum)
ORDER BY piece

[Edited by jdorlon on 04-26-2001 at 01:07 PM]