Tom .
I am running into a problem with External Tables. Please advise.
I have created the following statement for the external table .
DROP TABLE tab_ext ;
CREATE TABLE tab_ext
( col1 INTEGER,
col2 VARCHAR2(1),
col3 VARCHAR2(40),
col4 INTEGER,
col5 INTEGER,
col6 INTEGER,
col7 INTEGER,
col8 INTEGER,
col9 INTEGER,
col10 INTEGER,
col11 INTEGER,
col12 INTEGER null ,
col13 INTEGER null
)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY DP_LOAD_DIR
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE CHARACTERSET we8mswin1252
BADFILE DP_LOAD_DIR:'tab_ext.bad_xt'
LOGFILE 'tab_ext.log_xt'
FIELDS TERMINATED BY "," LDRTRIM
REJECT ROWS WITH ALL NULL FIELDS
)
LOCATION
( 'tab_ext.out'
)
)
REJECT LIMIT UNLIMITED;
This is the contents of tab_ext.out
9780061095948,R,9780061095948_R,20081207,,,,,-3 ,-3 , 8 ,,
9780061095948,R,9780061095948_R,20081214,, 48 , 48 ,,-5 ,-5 , 51 ,,
When I issue the SELECT statement . I see the following the entries in the log file . Field Definitions for table TAB_EXT
Record format DELIMITED BY NEWLINE
Data in file has same endianness as the platform
Reject rows with all null fields
Fields in Data Source:
COL1 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
COL2 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
COL3 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
COL4 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
COL5 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
COL6 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
COL7 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
COL8 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
COL9 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
COL10 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
COL11 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
COL12 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
COL13 CHAR (255)
Terminated by ","
Trim whitespace same as SQL Loader
KUP-04021: field formatting error for field COL13
KUP-04023: field start is after end of record
KUP-04101: record 1 rejected in file E:\br5\dp1\tout\tab_ext.out
KUP-04021: field formatting error for field COL13
KUP-04023: field start is after end of record
KUP-04101: record 2 rejected in file E:\br5\dp1\tout\tab_ext.out
But , If I add a "additional " comma to the end of the record in the datafile like shown below , I see no issue in the data retrival .
9780061095948,R,9780061095948_R,20081207,,,,,-3 ,-3 , 8 ,,,
9780061095948,R,9780061095948_R,20081214,, 48 , 48 ,,-5 ,-5 , 51 ,,,
This is in 10g Release 2 on Windows 64 bit itanimum . It seems to be excepting additional comma to the end . Please advise.
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 64-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production