Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > SQL Loader / Loading big text fields
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 14th November 23:26
jbroder
External User
 
Posts: 1
Default SQL Loader / Loading big text fields



Dan, That is very kind of you. Fortunately, I figured out my problem
this morning. Here is the solution for you and anyone else interested.

First, my data was not less than 4000char. A friend suggested that I
check with

SELECT length(textfieldname)

FROM table_name

WHERE length(textfieldname) > 2000

and sure enough there were some records that were too big for varchar2.

So, I changed my VARCHAR2(4000) datatype to CLOB for that field.

Next, it seems that SQL*Plus doesn't accept lines longer than 2500
characters. I noticed this error started with SP instead of ORA:

SP2-0027: Input is too long (> 2499 characters) - line ignored

So, I figured that I couldn't use SQL*Plus to input this data.

So, back to SQL *Loader...

My problem with SQL Loader is I couldn't find a way to tell it that
newline is not the end of record indicator. I couldn't find any
documentation on the end of record indicator at all. Maybe it has some
other name than end of record indicator?

Anway, after looking at this page in the SQL *Loader documentation:

http://www.engin.umich.edu/caen/wls/....901/a90192/c-
h07.htm#1006805

where it says

Example 7-13 Loading LOB Data in Delimited Fields

Control File Contents

LOAD DATA

INFILE 'sample.dat' "str '|'"

INTO TABLE person_table

FIELDS TERMINATED BY ','

(name CHAR(25),

1 "RESUME" CHAR(507) ENCLOSED BY '<startlob>' AND '<endlob>')

I figured out that INFILE 'sample.dat' "str '|'" meant that | is end of
record indicator. Then, the newline problem was solved and I just had to
make sure I enclosed with strings that weren't present in the data.
Mysql can output any kind of delimiters you want, so I went wild with
those in hopes of finding something not in the data.

I used ### as end of record and %% as substitute for "quotes" around
strings. I haven't yet fi

Here is my .ctl file if you are interested:

LOAD DATA

INFILE 'sms_doc_section.csv' "str '###'"

INTO TABLE sms_doc_section

FIELDS TERMINATED BY '|'

OPTIONALLY ENCLOSED BY '%%'

(doc_section_heading char,

doc_section_text char(4000000) OPTIONALLY ENCLOSED BY '%%' AND '%%',

doc_id ,

doc_section_id

)

I haven't verified the clobs in the db yet, but it went in there, so
that is a start anyway.

Jon


--
Posted via http://dbforums.com
  Reply With Quote


 


Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Development, Ada, Apple script, Assembler, Awk, Beos, Basic, C, C++, C#, C# .net, .net, .net frameworks, Asp .net, Clarion, Clipper, Clos, Clu, Cobol, Coldfusion, Delphi, Dylan, Eiffel, Forth, Fortran, Haskell, Hermes, Icon, Idl, Java, Java script, Jscript .net, Jcl, Linoleum, Lisp, Lotus, Limbo, Logo, Ml, Mumps, Oberon, Postscript, Pop, Pl1, Prolog, Python, Ruby, Pascal, Perl, Php, Rebol, Rexx, Sed, Sather, Scheme, Smalltalk, Tcl, Vhdl, Vrml, Visual basic, Visual basic .net, Yorick, Mysql, Omnis, Postgresql, Xbase, Access, Oracle, Adabas, Berkeley, Btrieve, Filemaker, Gupta, Db2, Informix, Ingres, Mssql server, Object, Olap, Paradox, Rdb, Revelation, Sybase, Theory, Dbase, Html, Java script, Css, Flash, Photoshop, Corel script, Xml, Tech, Beos, Gem, Hp48, Hpux, Linux, Mac, Ms-dos, Os2, Palm, Solaris, Ti99, Windows, Xenix, Aos, Chorus, Geos, Inferno, Lantastic, Lynx, Mach, Minix, Netware, Os9, Parix, Plan9, Psos, Qnx, Xinu, Sco, Unix, Aix, Aux, 386bsd, Bsdi, Freebsd, Netbsd, Openbsd, Ultrix, Amd, Intel, Aptiva, Buz, Deals, Homebuilt, Overclocking, Programming, Extra forums


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666