Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timestamp and Char comparision

Status
Not open for further replies.

kumariaru

IS-IT--Management
Mar 9, 2006
61
AU
Hi,

I need to compare value1= '2010-06-03 22:29:42:109615'(this in character) and to a timestamp field value2='16-JUL-10 04.42.44.296985000 PM' in a SQL.

Table value format is: 16-JUL-10 04.42.44.296985000 PM'
Value compared format is:'2010-08-03 22:29:42:109615'

I need to display values where value2 > value1.

I do not want to convert value2 to char.I tired converting value1 to timestamp.
Expression : TO_TIMESTAMP('2010-08-03 22:29:42:109615', 'DD-MON-RR HH.MI.SSXFF PM')

But this is throughing an error :

SQL Error: ORA-01843: not a valid month
01843. 00000 - "not a valid month".

Please advice if I am missing anything in expression.

Thanks in advance...

kumari






 
Try using 'MM' instead of 'MON'. 'MON' expects values such as 'JAN','FEB', etc. You are feeding it '08', which does not match your format spec.
 
You say that the table value is a particular format, is it a varchar or is it a date field?

If it is the latter try a TO_DATE -

TO_DATE('2010-08-03 22:29:42:109615', 'YYYY-MM-DD HH24:MI:SSxFF')

Steve

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top