Solved

Load data with sqlldr

Posted on 2013-06-17
3
451 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

912 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now