Home » SQL & PL/SQL » SQL & PL/SQL » Timestamp date conversion (Oracle 10g,win XP)
Timestamp date conversion [message #290175] Thu, 27 December 2007 22:12 Go to next message
freakabhi
Messages: 74
Registered: November 2007
Location: mumbai
Member
Hi all....

I am trying the following query in which
I am fetching all that data for which start_ts(TimeStamp) equals with User_input_value(Date Field) so.... how to make User_input_value to compare with start_ts(Time_stamp field)

in other words , i wanna query to consider just Date part of Timestamp to get compared with Date field.

select *
from Data_table
where start_ts = P_user_input_date

please suggest....

from
freakabhi
Re: Timestamp date conversion [message #290177 is a reply to message #290175] Thu, 27 December 2007 22:16 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
use the TRUNC() function
Re: Timestamp date conversion [message #290204 is a reply to message #290175] Thu, 27 December 2007 23:31 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

where start_ts = P_user_input_date


Doesn't return the rows because ,

Timestamps in start_ts is different from that of P_user_input_date , though though the Datestamp is same . Trunc() will trancates the date to the midnight .

Thumbs Up
Rajuvan
Re: Timestamp date conversion [message #290393 is a reply to message #290175] Fri, 28 December 2007 12:35 Go to previous messageGo to next message
Bill B
Messages: 1482
Registered: December 2004
Senior Member
Think about it......


where trunc(start_ts) = trunc(P_user_input_date)
Re: Timestamp date conversion [message #290395 is a reply to message #290393] Fri, 28 December 2007 12:41 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:

trunc(start_ts) = trunc(P_user_input_date)

Assuming P_user_input_date is of date/timestamp datatype.

Regards
Michel
Previous Topic: passing variable to a select query
Next Topic: EXECUTE IMMEDIATE
Goto Forum:
  


Current Time: Sun Dec 04 04:27:28 CST 2016

Total time taken to generate the page: 0.06287 seconds