Timestamp SQL question



Oracle 9.2.0.5

Assuming I have only one connection as SYS:


select username, sid, serial#, logon_time, to_timestamp(logon_time)
from v$session
where to_timestamp(logon_time) = (select to_timestamp(logon_time)
from v$session where
username = 'SYS')
order by logon_time

select username, sid, serial#, logon_time, to_timestamp(logon_time)
from v$session
where logon_time = (select logon_time
from v$session where username = 'SYS')
order by logon_time


I would think that both would return only one row assuming no user logged on
at the exact same time as SYS. However, the SQL using the timestamp returns
all rows of v$session.

I would normally just use date and be done with it, but the SQL is being
used in JAVA code. I need the time and a date object does not seem to do it.

What am I doing wrong? How can I compare timestamps in a where clause?



.



Relevant Pages

  • Re: ASP.NET User.Identity.Name value after a domain username chang
    ... Can you point me to any resources I can use about getting the SID of the ... WebRequest user without using the username as the base of a lookup (since I ... access a website on the server. ... I have a very confusing issue when the domain login of a user is changed ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Timestamp SQL question
    ... from v$session where logon_time = (select logon_time from v$session where username = 'SYS') ... I would think that both would return only one row assuming no user logged on at the exact same time as SYS. ... col username format a20 ... Take a look at your query after I modified it ... ...
    (comp.databases.oracle.server)
  • Re: sessions numbers
    ... > select username, countfrom v$session group by username; ... Your count, from v$session, provides the number of sessions each ... SQL> select username, sid, count ...
    (comp.databases.oracle.server)
  • Re: Finding out particular admin username!
    ... in the second command you add 500 (admin account ... always ends in 500) to find out true name of admin account. ... Length of SID in memory is 28 bytes ... account username) ...
    (microsoft.public.security)
  • Re: Timestamp SQL question
    ... >> Assuming I have only one connection as SYS: ... > col username format a20 ...
    (comp.databases.oracle.server)