I'm trying to load an .xml datafile into oracle for the last couple of hours without success.
======Here is my .ctl file====
LOAD DATA
INFILE output.xml "STR '</article>'"
BADFILE output.BAD
TRUNCATE
INTO TABLE FERNANDO.ARTICLES
TRAILING NULLCOLS
(
dummy filler terminated by "article>",
articlesTitle VARCHAR(500) enclosed by "<title>" and "</title>",
articlesAuthor CHAR(100) enclosed by "<author>" and "</author>",
articlesText CHAR(50000) enclosed by "<text>" and "</text>",
articlesClient CHAR(50) enclosed by "<client>" and "</client>",
articlesCharset CHAR(50) enclosed by "<charset>" and "</charset>",
articlesHeaders CHAR(5000) enclosed by "<headers>" and "</headers>",
articlesTransferEncoding CHAR(50) enclosed by "{Transfer-encoding=" and ", ",
articlesCacheControl CHAR(50) enclosed by "Cache-control=" and ", ",
articlesContentType CHAR(500) enclosed by "Content-type=" and ", ",
articlesPostedDate CHAR(50) enclosed by "Date=" and ", ",
articlesExpireDate CHAR(50) enclosed by "Expires=" and ", ",
articlesSetCookie CHAR(500) enclosed by "Set-cookie=" and ", ",
articlesDomain CHAR(50) enclosed by "Domain=" and ", ",
articlesServer CHAR(200) enclosed by "Server=" and ", ",
articlesPragma CHAR(200) enclosed by "Pragma=" and ", "
)
However, I have the following error at every other row:
Record 10: Rejected - Error on table FERNANDO.ARTICLES.
ORA-01461: can bind a LONG value only for insert into a LONG column
The Article Table is as follows:
CREATE TABLE ARTICLES (
articlesTitle VARCHAR2(255) NOT NULL ,
articlesAuthor VARCHAR2(64) NULL ,
articlesText VARCHAR2(1024) NULL ,
articlesClient CHAR(18) NULL ,
articlesCharset CHAR(18) NULL ,
articlesHeaders CHAR(255) NULL ,
articlesTransferEncoding VARCHAR2(12) NULL ,
articlesCacheControl VARCHAR2(12) NULL ,
articlesContentType VARCHAR2(12) NULL ,
articlesPostedDate DATE NULL ,
articlesExpireDate DATE NULL ,
articlesSetCookie VARCHAR2(128) NULL ,
articlesDomain VARCHAR2(64) NULL ,
articlesServer VARCHAR2(24) NULL ,
articlesPragma VARCHAR2(128) NULL ,
urlFrontierURL VARCHAR2(128) NULL ,
CONSTRAINT XPK_ARTICLES PRIMARY KEY (articlesTitle))
TABLESPACE project_tablespace
STORAGE (INITIAL 8192 NEXT 8192 MINEXTENTS 1 MAXEXTENTS 150000 );
Why the data file columns have different lengths than table?
That error can happens because you are trying to insert char data which is bigger than 4000 characters long