Converting full date value to string or vice-versa

From: Joseph Ranseth <jransethNO_SPAM_at_worldcupfishing.com>
Date: 2000/07/28
Message-ID: <2xhg5.7378$3f1.19047_at_news1.mts.net>#1/1


I need to insert date values into a field of a table to act as a timestamp. Half of the values will be SYSDATE, the other half will be input by the user as a string variable(varchar2) in the full mask format (11-aug-2000 2:34:56 pm).
I need to be able to make the two values to the same format (either DATE or VARCHAR2) so I can sort on the value.

I have tried converting the string value to a date but it just puts in the date with 12:00am.

TO_DATE(in_date,'DD-MON-YYYY hh:mi:ss am') = 11-AUG-2000 12:00:00 am

If I change the field to VARCHAR2, it puts the user input value fine, but it truncates the SYSDATE value to leave off the time. I HAVE tried using the TRUNC function on sysdate before converting to a string, but it doesn't seem to work.....even the most simple mask will not work for some reason - I can't figure it out.

TO_CHAR(TRUNC(sysdate,'DD-MON-YYYY hh:mi:ss am'))

It just keeps telling me that there are too many precision specifiers.....PLEASE HELP!!

Thanks.

--
Received on Fri Jul 28 2000 - 00:00:00 CEST

Original text of this message