Last terminator missing: any workaround? [message #157242] |
Wed, 01 February 2006 04:33 |
bobo69
Messages: 9 Registered: November 2005
|
Junior Member |
|
|
Hi,
Despite Oracle10 documentation, if the last field has no terminator and is numeric, there is an error at loading time even using Oracle's example:
CREATE TABLE emp_load (first_name CHAR(15), last_name CHAR(20), year_of_birth INT)
ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY ext_tab_dir
ACCESS PARAMETERS (FIELDS TERMINATED BY ","
MISSING FIELD VALUES ARE NULL)
LOCATION ('info.dat'));
Alvin,Tolliver,1976
Baer,Kenneth
Mary,Dube,1973
I get:
FIRST_NAME CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
LAST_NAME CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
YEAR_OF_BIRTH CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
error processing column YEAR_OF_BIRTH in row 1 for datafile /PROJET/AESLAB/bin/scripts/PC201/yeast/foo.dat
ORA-01722: invalid number
error processing column YEAR_OF_BIRTH in row 3 for datafile /PROJET/AESLAB/bin/scripts/PC201/yeast/foo.dat
ORA-01722: invalid number
Other examples work because the year is considered as CHAR.
If the last field is a string, no problem, by indicating its length, it loads.
Has anyone had the same problem? I will hardly convince the provider to add a terminator.
Thanks for any hint!
|
|
|
|
|
Re: Last terminator missing: any workaround? [message #157395 is a reply to message #157348] |
Thu, 02 February 2006 02:58 |
bobo69
Messages: 9 Registered: November 2005
|
Junior Member |
|
|
Barbara -
Thanks, that's what I had in mind, in case nothing else works, yes.
rleishman -
Using the oracle example, I created the foo.dat (or info.dat) using my PC windows platform, so I have '^M' (DOS like? I don't know, may be) at each end of line (that's what the vi editor shows me, once copied on the unix platform). So I could perhaps do it differently, and avoiding these extra characters , but my real-life files are generated on windows platforms, so anyway I have to deal with these end-of-line characters.
I'll probably use a Barbara-like solution and convert.
I still did not give up the effort to convince the providers to add a final field terminator, let's see ...
Thanks anyways!
|
|
|