Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old October 1st, 2003, 03:59 PM
Dipesh Dipesh is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 29 Dipesh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 51 sec
Reputation Power: 0
Getting error in the Control File Format !!

Hi,

I am having a datafile like this.

T1Col1`T1Col2`T1Col3`T2Col1`T2Col2`T2Col3`T2Col4`T2Col5`T3Col1`T3Col2`T3Col3`T3Col4
```T2Col1`T2Col2`T2Col3`T2Col4`T2Col5`T3Col1`T3Col2`T3Col3`T3Col4
````````T3Col1`T3Col2`T3Col3`T4Col4

and so on.

I have just taken a single table and tried to write control file like this.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

OPTIONS (SKIP=1)
Load Data
INFILE 'C:\DataFiles\DataFile.dat'
BADFILE 'C:\BadFiles\BadRecord.bad'
APPEND
INTO TABLE TABLE1
WHEN T1Col1 !=' '
FIELDS TERMINATED BY "`"
TRAILING NULLCOLS
(
T1Col1
,T1Col2
,T1Col3
)

----------------------------------------------------------------------------------------------------------------------------------------------------------------------
I am removing first line from the data file as it is of no use. The data is arranged like Table1 data followed by Table2Data Followed by Table3 Data and if table3 is having many rows then in the next line all other columns of all othe tables will be null and only delimiter will be there. I have shown till table3 here for simplicity, i am having more tables like that in the original file.

And to get all the table's data I have written INTO TABLE clause for other tables like this.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------
OPTIONS (SKIP=1)
Load Data
INFILE 'C:\DataFiles\DataFile.dat'
BADFILE 'C:\BadFiles\BadRecord.bad'
APPEND
INTO TABLE TABLE1
WHEN T1Col1 !=' '
FIELDS TERMINATED BY "`"
TRAILING NULLCOLS
(
T1Col1
,T1Col2
,T1Col3
)
INTO TABLE TABLE2
WHEN T2Col1 !=' '
FIELDS TERMINATED BY "`"
TRAILING NULLCOLS
(
T2Col1
,T2Col2
,T2Col3
,T2Col4
,T2Col5
)
INTO TABLE TABLE3
WHEN T3Col1 !=' '
FIELDS TERMINATED BY "`"
TRAILING NULLCOLS
(
T3Col1
,T3Col2
,T3Col3
,T4Col4
)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------

I am getting WHEN clause failed error. I didn't put WHEN clause in one of my test and still i got error like this

" 0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
"

Can someone please tell me where i am making mistake ?

My second question is if the names of the columsn in the datbase are not in the order as given in the Control file will that causes error. I am not having my columns in the order described above. So is that causing error ?

Any help and hint to solve this problem would be highly appreciated.

Thanks in the anticipation that I will get some reply.

Regards,
Dipesh

Reply With Quote
  #2  
Old October 2nd, 2003, 01:23 PM
Dan Drillich Dan Drillich is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 68 Dan Drillich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
About the syntax in the control file:
APPEND INTO TABLE TABLE1
WHEN T1Col1 !=' '
FIELDS TERMINATED BY "`"

T1Col1 should probably be :T1Col1
And about FIELDS TERMINATED BY "`". I always use single quotes as in FIELDS TERMINATED BY '`'

To answer your second question: The order of the columns in the control file is independent of the order of the columns in the table.

Good luck,
Dan

Reply With Quote
  #3  
Old October 2nd, 2003, 04:18 PM
Dipesh Dipesh is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 29 Dipesh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 51 sec
Reputation Power: 0
Hi Dan,

Thanks for replying and informing me about the syntax usage.

I am able to load the data properly now. But getting error in loading data into the database.
I am getting date in this format.

MM/DD/YYYY HH:MM.

What should i write as my datatype for such column in the control file so that i will get properly loaded into the oracle database. In the database the datatype for that column is described as Date of length 7.

So what should i mention in the control file ?
Any help would be highly appreciated.

Eagerly waiting for reply.

Regards,

Reply With Quote
  #4  
Old October 2nd, 2003, 04:39 PM
Dan Drillich Dan Drillich is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 68 Dan Drillich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Let's say T3Col1 is the date field. Then the following should work:

TRAILING NULLCOLS
(
T3Col1 DATE "MM/DD/YYYY HH:MM" ,
....


Cheers,
Dan

Reply With Quote
  #5  
Old October 2nd, 2003, 06:19 PM
Dipesh Dipesh is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 29 Dipesh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 51 sec
Reputation Power: 0
Hi,

Thanks it worked well. I gave something like this

DATE "MM/DD/YYYY HH:MI:SS AM"

Thanks for your help.

Regards,

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Getting error in the Control File Format !!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway