Timestamp SQL question
- From: "Oxnard" <shankeypNO_SPAM@xxxxxxxxxxx>
- Date: Sun, 17 Jul 2005 23:05:24 -0500
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?
.
- Follow-Ups:
- Re: Timestamp SQL question
- From: DA Morgan
- Re: Timestamp SQL question
- Prev by Date: Re: Implementation of boolean types.
- Next by Date: Re: Creation time of Temporary tablespace
- Previous by thread: Re: ORA-00271: there are no logs that need archiving
- Next by thread: Re: Timestamp SQL question
- Index(es):
Relevant Pages
|