dbTalk Databases Forums  

Newbie control file question

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Newbie control file question in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sashi
 
Posts: n/a

Default Newbie control file question - 09-01-2009 , 10:46 AM






All, I'm trying to load data using a control file.
Here's the sqlldr version:
SQL*Loader: Release 10.2.0.3.0 - Production on Tue Sep 1 11:43:14 2009

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


Here's a sample data line:
"941 -
Warren","06/08/09","00:08","9085635152","9733928015","4","54","00 2","NEWARK ,
NJ","NJ","Toll",".18","0000019619"

Here's my control file:

LOAD DATA
INFILE '/my/source/file.csv'
INTO TABLE dest_table
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
(
SWITCH_NAME,
CONNECT_DATE "MM/DD/YY",
CONNECT_TIME,
SRC_NUMBER,
DEST_NUMBER,
DUR_MM,
DUR_SS,
TRUNK,
LOCATION,
STATE,
CALL_TYPE,
COST,
EXP_CODE
)

It's being rejected thus:
Record 1: Rejected - Error on table CDR_TEMP_FEED, column
CONNECT_DATE.

How do I fix this?

TIA,
Sashi

Reply With Quote
  #2  
Old   
joel garry
 
Posts: n/a

Default Re: Newbie control file question - 09-01-2009 , 11:24 AM






On Sep 1, 8:46*am, Sashi <small... (AT) gmail (DOT) com> wrote:
Quote:
All, I'm trying to load data using a control file.
Here's the sqlldr version:
SQL*Loader: Release 10.2.0.3.0 - Production on Tue Sep 1 11:43:14 2009

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

Here's a sample data line:
"941 -
Warren","06/08/09","00:08","9085635152","9733928015","4","54","00 2","NEWARK * *,
NJ","NJ","Toll",".18","0000019619"

Here's my control file:

LOAD DATA
INFILE '/my/source/file.csv'
INTO TABLE dest_table
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
(
SWITCH_NAME,
CONNECT_DATE "MM/DD/YY",
CONNECT_TIME,
SRC_NUMBER,
DEST_NUMBER,
DUR_MM,
DUR_SS,
TRUNK,
LOCATION,
STATE,
CALL_TYPE,
COST,
EXP_CODE
)

It's being rejected thus:
Record 1: Rejected - Error on table CDR_TEMP_FEED, column
CONNECT_DATE.

How do I fix this?

TIA,
Sashi
Perhaps you need to specify a keyword to tell the loader what kind of
field it is?
CONNECT_DATE DATE "MM/DD/YY",

See for example the controlfile demo at http://www.psoug.org/reference/sqlloader.html

jg
--
@home.com is bogus.
http://www3.signonsandiego.com/stori...ity/?uniontrib

Reply With Quote
  #3  
Old   
ddf
 
Posts: n/a

Default Re: Newbie control file question - 09-01-2009 , 11:29 AM



On Sep 1, 10:46*am, Sashi <small... (AT) gmail (DOT) com> wrote:
Quote:
All, I'm trying to load data using a control file.
Here's the sqlldr version:
SQL*Loader: Release 10.2.0.3.0 - Production on Tue Sep 1 11:43:14 2009

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

Here's a sample data line:
"941 -
Warren","06/08/09","00:08","9085635152","9733928015","4","54","00 2","NEWARK * *,
NJ","NJ","Toll",".18","0000019619"

Here's my control file:

LOAD DATA
INFILE '/my/source/file.csv'
INTO TABLE dest_table
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
(
SWITCH_NAME,
CONNECT_DATE "MM/DD/YY",
CONNECT_TIME,
SRC_NUMBER,
DEST_NUMBER,
DUR_MM,
DUR_SS,
TRUNK,
LOCATION,
STATE,
CALL_TYPE,
COST,
EXP_CODE
)

It's being rejected thus:
Record 1: Rejected - Error on table CDR_TEMP_FEED, column
CONNECT_DATE.

How do I fix this?

TIA,
Sashi
By changing your .ctl file:

LOAD DATA
INFILE '/my/source/file.csv'
INTO TABLE dest_table
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
(
SWITCH_NAME,
CONNECT_DATE "to_date(:connect_date, 'MM/DD/YY')",
CONNECT_TIME,
SRC_NUMBER,
DEST_NUMBER,
DUR_MM,
DUR_SS,
TRUNK,
LOCATION,
STATE,
CALL_TYPE,
COST,
EXP_CODE
)

SQL*Loader: Release 10.2.0.3.0 - Production on Tue Sep 1 11:26:37 2009

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

Commit point reached - logical record count 1

SQL>
SQL> select *
2 from dest_table;

SWITCH_NAME
--------------------------------------------------------------------------------
CONNECT_DATE CONNECT_TI SRC_NUMBER DEST_NUMBE DUR_MM
DUR_SS
-------------------- ---------- ---------- ---------- ----------
----------
TRUNK LOCATION ST CALL_TYPE
COST
------ ---------------------------------------- -- ----------
----------
EXP_CODE
----------
941 - Warren
08-JUN-2009 00:00:00 00:08 9085635152 9733928015
4 54
002 NEWARK , NJ NJ Toll .
18
0000019619


SQL>


David Fitzjarrell

Reply With Quote
  #4  
Old   
Sashi
 
Posts: n/a

Default Re: Newbie control file question - 09-01-2009 , 12:16 PM



On Sep 1, 12:29*pm, ddf <orat... (AT) msn (DOT) com> wrote:

Quote:
By changing your .ctl file:

CONNECT_DATE "to_date(:connect_date, 'MM/DD/YY')",

David Fitzjarrell
Worked like a charm!
Thank you, David!
Joel, thanks for your pointer.
Sashi

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.