Home » RDBMS Server » Server Utilities » Problem with milliseconds in sqlldr
Problem with milliseconds in sqlldr [message #170862] Fri, 05 May 2006 09:59 Go to next message
Zakkhalid
Messages: 47
Registered: April 2005
Member
Hi
I'm trying to load a timestamp 2006-04-20 08:50:06,971 using a control file

so
table x
(timstamp date))

Data
2006-04-20 08:51:13,739
2006-04-20 08:51:39,532
2006-04-20 08:59:51,112
2006-04-20 09:00:04,327
2006-04-20 09:03:43,020
2006-04-20 09:15:40,099

and the controlfile has the following line,

timestamp DATE "YYYY-MM-DD HH24:MI:SS" "TO_DATE(TO_CHAR(SUBSTR(:TIMESTAMP,1,19),'YYYY-MM-DD HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS
')"

but it returns ORA-01722: invalid number

thanking you all inadvance

Re: Problem with milliseconds in sqlldr [message #171746 is a reply to message #170862] Thu, 11 May 2006 05:57 Go to previous messageGo to next message
Frank Naude
Messages: 4580
Registered: April 1998
Senior Member
Try this:

SQL> create table x (timestamp date);

Table created.


load data
infile 'x.dat'
append into table x
fields terminated BY ','
(
  timestamp DATE "YYYY-MM-DD HH24:MI:SS"
)


sqlldr scott/tiger control=x.ctl

SQL*Loader: Release 10.2.0.2.0 - Production on Thu May 11 12:42:25 2006

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Commit point reached - logical record count 6


SQL> alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS';

Session altered.

SQL> select * from x;

TIMESTAMP
-------------------
2006-04-20 08:51:13
2006-04-20 08:51:39
2006-04-20 08:59:51
2006-04-20 09:00:04
2006-04-20 09:03:43
2006-04-20 09:15:40

6 rows selected.

Re: Problem with milliseconds in sqlldr [message #171754 is a reply to message #171746] Thu, 11 May 2006 06:11 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
Maybe I'm looking at this wrong, but it appears that you are trying to jam a TIMESTAMP value into a DATE field.
Re: Problem with milliseconds in sqlldr [message #171765 is a reply to message #170862] Thu, 11 May 2006 07:06 Go to previous messageGo to next message
Zakkhalid
Messages: 47
Registered: April 2005
Member
hummm interesting ...

maybe I should change it to timestamp...

but I don't really need the milliseconds...

Re: Problem with milliseconds in sqlldr [message #171771 is a reply to message #171765] Thu, 11 May 2006 07:39 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
Well, that's a horse of a different color then.

Frank's method is perfect for ya.
Re: Problem with milliseconds in sqlldr [message #171806 is a reply to message #170862] Thu, 11 May 2006 09:44 Go to previous message
Zakkhalid
Messages: 47
Registered: April 2005
Member
Frank,

It works... ta very much
Previous Topic: how to use sql loader?
Next Topic: How to load record into a single table by using multiple data files.
Goto Forum:
  


Current Time: Sat Jun 29 08:24:04 CDT 2024