SQL Loader, CLOB, delimited fields
Hello.I have to load using SQL Loader of csv file data into a table, a field is of type CLOB.
Here's how ctl file looked like at the beginning:
UNRECOVERABLE
DOWNLOAD THE DATA
INFILE «.\csv_files\TSH_DGRA.csv '.
BADFILE «.\bad_files\TSH_DGRA.bad '.
DISCARDFILE «.\dsc_files\TSH_DGRA.dsc '.
ADD
IN THE TSH_DGRA TABLE
FIELDS ENDED BY ',' POSSIBLY FRAMED BY "" "
TRAILING NULLCOLS
(
ID_OBJ_TSHD,
PR_ZOOM_TSHD,
PR_GRID_TSHD,
PR_ELMGR_TSHD TANK (4000) OPTIONALLY ENCLOSED BY '< clob >' AND ' < / clob > ',
PR_ALRMGR_TSHD TANK (4000) OPTIONALLY ENCLOSED BY '< clob >' AND ' < / clob > '
)
The problems are the fields PR_ELMGR_TSHD and PR_ALRMGR_TSHD (CLOB in the table TSH_DGRA). Until which data should be loaded into CLOB fields are at least 4000 characters, it works very well, but what do I do if I want to load data that is older of 4000 characters?
If found on the link: [http://download.oracle.com/docs/cd/B14117_01/server.101/b10825/ldr_loading.htm#i1006803] which a sentence says:
"SQL * Loader by default 255 bytes when moving CLOB data, but you can specify a value of up to 2 gigabytes." For a field bounded, if a length is specified, this length is used as a maximum. If no maximum is specified, it uses default 255 bytes. For a CHAR field that is bounded and is also greater than 255 bytes, you must specify a maximum length. (See TANK for more information on the CHAR data type".
So, my question is, how specify "up to 2 GB" so that text says? I can't use the CHAR data type because it is limited to 4,000 characters. And I have to load about 60000 characters. I also can't use technique where all each CLOB field data in separate files.
Simply specify the expected maximum size:
....
PR_ELMGR_TSHD TANK (100000), POSSIBLY ENCLOSED BY "
PR_ALRMGR_TSHD TANK (1000000), OPTIONALLY ENCLOSED BY '...
)
The CHARIOT (1000000) will allow SQLLDR to manage up to 1000000 bytes of input text.
Tags: Database
Similar Questions
-
Dear friends,
Please guide me with this.
What is bad here in this?LOAD DATA INFILE 'D:\load\dat\Enquiry_reply.dat' BADFILE 'D:\load\bad\Enquiry_reply.bad' DISCARDFILE 'D:\load\dat\discard\Enquiry_reply.dsc' replace INTO TABLE OES_Enquiry FIELDS TERMINATED BY '[' (Reply CLOBFILE("D:\load\dat\oes_enquiry_reply.dat") TERMINATED BY '[')
Please me tips on how to on this subject.I am getting error: *SQL*Loader-350: Syntax error at line 6.* Expecting "," or ")", found "CLOBFILE". (Reply CLOBFILE("D:\load\dat\enquiry_reply.dat") TERMINATED BY '['
Thanks in advance.
Nith
Published by: user645399 on November 30, 2010 18:58Hello
Use single quotes inside of double quotes for the path and file name.
+ ("' D:\load\dat\oes_enquiry_reply.dat'") +.
Thank you.
-
SQL * loader and sdo_geometry field
Is it possible to load coordinates longitude/latitude of a flat file directly into a field sdo_geometry with sql * loader? If so, does anyone have an example? I just want to create point functions.
Thank you
DavidDavid,
Section 4.1.2 of the space Guide has examples for this:DOWNLOAD THE DATA
INFILE *.
TRUNCATE
CONTINUEIF NEXT(1:1) = ' # '.
POINT OF TABLE
FIELDS TERMINATED BY ' |'
TRAILING NULLCOLS)
GID INTEGER EXTERNAL,
GEOMETRY COLUMN OBJECT
(
SDO_GTYPE INTEGER EXTERNAL,
COLUMN SDO_POINT_TYPE OBJECT
(X FLOAT EXTERNAL,
THERE FLOAT EXTERNAL)
)
)BEGINDATA
1. 2001 | -122.4215 | 37.7862 |
2. 2001 | -122.4019 | 37.8052 |
3. 2001 | -122.426 | 37.803 |
4. 2001 | -122.4171 | 37.8034 |
5. 2001 | -122.416151 | 37.8027228 |You must add the SRID field if you want to add the SRID for geometry.
Or you can do this with SQL when the data is loaded into the DB.Siva
-
Error SQL Loader loading a field date
Hello
I get the error while I'm trying to load a table with a field of date using SQL Loader below
Sheet 1: Rejected - error on the table RPT_HOST_USAGE, column USAGE_TIMESTAMP.
ORA-01861: literal does not match the format string
My input file is as below
< code >
Host_Usage_ID, Host_ID, Technology_ID, Environment_ID, Usage_Timestamp, Avg_CPU_Pct, Avg_Memory_MB, CPU_Spike
1,12,1,8,'2009-08-01 00:00:00 ', 0.000000000, 23875.000000000, 0.000000000
< code >
My Loader.ctl is
< code >
OPTIONS (SKIP = 1)
load data
INFILE 'C:\rpt_Host_Usage.txt '.
in the RPT_HOST_USAGE table
fields completed by «,»
(
HOST_USAGE_ID,
HOST_ID,
TECHNOLOGY_ID,
ENVIRONMENT_ID,
USAGE_TIMESTAMP,
AVG_CPU_PCT,
AVG_MEMORY_MB,
CPU_SPIKE
)
< code >
I tried options like USAGE_TIMESTAMP TO_DATE(USAGE_TIMESTAMP,'YYYY-MM-DD HH24:MI:SS') but did not...
Can you please tell me how to fix this?
Pointers on it will be useful
Thank you
MaheshI went back and looked at some of my old files of *.ctl and I did something simlilar to what you mentioned and it worked for me, but I was surrounded by the quotes option and included a colon in front of the element. Example:
...
TECHNOLOGY_ID,
ENVIRONMENT_ID,
USAGE_TIMESTAMP ' to_date (: USAGE_TIMESTAMP, "YYYY-MM-DD HH24:MI:SS)."
AVG_CPU_PCT,
AVG_MEMORY_MB,
.... -
How to handle multiple formats of date to the same date field in SQL * Loader
Dear all,
I have a requirement where I need to get data from a text file and even insert into the oracle table.
I'm using SQL * Loader to fill data from the text file in my table.
The file has an area where I expect to date data date in different formats, such as MON/dd/yyyy mon/dd/yyyy mon/dd/yyyy, dd/mm/yyyy, DD/month/yyyy.
When you use SQL * Loader, I can see loading fails for records where we have formats such as LUN/jj/aaaa, Mon/dd/yyyy, DD/month/yyyy.
Is it possible in SQL * Loader where we can mention all these date formats so that data from that date should go smoothly in the underlying date column in the table.
Receive your answer on that.
Thank you
Madhu K.I think following could be the solution to your problem:
Suppose if you have data from four different date formats, you need to load the data into four different tables by running SQL * Loader four times and each time specify other date format in the control file whose data to load, and then at the end, merge data from these four different tables using the UNION clause.
Elya
-
SQL * Loader does not import data
Hi all -
I have a very basic package which should load data from a file delimited by tabs. My problem is that when I run my package, no data is loaded. Although the correct number of records is created (based on relaxation of the table). All records contain no data.
OPTIONS (skip = 1, errors = 10, lines = 10000, direct = True)
DOWNLOAD THE DATA
INFILE "C:\ECOMMERCE\VFT\Marin\inbound\DSGSiteCatalystPassbackKeywords.csv" "str"\n"
BADFILE "C:\ECOMMERCE\MFT\NxtGen_Catalog_Int\ErrorFiles\MARIN_DSG_KEYWORDS.bad."
DISCARDFILE 'C:\ECOMMERCE\MFT\NxtGen_Catalog_Int\ErrorFiles\MARIN_DSG_KEYWORDS.dsc '.
IN THE TABLE "ETL_STAGE". "" MARIN_KEYWORD ".
ADD
EVALUATE CHECK_CONSTRAINTS
"FIELDS TERMINATED BY ' 09 X."
TRAILING NULLCOLS
(
MARIN_KEYWORD_ID,
KEYWORD,
BUSINESS_DATE,
EDITOR,
ACCOUNT,
CAMPAIGN,
AD_GROUP,
TYPE CHAR (100000),
DESTINATION_URL,
UNIQUE_ID,
PUB_ID,
PRINT,
CLICKS,
PUB_COST,
ATTRIBUTED_CONVERSIONS_CONV,
CLICK_PATH_CONV,
LAST_CLICK_CONV,
EMAIL_SIGNUPS_CONV,
SCORECARD_SIGNUPS_CONV,
STORE_LOCATOR_PAGE_CONV
)
My table creation script is:
CREATE THE TABLE ETL_STAGE. MARIN_KEYWORD
(
MARIN_KEYWORD_ID VARCHAR2 (1000 BYTE),
KEYWORD VARCHAR2 (1000 BYTE).
BUSINESS_DATE VARCHAR2 (200 BYTE),
EDITOR VARCHAR2 (1000 BYTE),
ACCOUNT VARCHAR2 (1000 BYTE),
CAMPAIGN VARCHAR2 (1000 BYTE),
AD_GROUP VARCHAR2 (1000 BYTE),
TYPE VARCHAR2 (1000 BYTE),
DESTINATION_URL VARCHAR2 (1000 BYTE),
UNIQUE_ID VARCHAR2 (1000 BYTE),
PUB_ID VARCHAR2 (1000 BYTE),
VARCHAR2 (1000 BYTE) PRINT,
VARCHAR2 (1000 BYTE) CLICKS,
PUB_COST VARCHAR2 (1000 BYTE),
ATTRIBUTED_CONVERSIONS_CONV VARCHAR2 (1000 BYTE),
CLICK_PATH_CONV VARCHAR2 (1000 BYTE),
LAST_CLICK_CONV VARCHAR2 (1000 BYTE),
EMAIL_SIGNUPS_CONV VARCHAR2 (1000 BYTE),
SCORECARD_SIGNUPS_CONV VARCHAR2 (1000 BYTE),
STORE_LOCATOR_PAGE_CONV VARCHAR2 (1000 BYTE),
IMEX_LOG_REFERENCE_ID VARCHAR2 (1000 BYTE),
DATE_ADDED DATE DEFAULT SYSDATE NOT NULL,.
ADDED_BY VARCHAR2 (50 BYTES) BY DEFAULT USER NOT NULL,.
DATE_LAST_MODIFIED DATE DEFAULT SYSDATE NOT NULL,.
MODIFIED_BY VARCHAR2 (50 BYTES) BY DEFAULT USER NOT NULL,.
RECORD_STATUS VARCHAR2 (1 BYTE) DEFAULT 'A' NOT NULL
)
TABLESPACE ECOM_DATA
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE)
64K INITIALS
ACCORDING TO 1 M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
DEFAULT USER_TABLES
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
The log displays the following text:
SQL * Loader: release 11.2.0.2.0 - Production on Thu Jun 25 14:31:35 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Control file: C:\ECOMMERCE\MFT\NxtGen_Catalog_Int\SQLLoaderScripts\MARIN_DSG_CREATIVES.ctl
Data file: C:\ECOMMERCE\VFT\Marin\inbound\DSGSiteCatalystPassbackCreatives.csv
Bad leadership: C:\\ECOMMERCE\MFT\NxtGen_Catalog_Int\ErrorFiles\MARIN_DSG_CREATIVES.bad
Delete the file: C:\ECOMMERCE\MFT\NxtGen_Catalog_Int\ErrorFiles\MARIN_DSG_CREATIVES.dsc
(Allow all releases)
Number of loading: ALL
Number of jump: 10
Authorized errors: 50
Link table: 64 lines, maximum of 256000 bytes
Continuation of the debate: none is specified
Path used: classics
Table 'ETL_STAGE '. "" MARIN_CREATIVE ", loaded from every logical record.
Insert the option in effect for this table: APPEND
TRAILING NULLCOLS option in effect
Column Position Len term Encl. Datatype name
------------------------------ ---------- ----- ---- ---- ---------------------
CREATIVE_ID PRIME * WHT O(") CHARACTER
The maximum field length is 100,000
HEADLINE THEN * CHARACTER O(") WHT
BUSINESS_DATE NEXT * CHARACTER O(") WHT
The SQL string for the column: 'TRIM(:BUSINESS_DATE) '.
DESCRIPTION_LINE_1 NEXT * CHARACTER O(") WHT
DESCRIPTION_LINE_2 NEXT * CHARACTER O(") WHT
DISPLAY_URL NEXT * CHARACTER O(") WHT
DESTINATION_URL NEXT * WHT O(") CHARACTER
The maximum field length is 100,000
EDITOR NEXT * CHARACTER O(") WHT
THEN THE CAMPAIGN * CHARACTER O(") WHT
AD_GROUP NEXT * CHARACTER O(") WHT
UNIQUE_ID NEXT * CHARACTER O(") WHT
PUB_ID NEXT * CHARACTER O(") WHT
PRINT NEXT * CHARACTER O(") WHT
The SQL string for the column: "replace (: print, ',',") "."
CLICK ON NEXT * CHARACTER O(") WHT
The SQL string for the column: "replace (: CLICKS, ',',") "."
ATTRIBUTED_CONVERSIONS_CONV NEXT * CHARACTER O(") WHT
CLICK_PATH_CONV NEXT * CHARACTER O(") WHT
LAST_CLICK_CONV NEXT * CHARACTER O(") WHT
EMAIL_SIGNUPS_CONV NEXT * CHARACTER O(") WHT
SCORECARD_SIGNUPS_CONV NEXT * CHARACTER O(") WHT
STORE_LOCATOR_PAGE_HITS_CONV NEXT * CHARACTER O(") WHT
IMEX_LOG_REFERENCE_ID NEXT * CHARACTER O(") WHT
Why WHT, showing when I use tabs?
In addition, why is not display all the data in the files?
NLS_CHARACTERSET WE8ISO8859P1 -
SQL Loader issue - CSV with commas and quotes IN the data
Hello, I have a dataset for a simple table of 2 columns like this:
Column 1, "it is given for"Column 2", with commas and quotes."
Data are delimited by commas and may be surrounded by double quotes. In ADDITION, it may include commas and quotation marks in the data fields. I CANNOT manipulate data before sending it to SQL Loader.
I set my file of control like this:
DOWNLOAD THE DATA
INFILE '. / TEST.dat'
BADFILE '. / TEST. BAD'
DISCARDFILE '. / TEST. DSC"
REPLACE IN THE TEST TABLE
Fields ended by ',' POSSIBLY BOX BY ' "' TRAILING NULLCOLS"
(
Col1 char (50),
Col2 char (500)
)
Now when I run the present via SQLLDR, I get the following error in the log file:
Sheet 1: Rejected - error on table TEST, column COL2.
no terminator found after CLOSE and CLOSED field
What are my options to get the loaded data as presented above? I'm working on Oracle 11 g (11.2.0.3.0) 64-bit on AIX 6.1.0.0.
Thank you!
In this case, there is no way she can tell who's a delimiter or pregnant and which is part of the data. As far as I know, there is no way that you can load it into the appropriate columns.
-
SQL loader, problem with the POSITION &; EXTERNAL
Hi gurus of the Oracle.
I have problem with position and external.
I have the data file with the data of 1 million records
data delimiter is to and eventually closed by «»
some lines are not loaded due to errors of data, i.e. data contains some «»
now, we decided to use the position & external. am unable to write the control file.
any help would be much appreciated
The table name is person_memo, 4 columns
ID_PERSON VARCHAR2 (9 bytes) TX_MEMO VARCHAR2 (1000 bytes) ID_USER VARCHAR2 (20 bytes) TM_STAMP TIMESTAMP (6) my control file is
DOWNLOAD THE DATA
ADD THE PERSON_MEMO TABLE
FIELDS TERMINATED BY ' |'
SURROUNDED OF POSSIBLY "" "
TRAILING NULLCOLS
(
ID_PERSON POSITION (1) "CUT (: ID_PERSON).
, TX_MEMO POSITION (10) TANK (1000) "CUT (: TX_MEMO).
, POSITION (1012) ID_USER "TRIM (: ID_USER).
, TM_STAMP POSITION (1031) EXTERNAL (26) ' DECODE (: TM_STAMP, NULL, NULL, TO_TIMESTAMP (: TM_STAMP, ' YYYY-MM-DD - HH24.MI.)). SS. "(FF')).
)
specimen of data file
"04725813" | "aka"Little Will"" "|" " 095TDEAN «|» 2013-02-21 - 11.13.44.632000
"05599076" | "" FIRST NAME - ADDED A 'T' AS ON THE REG MAP | ' 016DDEAL ' |. ' 2014-04-11 - 10.06.35.598000
Thanks and greetings
REDA
In your control file, EXTERNAL (26) must be INTEGER EXTERNAL (26).
Unfortunately, this forum destroyed the spacing, so I can't say whether or not your data are positionnelles. If it is positional, you can then use positions, but you need start and end positions. The positions that you posted have nothing to do with the data you've posted. If you use positions, you can eliminate the delimiters and the beginning and the end of citations using these positions.
If your data are not positionnelles and you have quotes in your data in quotes, but you don't have the pipe delimiters in your data, then you can only use the delimiters and trim the quotes start and final data.
I have demonstrated the two methods below, using test1.ctl for the positional method and test2.ctl for the defined method.
Scott@orcl12c > host type test.dat
"04725813" | "aka"Little Will"" | "" 095TDEAN «|» 2013-02-21 - 11.13.44.632000
"05599076" | "" FIRST NAME - ADDED A 'T' AS ON THE REG MAP | ' 016DDEAL ' |. ' 2014-04-11 - 10.06.35.598000
Scott@orcl12c > type host test1.ctl
DOWNLOAD THE DATA
ADD THE PERSON_MEMO TABLE
FIELDS TERMINATED BY ' |'
TRAILING NULLCOLS
(ID_PERSON POSITION (02:10))
, TX_MEMO POSITION (14:59)
POSITION ID_USER (63:82)
, TM_STAMP POSITION (85:110) EXTERNAL INTEGER (26) ' DECODE (: TM_STAMP, NULL, NULL,).
TO_TIMESTAMP (: TM_STAMP, ' YYYY-MM-DD - HH24.MI.) SS. "(FF')).
)
Scott@orcl12c > type host test2.ctl
DOWNLOAD THE DATA
ADD THE PERSON_MEMO TABLE
FIELDS TERMINATED BY ' |'
TRAILING NULLCOLS
(ID_PERSON "TRIM ("------"" FROM: ID_PERSON ")")
, TX_MEMO CHAR (1000) "TRIM ("------"" FROM: TX_MEMO ").
, ID_USER "TRIM ("------"" FROM: ID_USER ").
, TM_STAMP INTEGER EXTERNAL (26) ' DECODE (: TM_STAMP, NULL, NULL,).
TO_TIMESTAMP (: TM_STAMP, ' YYYY-MM-DD - HH24.MI.) SS. "(FF')).
)
Scott@orcl12c > create table person_memo
2 (ID_PERSON VARCHAR2 (9 bytes)
3, TX_MEMO VARCHAR2 (1000 bytes)
4, ID_USER VARCHAR2 (20 bytes)
5, TM_STAMP TIMESTAMP (6))
6.
Table created.
Scott@orcl12c > host sqlldr scott/tiger control = test1.ctl data = test.dat log = test1.log
SQL * Loader: release 12.1.0.1.0 - Production Thursday, May 15, 10:53:11-2014
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
Path used: classics
Commit the point reached - the number of logical records 2
Table PERSON_MEMO:
2 rows loaded successfully.
Check the log file:
test1.log
For more information on the charge.
Scott@orcl12c > select * from person_memo
2.
ID_PERSON
---------
TX_MEMO
--------------------------------------------------------------------------------
ID_USER
--------------------
TM_STAMP
---------------------------------------------------------------------------
04725813
aka "Little Will"
095TDEAN
21 FEBRUARY 13 11.13.44.632000 AM
05599076
FIRST NAME - ADDED A 'T' AS ON THE REG MAP
016DDEAL
11 APRIL 14 10.06.35.598000 AM
2 selected lines.
Scott@orcl12c > truncate table person_memo
2.
Table truncated.
Scott@orcl12c > host sqlldr scott/tiger control = test2.ctl data = test.dat log = test2.log
SQL * Loader: release 12.1.0.1.0 - Production Thursday, May 15, 10:53:11-2014
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
Path used: classics
Commit the point reached - the number of logical records 2
Table PERSON_MEMO:
2 rows loaded successfully.
Check the log file:
test2.log
For more information on the charge.
Scott@orcl12c > select * from person_memo
2.
ID_PERSON
---------
TX_MEMO
--------------------------------------------------------------------------------
ID_USER
--------------------
TM_STAMP
---------------------------------------------------------------------------
04725813
aka "Little Will"
095TDEAN
21 FEBRUARY 13 11.13.44.632000 AM
05599076
FIRST NAME - ADDED A 'T' AS ON THE REG MAP
016DDEAL
11 APRIL 14 10.06.35.598000 AM
2 selected lines.
-
Reg: Problem SQL Loader-
Hi Experts,
I am trying to load data from a flat file in an Oracle table, but face some problems.
Concern (1) (1)
I have a directory where there are about 20 similar files named as 'rb_1', 'rb_2', 'rb_3', etc...
All these data should be loaded in a Word only table 'X '.
Is it possible that only 1 CTL file will make a loop and load all the files in X?
Concern (2) (2)
Field delimiter is Ctrl-X (CAN: cancel) and Ctrl-M (EM: em) characters
Line delimiter is Ctrl-Z (SUB: substitute) and Ctrl-T (DC4: Device Control) characters
Is there a way I can specify this in my CTL file?
(I've only worked on delimiter of field as comma "«»", de champ comme virgule «», pas speciales personnages comme ca not special characters like that)
Please let me know if any additional information is required.
Help much appreciated.
Thank you
-Nordine
Agree with Hoek, you'd better to use external tables you can specify multiple filenames at once, otherwise you will have a script that provides the name of the input file when calling sql loader and make this script loop for each file.
Regarding the ctrl characters in your delimiters, control file supports the hexagonal versions of them for example
fields terminated by ' 09 x. "
where 9 is the hexagon of the ascii value of the character (in this case a tab character).
CTRL-m, that would be x ' 0 of etc.
-
Option of SQL loader control file
Hello
I just started using sql loader and I doubt as a requirement.
I used to get the first data file with 10 columns excel. We got a table with 10 columns backend and were load this excel file using sql loader.
but since last week, they changed the data file and are now sending the data in column 8. what my condition is, for the other 2 columns, I want to insert text 'COLUMN_DROPPED' in the backend table. Rest 8 columns must be filled as usual.
How can I handle files of control for this option?
I just want to know the option that I why I am not providing control file.
Thank you
Puneet974647 wrote:
My requirement is for the other 2 columns, I want to insert text 'COLUMN_DROPPED' in the backend table. Rest 8 columns must be filled as usual.First of all, it is only possible if remaining 2 column datatype is string (char/nchar, varchar2/nvarchar2, clob/nclob) and is at least 14 characters long. The rest is easy. Just change 2 last control file fields:
column9 constant 'COLUMN_DROPPED', column10 constant 'COLUMN_DROPPED'
SY.
-
Error loading XML file in the column of XMLTYPE through SQL loader
Hi gurus,
I am trying to load the XML file into the column of XMLTYPE through SQL Loader but the errors themselves. Here are the details
Databases
The table structureSQL*Plus: Release 10.2.0.3.0 - Production on Tue Jul 24 17:17:55 2012 Copyright (c) 1982, 2006, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Release 10.2.0.3.0 - 64bit Production BANNER ---------------------------------------------------------------- Oracle Database 10g Release 10.2.0.3.0 - 64bit Production PL/SQL Release 10.2.0.3.0 - Production CORE 10.2.0.3.0 Production TNS for Linux: Version 10.2.0.3.0 - Production NLSRTL Version 10.2.0.3.0 - Production
XML (simple.xml) fileCREATE TABLE TH_XML ( COL_ID_1 VARCHAR2(100 BYTE), IN_FILE_1 XMLTYPE ) XMLTYPE IN_FILE_1 STORE AS CLOB (TABLESPACE SMDAT)
Control file<?xml version="1.0"?> <catalog> <book id="bk101"> <author>Some Author1</author> <title>Some Title1</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>creating applications</description> </book> <book id="bk112"> <author>Some Author2</author> <title>Some Title2</title> <genre>Computer</genre> <price>49.95</price> <publish_date>2001-04-16</publish_date> <description>Microsoft Visual Studio 7 is explored in depth</description> </book> </catalog>
LOG fileLOAD DATA INFILE 'c:\simple.xml' APPEND INTO TABLE TH_XML XMLTYPE(in_file_1) ( col_id_1 filler CHAR (100), in_file_1 LOBFILE(CONSTANT "c:\simple.xml") TERMINATED BY EOF )
I get error ORA-00904: "SYS_NC_ROWINFO$": invalid identifier in the logfile (mentioned above). Could someone help me know where I am doing wrong?SQL*Loader: Release 10.2.0.3.0 - Production on Tue Jul 24 16:42:25 2012 Copyright (c) 1982, 2005, Oracle. All rights reserved. Control File: c:\my_file.ctl Data File: c:\simple.xml Bad File: c:\simple.bad Discard File: none specified (Allow all discards) Number to load: ALL Number to skip: 0 Errors allowed: 50 Bind array: 64 rows, maximum of 256000 bytes Continuation: none specified Path used: Conventional Table TH_XML, loaded from every logical record. Insert option in effect for this table: APPEND Column Name Position Len Term Encl Datatype ------------------------------ ---------- ----- ---- ---- --------------------- COL_ID_1 FIRST 100 CHARACTER (FILLER FIELD) IN_FILE_1 DERIVED * EOF CHARACTER Static LOBFILE. Filename is c:\simple.xml Record 1: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 2: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 3: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 4: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 5: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 6: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 7: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 8: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 9: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 10: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 11: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 12: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 13: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 14: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 15: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 16: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 17: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 18: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 19: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 20: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 21: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 22: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 23: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Table TH_XML: 0 Rows successfully loaded. 23 Rows not loaded due to data errors. 0 Rows not loaded because all WHEN clauses were failed. 0 Rows not loaded because all fields were null. Space allocated for bind array: 256 bytes(64 rows) Read buffer bytes: 1048576 Total logical records skipped: 0 Total logical records read: 23 Total logical records rejected: 23 Total logical records discarded: 0 Run began on Tue Jul 24 16:42:25 2012 Run ended on Tue Jul 24 16:42:26 2012 Elapsed time was: 00:00:00.23 CPU time was: 00:00:00.05
Thanks in advance.
Published by: 876991 on 24 July 2012 14:18Hello
This remove the control file:
XMLTYPE(in_file_1)
It is used only if the target table is an array of XMLType object.
For an XMLType column LOBFILE is sufficient, for example:
LOAD DATA INFILE * APPEND INTO TABLE TH_XML ( col_id_1 CHAR (100), in_file_1 LOBFILE(CONSTANT "c:\simple.xml") TERMINATED BY EOF ) begindata MYID1
It tells SQL * Loader data consisting of one record with COL_ID_1 = "MYID1" and content = "c:\simple.xml" IN_FILE_1
SQL> CREATE TABLE TH_XML 2 ( 3 COL_ID_1 VARCHAR2(100 BYTE), 4 IN_FILE_1 XMLTYPE 5 ); Table created. SQL> host sqlldr control=test.ctl Username:dev Password: SQL*Loader: Release 11.2.0.2.0 - Production on Mer. Juil. 25 01:30:46 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Commit point reached - logical record count 1 SQL> set long 5000 SQL> column col_id_1 format a15 SQL> select * from th_xml; COL_ID_1 IN_FILE_1 --------------- -------------------------------------------------------------------------------- MYID1
Some Author1 Some Title1 Computer 44.95 2000-10-01 creating applications Some Author2 Some Title2 Computer 49.95 2001-04-16 Microsoft Visual Studio 7 is explored in depth -
Encapsulate data problems when loading with sql loader
Hi all
I use sql loader to load data into a flat file HP UNIX.
I find the fi the NUMBER data type or date type get wraped to the new line, the control file triggered errors.
The data looks like to (field dilimiter is |, record dilimter is ~):
1 A87CCH | 1 A87CCH | PLAN_ACCOUNT_PROMOTION | HIR6A-1 | 20100706 06:06:24 | 1 DNE1 | DC?
2010.7 FY1011 Promoiton | 1 A87AW0 | 1 HJEZE | Private | 20100730 00:00:00 | 00 20100710
: 00:00 | 0 | Completed | 20100730 00:00:00 | 20100710 00:00:00 | 0 | 1 4A6PKP | TFMAAI | N
| 0 | 0 | 0 | 0 | 0 | 0 | 1 4A6PKP | Approved | 1 8U4E-163 | 00:00:20110630 00 |
20100708 01:45:35 | 20100707 00:00:00 | -1||| 0 | 9000 | 0 | 0 ||| 100. N | 0 | 0 | 0 | 0
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | N | 20110426 04:01:34 | 1 8U4E-163 | 0|||||||||
||||| ~
The control file looks like:
OPTIONS (ERRORS = 1000, DIRECT = TRUE, PARALLEL = TRUE, DATE_CACHE = 5000, discardmax = 50)
UNRECOVERABLE
load data
INFILE ' / home/bs7822/leon/leon.dat' "str" ~ "»
BADFILE ' / home/bs7822/leon/leon.bad'
DISCARDFILE ' / home/bs7822/leon/leon.discard'
ADD THE LEON_123456 TABLE
FIELDS TERMINATED BY ' | '. SURROUNDED OF POSSIBLY "" "
TRAILING NULLCOLS
(
X_INTERFACED_DT EXPRESSION "to_date (replace (replace (: X_INTERFACED_DT_BF, chr (10),"), Chr (13), "), 'YYYYMMDD hh24:mi:ss')", "
X_INTERFACED_DT_BF boundfiller,
EXTERNAL DECIMAL X_ACCRUAL_AMT,
X_PLAN_SHIPMENT_PATTERN_ID TANK (90)
)
I think that replace it can treat the wrapped date. But I want to know if we can find a faster or easier way to conquer this topic since the beginning.
Best regards
Leonuser12064076 wrote:
Thank you for your response. But how to ensure that a record is in a single line? For example, to unload data with coil?The table has more than 100 columns.
Best regards
LeonUH... which guarantee is implemented by anyone or anything that generates the data in the first place.
for example if I am extracting data to CSV for a customer or another application, making sure that it is 1 card per line with delimiters known etc.What is your own code that produces the data in the first place? If so, how are you to produce? With large amounts of data I wouldn't do it with SQL * Plus spool command, but I do with UTL_FILE within PL/SQL, or generating data in a file CLOB and spell the CLOB in a go using one of the CLOB methods available writing files.
-
How to call sql loader control file with in the pl/sql procedure
Hi friends,
I am doing a project in relation to the transfer data using queues. In the queue, I'll get a data delimited by tabs in the form of CLOB variable/message. I don't want to keep this dat in the oracle table.
During the updating of the data in the table.
1. don't want to write data to a file. (You want to access directly after the specific queue).
2. as the data is in the form of delimited by tabs, I want to use sql loader concept.
How can I call the ctrl charger sql file with in my pl/sql procedure. When I searched, most forums recommending the external procedure or a Java program.
Please guide me on this issue. My preferrence is pl sql, but don't know the external procedure. If no other way, I'll try Java.
I'm using oracle 9.2.0.8.0.
Thanks in advance,
Vimal...Or SQL * Loader, or external tables are designed to read data from a CLOB stored in the database. They both work on files stored on the file system. If you don't want the data to be written to a file, you have to roll your own parsing code. It is certainly possible. But it will be much less effective than SQL * Loader or external tables. And it is likely to lead to a little more code.
The simplest possible thing that might work would be to use something like Tom Kyte string tokenization package to read a line in the CLOB, divide the component parts and save the different chips in a significant collection (i.e. an object type or a record type that matches the table definition). Of course, you need manage things like the conversion of strings to numbers or dates, rejecting the lines, writing to log files, etc.
Justin
-
Problem using denounced by ' end_responder_Comments ~' in SQL * Loader
When I run the sqlldr to through the program simultaneous host/UNIX in Oracle apps 11.5.10.2. I get the following error. I don't understand why it doesn't work. I have made a mistake in declaring? Please let me know.
log file:
SQL * Loader-350: at line 44 syntax error.
Expecting tank single, found "end_responder_Comments ~".
RESPONDER_COMMENT completed by ' end_responder_Comments ~ ', ^.
SQL * Loader: Release 8.0.6.3.0 - Production on Wed Feb 16 11:38:21 2011
CTL file:
---------
DOWNLOAD THE DATA
ADD
IN THE TABLE 'NR_SPER_DATA2' WHEN SERVICE_REQUEST_NUMBER <>' 0'
FIELDS TERMINATED BY ' ~'
SURROUNDED OF POSSIBLY "" "
TRAILING NULLCOLS
(SECURITY_ID,
---
---
"RESPONDER_COMMENT tank (32000) completed by ' end_responder_Comments ~' OPTIONALLY ENCLOSED BY '" '.
"COMMENTS char (4000) completed by ' end_comments ~' OPTIONALLY ENCLOSED BY '" '.
---
)
Appreciate any help provided as soon as possible.
Thank you
REDAHello
CLOB column can take up to 4 GB of data, and default value for char is 255. Anything above 255, you must specify the length
Concerning
OrionNetPublished by: OrionNet on February 16, 2011 15:13
-
SQL Loader with the line terminator
Dear friends,
I use Oracle 10 g R2.
Need to load some records to a text file to Oracle.
It's my control file:
and received the error:LOAD DATA INFILE 'D:\load\dat\FinNote.dat' BADFILE 'D:\load\bad\FinNote.bad' DISCARDFILE 'D:\load\dat\discard\FinNote.dsc' INSERT INTO TABLE FinNote FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS ( IDNo, RegDate date 'YYYY-MM-DD HH24:MI:SS', Col1, Remark, UserID, Status) {code} My text file has semicolon as a row delimiter and | as column delimiter. Now, how can I add the semicolon as row delimiter. Please guide me. I followed the method given in this site: http://www.exforsys.com/tutorials/oracle-10g/oracle-10g-sql-loader-input-data-and-datafiles.html *INFILE datafile_name ["str terminator_string"]* {code} LOAD DATA INFILE 'D:\load\dat\CRS_FinNote.dat' ";" BADFILE 'D:\load\bad\CRS_FinNote.bad' DISCARDFILE 'D:\load\dat\discard\CRS_FinNote.dsc' INSERT INTO TABLE CRS_FinNote FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS ( StudentNo, IDate date 'YYYY-MM-DD HH24:MI:SS', Topic, Remark, UserID, Status)
SQL * Loader-500: could not open the file (D:\load\dat\CRS_FinNote.dat)
SQL * Loader-555: unrecognized property treatment option
SQL * Loader-509: System error: the operation completed successfully.
SQL * Loader-2026: the charge was dropped because SQL Loader cannot continue.
SQL * Loader-513: cannot close the file (D:\load\dat\CRS_FinNote.dat)
SQL * Loader-559: Error closing file
SQL * Loader-509: System error: the storage control block address is invalid.
Thanks in advance.
Nith
Published by: user645399 on June 16, 2010 10:35And, if your CRS_FinNote.dat look like below (line/record delimited; then)
1245|2000-05-16|Oracle|The Best|AAA|Online; 294|2000-04-03|Dotnet|Best|BBB|Pending; 300|2010-03-28|C++|The Best|CCC|Offline;
Scott@ORCL > select utl_raw.cast_to_raw (';') under "hexadecimal;" double;
in hexadecimal
--------------------------------------------------------------------------------
3BThen I change user645399.ctl with below:
LOAD DATA INFILE 'd:\csv\CRS_FinNote.dat' "str X'3B'" BADFILE 'd:\csv\FinNote.bad' DISCARDFILE 'd:\csv\FinNote.dsc' INSERT INTO TABLE FinNote FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS ( IDNo, RegDate date 'YYYY-MM-DD HH24:MI:SS', Col1, Remark, UserID, Status)
The idea received a link from http://www.orafaq.com/forum/t/140062/0/.
C:\Documents and Settings\Girish Sharma>sqlldr scott/tiger@orcl control=d:\csv\user645399.ctl log=user645399.log Enter user-name: scott/tiger Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SCOTT@orcl> select * from finnote; IDNO REGDATE COL1 REMARK USERID STATUS ---------- -------------------- ---------- ---------- ---------- ---------- 1245 16-may-2000 00:00:00 Oracle The Best AAA Online 294 03-apr-2000 00:00:00 Dotnet Best BBB Pending 300 28-mar-2010 00:00:00 C++ The Best CCC Offline SCOTT@orcl>
HTH
Girish Sharma
Maybe you are looking for
-
I tried the HP support site, but I don't see any drivers for any available OS for my model, the g6-1d21dx Pavilion. I did a clean install of Windows 10, but the Wi - Fi button does not work. Apparently, there's a pilot called HP wireless button that
-
Hard drive testToetsing disc: 1INTELLIGENT control: passedDST short: pastOptimized DST: spentLong DST: failureFailure ID: 6APS3F - S 5, 9713 - MFPV4K - 61AJ03Product ID: QJ494EA #ABHHard drive 1
-
New disk hard recovery HP 2000 error
Hello, the value < br > I try to install the recovery disk. (Four discs) I'm on the second series of the hp discs. Both first and second set have the same problem when installing. All disks appear to load correctly, and then start the installation. A
-
What Windows 7 64-bit installation crashes with BSOD when you ask to Raid driver
Original title: HP dv7 7008 own ssd install question. While he was trying to do a clean install of Windows 7 64 bit Ultimate built in 32gig ssd blocks on a 7B BSOD. Tried to re - install the driver iastor.sys, intel RAID ultilty without success. I t
-
BlackBerry smartphone voice and voice dialing
Hi, how can you check your voice mail using the voice dialing function? I tried saying 'answering machine call' and 'check the voicemail' and neither one works. Thank you all!