Solved

Load data with sqlldr

Posted on 2013-06-17
3
465 Views
Last Modified: 2013-06-18
Hi people, I have the data:
23/04/13 11:10:46|| 1366715446 || 134.537186 || 443 || || SUR_3B_1_____VC || 330127
23/04/13 11:29:56|| 1366716596 || 133.877991 || 699 || || SUR_3B_1_____VC || 330127
23/04/13 11:30:09|| 1366716609 || 136.075317 || 220 || || SUR_3B_1_____VC || 330127
23/04/13 11:36:17|| 1366716977 || 137.536545 || 636 || || SUR_3B_1_____VC || 330127
23/04/13 11:55:23|| 1366718123 || 136.921295 || 619 || || SUR_3B_1_____VC || 330127
23/04/13 11:59:29|| 1366718369 || 137.426682 || 402 || || SUR_3B_1_____VC || 330127
23/04/13 12:00:00|| 1366718400 || 137.426682 || 0 || || SUR_3B_1_____VC || 330127
23/04/13 12:10:26|| 1366719026 || 136.712540 || 313 || || SUR_3B_1_____VC || 330127
23/04/13 12:55:38|| 1366721738 || 136.031372 || 962 || || SUR_3B_1_____VC || 330127
23/04/13 12:58:15|| 1366721895 || 136.646622 || 17 || || SUR_3B_1_____VC || 330127
23/04/13 13:00:00|| 1366722000 || 136.536758 || 0 || || SUR_3B_1_____VC || 330127
23/04/13 13:16:50|| 1366723010 || 135.646835 || 530 || || SUR_3B_1_____VC || 330127
23/04/13 13:22:51|| 1366723371 || 136.415909 || 296 || || SUR_3B_1_____VC || 330127
23/04/13 13:31:54|| 1366723914 || 135.910522 || 119 || || SUR_3B_1_____VC || 330127
23/04/13 13:34:15|| 1366724055 || 136.646622 || 255 || || SUR_3B_1_____VC || 330127
23/04/13 13:37:56|| 1366724276 || 136.108276 || 914 || || SUR_3B_1_____VC || 330127

Open in new window

and after I executed the sql loader string, just the line :
23/04/13 12:00:00|| 1366718400 || 137.426682 || 0 || || SUR_3B_1_____VC || 330127
23/04/13 13:00:00|| 1366722000 || 136.536758 || 0 || || SUR_3B_1_____VC || 330127

Open in new window

Is inserted in the table target.
I've  tried with the position of data, inside the control file, but I had no success
Can give me an idea for the solution?
Here the control file:
LOAD DATA
CHARACTERSET WE8ISO8859P1
INTO TABLE XAJTDB.A_5MIN_033_temp
Append
fields terminated by "||"
OPTIONALLY ENCLOSED BY '"'
(UTCTIME Date "DD-MM-YYYY HH24:Mi:SS",
EPOCH Integer external,
VALOR_INST,
MS Integer,
TLQ Integer,
TAG Char,
PUNTO Integer external)

Open in new window

Here the script to table creation:
CREATE TABLE A_5MIN_033_TEMP
(
  UTCTIME     DATE                              NOT NULL,
  EPOCH       INTEGER                          NOT NULL,
  VALOR_INST  FLOAT(126),
  MS          INTEGER,
  TLQ         VARCHAR2(20 CHAR),
  TAG         VARCHAR2(30 CHAR),
  PUNTO       INTEGER
)

Open in new window

Thanks!
0
Comment
Question by:carlino70
  • 2
3 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39254364
With dates in the file like 23/04/13 12:00:00 and your control file using "DD-MM-YYYY HH24:Mi:SS",  I'm surprised any data is being loaded.

What does the log file say about the 'bad' data?
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 39254428
Check your log file.  For WS and TLQ you should see it didn't have the 'terminated by ||' and said NEXT 4.

Declare them external as well.  I was able to load with that.

I also modified the date string to match the file format.

LOAD DATA
CHARACTERSET WE8ISO8859P1
INTO TABLE A_5MIN_033_temp
Append
fields terminated by "||"
OPTIONALLY ENCLOSED BY '"'
(UTCTIME Date "DD/MM/YY HH24:MI:SS",
EPOCH Integer external,
VALOR_INST,
MS Integer external,
TLQ Integer external,
TAG Char,
PUNTO Integer external
)

Open in new window

0
 

Author Comment

by:carlino70
ID: 39257161
Thanks, I will implement this solution and then I will comment on the results.

regards
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question