Solved

SQL LOADER issue with incomplete char data

Posted on 2014-04-30
5
567 Views
Last Modified: 2014-04-30
Hi experts, when I do an insert/append with sqlldr I see incomplete data in a CHAR column:
Here de control.ctl
Load DATA
CHARACTERSET WE8ISO8859P1
INFILE '60.dat' 
BADFILE '60.bad'
DISCARDFILE '60.dsc'
INTO TABLE TEMAS
Append
fields terminated by "|"
OPTIONALLY ENCLOSED BY '"'
trailing NULLCOLS
(ID           Integer "temas_id.nextval",              
 NOMBRE       CHAR(100), 
 INTERPRETE   CHAR NULLIF INTERPRETE=' ',
 TITULO       CHAR NULLIF TITULO=' ',
 ALBUM        CHAR NULLIF ALBUM=' ',
 FECHA        Date "DD-MM-YYYY HH24:Mi:SS",
 GENERO       CHAR NULLIF GENERO=' ',                
 TAMAÑO       CHAR NULLIF TAMAÑO=' ',
 DURACION     CHAR NULLIF DURACION=' ',                
 VELOCIDAD    CHAR NULLIF VELOCIDAD=' ',                
 COMENTARIOS  CHAR NULLIF COMENTARIOS=' ',               
 PATH         CHAR NULLIF PATH=' ')

Open in new window

here a portion of data:
|60 - uno.mp3  |||||||||||
|60 - dos.mp3  |||||||||||
|60 - tres.mp3 |||||||||||

Open in new window

After append, I hope to view:
select nombre from temas;

Open in new window

Result:
60 - uno.mp3
60 - dos.mp3
60 - tres.mp3

Open in new window

But I see:
- uno.mp3
- dos.mp3
- tres.mp3

Open in new window

The definition of the table is:
CREATE TABLE TEMAS
(
  ID           INTEGER,
  NOMBRE       VARCHAR2(100 BYTE),
  INTERPRETE   VARCHAR2(50 BYTE),
  TITULO       VARCHAR2(100 BYTE),
  ALBUM        VARCHAR2(50 BYTE),
  FECHA        DATE                             DEFAULT TO_DATE(SYSDATE,'DD/MM/YYYY HH24:MI:SS'),
  GENERO       VARCHAR2(30 BYTE),
  TAMAÑO       VARCHAR2(60 BYTE),
  DURACION     VARCHAR2(20 BYTE),
  VELOCIDAD    VARCHAR2(20 BYTE),
  COMENTARIOS  VARCHAR2(200 BYTE),
  PATH         VARCHAR2(200 BYTE)
)
TABLESPACE USERS;

Open in new window

What it is wrong?
Thank in advanced
Regards
0
Comment
Question by:carlino70
  • 2
  • 2
5 Comments
 
LVL 23

Expert Comment

by:David
ID: 40032400
Would you please display the actual results rather than a representation?  At first glance, the VARCHAR to CHAR conversion should not be stripping out data from the column.

SELECT id, SUBSTR(nombre,1,30) nombre
FROM temas
WHERE ROWNUM < 5
/
0
 

Author Comment

by:carlino70
ID: 40032508
Here the answer:

ID|NOMBRE
341|- donald - tiritando.mp3      
342|- los naufragos - de boliche e
343|- los naufragos - estoy hecho 
344|- palito ortega - bienvenido a

Open in new window

without SUBSTR, should be:
ID|NOMBRE
341|- donald - tiritando.mp3                       
342|- los naufragos - de boliche en boliche.mp3    
343|- los naufragos - estoy hecho un demonio.mp3   
344|- palito ortega - bienvenido amor.mp3          

Open in new window

note: I dont understand why appears the "|" between columns (?)
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 40032587
Try removing the data type for id.

Change:
...
trailing NULLCOLS
(ID           Integer "temas_id.nextval",  
...

To:
...
trailing NULLCOLS
(ID           "temas_id.nextval",  
...
0
 

Author Comment

by:carlino70
ID: 40032766
Excellent!,

The inclusion of the data type INTEGER, somehow confused the sql loader.
Thanks
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40032773
Just a theory:
I think sqlloader was looking for an integer in the data before looking at the seq.nextval.

Without the data type, it took it as a literal value and ignored the data.
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

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
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 copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
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

773 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