Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Trivia question re TO_DATE(SYSDATE)
Ah, that makes sense... I'm guessing that the reason the time is only
truncated occasionally is that sometimes NLS_DATE_FORMAT is set to the
default 'DD-MON-YY', and sometimes it's set to 'DD-MON-YY HH:MM:SS' (or
some format like that - I'm just guessing). In this application that's
quite possible...
I think it's time I hit the manuals (this is my first serious Oracle adventure). Thanks for the explanation!
In article <7tqh58$i7g$2_at_news.seed.net.tw>,
"fumi" <fumi_at_tpts5.seed.net.tw> wrote:
>
> The parameter of TO_DATE() function is CHAR or VARCHAR2 datatype.
> Oracle implicitly converts sysdate into a VARCHAR2 string using
TO_CHAR()
> function, so the expression Oracle actually performed is
> TO_DATE(TO_CHAR(SYSDATE)).
> The default NLS_DATE_FORMAT is 'DD-MON-YY', that's why you lose
> the time part of SYSDATE.
>
> The correct usage is just SYSDATE, never use the detrimental
> TO_DATE(SYSDATE).
--
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Sun Oct 10 1999 - 13:52:41 CDT