On Friday 02 December 2005 12:58 am, you wrote:
> On Fri, 2 Dec 2005 17:50:08 +1100, Steve Baldwin wrote:
>
> Hi Steve
>
> Thanx.
>
> > This may not answer your question, but you can incorporate the time
> > format mask in the call to TO_DATE.  For example ...
> >
> > insert
> > into   history (history_timestamp)
> > values (to_date(:ts_val, 'YYYY-MM-DD HH24:MI:SS'))
>
> Yes, I tried that first actually, but when I displayed the result via a
> select in sqlplus all I saw was the date part.
>
> However it now occurs to me that that display may have been truncated by
> sqlplus since I did not use column history_timestamp format a30 or some
> such :-(.
>
> And it's 6:00 pm Friday here now, and I don't feel like going back to work
> to test it, for some reason...

Ron,

It's not that sqlplus is truncating your output.  The default format is 
configured at database startup, which is overridable in various ways ( 
environmental variable NLS_DATE_FORMAT, alter session set NLS_DATE_FORMAT = ). 
This format pertains to both selects and inserts.

If you want to select or insert with the precision you want, without changing 
enviromentals or your session, you need to use to_char and to_date.  So in 
your case selecting would look like:

select to_char(date_col, 'YYYY-MM-DD HH24:MI:SS') from some_table;

and to insert would be:

insert into table (some_col) values (to_date(date_string, 'YYYY-MM-DD 
HH24:MI:SS'));

HTH
Jay

Reply via email to