Sql Loader record delimiter (SPECIAL CASE)
I have a special case where I want to use <EOR>\n as record delimiter, but OWB won't load any data with that. If I only use <EOR> it does load data but throws warning (1 Row not loaded because all fields were null), TRAILING NULLCOLS option is enabled. I appreciate the help.
Hi David,
First of all, I appreciate your reply. I did do what you recommended (OMBALTER FLAT_FILE 'ABCD' SET PROPERTIES (RECORD_DELIMITER) VALUES ('<EOR>\n'). I didn't open the FF, but I did sync the FF and deployed the mapping unfortunately it didn't work "File processing option string: "STR X'3C454F523E5C6E'" (basically HEX values)
Any more suggestions?
The reason I want to use this record delimiter is:
LINE1 = AB|CD|EF|GH|IJKL<EOR>$ note:($ is \n)(set list)
LINE2 = AB|CD|EF|GH|IJKL$
MNOPQRSTUVWX$
YZ<EOR>$
For the time being I fixed the problem by putting all columns(ROW EACH) in a single row and just use '\n' as RD, but I would like to do it by using ('<EOR>\n') as RD as well.
I appreciate the help.
Similar Messages
-
Hi
I am using sql loader to load data in a table, the field terminator is '|' , there are multi line datas for one field, i want to specify the record delimiter.
it considers new line as one record.
how to specify the record delimiter
Thanks in advance
S Sathish KumarLOAD DATA
INFILE 'C:\FLATFILE\MAPPING.DAT'
DISCARDFILE 'C:\FLATFILE\MAPPING.DSC'
APPEND INTO TABLE ETL_MAPPING_METADATA
RECORDS DELIMITED BY '#^'
FIELDS TERMINATED BY '|'
Hi i have tried the above code, but it is not working, also i replaced 'records delimited' by 'records terminated' -
I need to use sql loader to load records into my database.
The field delimiter is ^X^P
The record delimiter is ^B^A\n
The datafile looks like this :
MARK^X^PHATCHER^X^PACCOUNTS^B^A\nSCOTT^X^PMILLER^X^PMARKETING^B^A\nJOSEPH^X^P^X^PFINANCE^B^A\nLIN^X^PJOHNSON^X^PIT^B^A\n
How do I specify the record delimiter (which is ^B^A\n ) in my control file ?
ThanksI need to load this type of file:
The field delimiter is caracter ", but inside the field there is some " caracter.
For example:
File test01.txt:
"field1","field2","field3", "field4"
"fied1", "field2 by "home" paul","field3", "field4"
"field1","field2","field3", "field4"
How can load the second record?
Thanks!! -
SQL*Loader- Records Rejected - Error on table ORA-01722: invalid number
Getting the following errors :
Please tell me where I am going wrong?
Attached is the log file and snippets of datafile along with the control file !!
Also please direct me how can i upload 4900 records at one go?
SQL*Loader: Release 11.1.0.7.0 - Production on Fri Oct 14 03:06:06 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Control File: sample.ctl
Data File: Cities.csv
Bad File: Cities.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 CITY, loaded from every logical record.
Insert option in effect for this table: INSERT
Column Name Position Len Term Encl Datatype
ID FIRST * , CHARACTER
NAME NEXT 35 , ' CHARACTER
COUNTRYCODE NEXT 3 , ' CHARACTER
POPULATION NEXT * WHT CHARACTER
Record 1: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 2: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 3: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 4: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 5: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 6: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 7: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 8: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 9: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 10: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 11: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 12: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 13: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 14: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 15: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 16: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 17: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 18: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 19: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 20: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 21: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 22: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 23: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 24: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 25: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 26: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 27: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 28: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 29: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 30: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 31: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 32: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 33: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 34: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 35: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 36: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 37: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 38: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 39: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 40: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 41: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 42: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 43: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 44: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 45: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 46: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 47: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 48: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 49: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 50: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 51: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.
Table CITY:
0 Rows successfully loaded.
51 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: 35840 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 64
Total logical records rejected: 51
Total logical records discarded: 0
Run began on Fri Oct 14 03:06:06 2011
Run ended on Fri Oct 14 03:06:12 2011
Elapsed time was: 00:00:06.18
CPU time was: 00:00:00.03
my control file (sample.ctl):
load data infile 'Cities.csv'
into table city
fields terminated by ','
(id integer external,
name char(35) enclosed by "'",
countrycode char(3) enclosed by "'",
population integer external terminated by '\n'
my datafile (Cities.csv) (it contains 4900 records, but I am showing here just 4 records for ease)
3830,'Virginia Beach','USA',425257
3831,'Atlanta','USA',416474
3832,'Sacramento','USA',407018
3833,'Oakland','USA',399484
Thanks in advance!!Look that when I change a little bit your datafile as follows
1,'Kabul','AFG',1780000
2,'Qandahar','AFG','237500'
3,'Herat','AFG','186800' I got the same error (2 last rows rejected for the same error invalid number)
mhouri > select * from cities;
ID NAME COU POPULATION
1 Kabul AFG 1780000
SQL*Loader: Release 10.2.0.3.0 - Production on Fri Oct 14 10:38:06 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: cities.ctl
Data File: cities.dat
Bad File: cities.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 CITIES, loaded from every logical record.
Insert option in effect for this table: INSERT
Column Name Position Len Term Encl Datatype
ID FIRST * , CHARACTER
NAME NEXT 35 , ' CHARACTER
COUNTRYCODE NEXT 3 , ' CHARACTER
POPULATION NEXT * WHT CHARACTER
Record 4: Rejected - Error on table CITIES, column ID.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 2: Rejected - Error on table CITIES, column POPULATION.
ORA-01722: invalid number
Record 3: Rejected - Error on table CITIES, column POPULATION.
ORA-01722: invalid number
Table CITIES:
1 Row successfully loaded.
3 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: 35840 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 4
Total logical records rejected: 3
Total logical records discarded: 0
Run began on Fri Oct 14 10:38:06 2011
Run ended on Fri Oct 14 10:38:06 2011
Elapsed time was: 00:00:00.23
CPU time was: 00:00:00.09Population value within the data file should be a number
Best regards
Mohamed Houri -
SQL Loader, CLOB, delimited fields
Hello.
I have to load using SQL Loader data from csv file into table, which one field is CLOB type.
Here is how ctl file initially looked like:
UNRECOVERABLE
LOAD DATA
INFILE '.\csv_files\TSH_DGRA.csv'
BADFILE '.\bad_files\TSH_DGRA.bad'
DISCARDFILE '.\dsc_files\TSH_DGRA.dsc'
APPEND
INTO TABLE TSH_DGRA
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
ID_OBJ_TSHD,
PR_ZOOM_TSHD,
PR_GRID_TSHD,
PR_ELMGR_TSHD CHAR(4000) OPTIONALLY ENCLOSED BY '<clob>' AND '</clob>',
PR_ALRMGR_TSHD CHAR(4000) OPTIONALLY ENCLOSED BY '<clob>' AND '</clob>'
Problems are fields PR_ELMGR_TSHD and PR_ALRMGR_TSHD (CLOBs in table TSH_DGRA). Until data which should be loaded into CLOB fields are under 4000 characters long, it works fine, but what should I do if I want to load data which are longer than 4000 characters?
If found on Link:[http://download.oracle.com/docs/cd/B14117_01/server.101/b10825/ldr_loading.htm#i1006803] which one sentence said that:
"SQL*Loader defaults to 255 bytes when moving CLOB data, but a value of up to 2 gigabytes can be specified. For a delimited field, if a length is specified, that length is used as a maximum. If no maximum is specified, it defaults to 255 bytes. For a CHAR field that is delimited and is also greater than 255 bytes, you must specify a maximum length. See CHAR for more information about the CHAR datatype."
So, my question is, how to specify "up to 2gb" as text said? I can not use CHAR datatype because it is limited to 4000 characters. And I have to load about 60000 characters. I also can not use technique where all data for every CLOB field are in separate files.Just specify the maximum expected size:
PR_ELMGR_TSHD CHAR(100000) OPTIONALLY ENCLOSED BY '<clob>' AND '</clob>',
PR_ALRMGR_TSHD CHAR(1000000) OPTIONALLY ENCLOSED BY '<clob>' AND '</clob>'
The CHAR(1000000) will allow SQLLDR to handle up to 1000000 bytes of input text. -
SQL*Loader records won't delete
I am mystified. A P/A is developing a conversion of legacy data into a new archive db. He runs data in using SQL*loader into our 7.3.4 database, but when we try to delete one of those records, it rolls back even though our explicit commit returns with 'commit completed'.
Our test is to load record 'a', select 'a': 1 records found, delete 'a':one record deleted, select 'a': 0 records found, commit:commit completed, select 'a':1 records found.
Non-loaded records delete fine.
Is something corrupted in rowid, or other metadata? DOES ANYONE HAVE AN IDEA?check if the change date is outside your entered date range
-
SQL* Loader record length problem
HI, I'm trying to load a log file into a table for processing. I want to load each line as a single record into a table of one field VARCHAR2(2000). However it only loads the first character of each line and then fails after 12 records. What am I doing wrong?
Below is my control file.
LOAD DATA
INFILE 'proxyLog.20060627'
BADFILE 'badproxy.dat'
DISCARDFILE 'disproxy.dat'
TRUNCATE
INTO TABLE STAGE_PROXY_LOG
TRAILING NULLCOLS
error_text
)Here's some of the data: and error log
[27 Jun 2006, 00:17] Processing Customers .....
Customer 2649513 [Record 202732] processed.
[27 Jun 2006, 00:32] Processing Customers .....
Customer 2649516 [Record 202733] processed.
[27 Jun 2006, 00:47] Processing Customers .....
Error creating customer profile
ExitStateMsg:
ExitStateType: 3
ExportWkErrorStatusCode: 7
ExportWkErrorStatusMessageTextToInsert: City name
F
ProxyCallException
at CustomerEnrollProcess.<init>(CustomerEnrollProcess.java:229)
at ProcessCustomers.main(ProcessCustomers.java:156)
ERROR LOG -----
Control File: cm.ctl
Data File: proxyLog.20060627
Bad File: badproxy.dat
Discard File: disproxy.dat
(Allow 0 discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 10000
Bind array: 64 rows, maximum of 65536 bytes
Continuation: none specified
Path used: Conventional
Table STAGE_PROXY_LOG, loaded from every logical record.
Insert option in effect for this table: TRUNCATE
Column Name Position Len Term Encl Datatype
ERROR_TEXT FIRST 1 CHARACTER
Record 13: Discarded - all columns null.
Discard limit reached - processing terminated on data file proxyLog.20060627.
Table STAGE_PROXY_LOG:
12 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
1 Row not loaded because all fields were null.
Space allocated for bind array: 256 bytes(64 rows)
Space allocated for memory besides bind array: 0 bytes
Total logical records skipped: 0
Total logical records read: 13
Total logical records rejected: 0
Total logical records discarded: 1
Run began on Fri Jun 30 11:20:27 2006
Run ended on Fri Jun 30 11:20:27 2006 -
(8I) SQL*LOADER에서 | (PIPE LINE)을 RECORD SEPARATOR로 사용하기
제품 : ORACLE SERVER
작성날짜 : 2003-10-21
===============================================================
(8I) SQL*LOADER에서 | (PIPE LINE)을 RECORD SEPARATOR로 사용하기
===============================================================
PURPOSE
Oracle8i부터는 , SQL*Loader을 사용할때 record terminator을 지정할 수 있게
되었다.
Explanation
Oracle8i 이전에는 record seperator로 default로 linefeed(carriage return,
newline 등)였다. 이전에는 VAR 또는 FIX 등의 적당한 file을 다루기 위한 옵션을
주어야 하기 때문에 복잡한 감이 있었고 flexible하지 못했다.
Oracle8i부터는 , SQL*Loader을 사용할때 record terminator을 지정할 수 있게
되었다. newline 또는 carriage return 문자를 포함하는 data 또는 special 문자를
포함하는 data를 load하고자 할때 record terminator를 hexadecimal로 지정하여 활용할 수 있다.
Example
다음의 예제는 '|' (pipe line)을 record separator로 사용한다.
record separator를 사용하기 위해서 SQL*Loader의 control file에 'infile'절에 적당한 값을 지정하여야 한다.
아래의 예는 '|' (pipe line)을 사용하기 위해서
"str X'7c0a'"을 'infile'절에 지정하였다.
--controlfile : test.ctl
load data
infile 'test.dat' "str X'7c0a'"
into table test
fields terminated by ',' optionally enclosed by '"'
(col1, col2)
--datafile: test.dat
1,this is the first line of the first record
this is the second|
2,this is the first line of the second record
this is the second|
SQL> desc test
Name Null? Type
COL1 VARCHAR2(4)
COL2 VARCHAR2(100)
$ sqlldr scott/tiger control=test.ctl log=test.log
load된 data을 보면 아래와 같이 carriage return이 들어가 있는 data가 한 column에
제대로 들어간 것을 볼 수 있다.
SQL> select * from test;
COL1
COL2
1
this is the first line of the first record
this is the second
2
this is the first line of the second record
this is the second
RELATED DOCUMENT
<Note:74719.1> -
Is there a way to load in spaces using Sql*Loader given that the table it is loading to has a not null column but has a default value. My data file has spaces for a number field instead of zeros. Since my table column is declared as not null, it's failing even if I have a default value of '0' in my column.
You can tackle this in the control file. Here is a snippet from Oracle OnLine books - hopefully this will help out! Cheers.
==========================================
Setting a Column to Null or Zero
If you want all inserted values for a given column to be null, omit the column's specifications entirely. To set a column's values
conditionally to null based on a test of some condition in the logical record, use the NULLIF clause; see NULLIF Keyword. To set a
numeric column to zero instead of NULL, use the DEFAULTIF clause, described next.
DEFAULTIF Clause
Using DEFAULTIF on numeric data sets the column to zero when the specified field condition is true. Using DEFAULTIF on
character (CHAR or DATE) data sets the column to null (compare with Numeric External Datatypes). See also Specifying Field
Conditions for details on the conditional tests.
DEFAULTIF field_condition
A column may have both a NULLIF clause and a DEFAULTIF clause, although this often would be redundant.
Note: The same effects can be achieved with the SQL string and the DECODE function. See Applying SQL Operators to
Fields
NULLIF Keyword
Use the NULLIF keyword after the datatype and optional delimiter specification, followed by a condition. The condition has the same
format as that specified for a WHEN clause. The column's value is set to null if the condition is true. Otherwise, the value remains
unchanged.
NULLIF field_condition
The NULLIF clause may refer to the column that contains it, as in the following example:
COLUMN1 POSITION(11:17) CHAR NULLIF (COLUMN1 = "unknown")
This specification may be useful if you want certain data values to be replaced by nulls. The value for a column is first determined from
the datafile. It is then set to null just before the insert takes place. Case 6: Loading Using the Direct Path Load Method provides
examples of the NULLIF clause.
Note: The same effect can be achieved with the SQL string and the NVL function. See Applying SQL Operators to Fields.
Null Columns at the End of a Record
When the control file specifies more fields for a record than are present in the record, SQL*Loader must determine whether the
remaining (specified) columns should be considered null or whether an error should be generated. The TRAILING NULLCOLS
clause, described in TRAILING NULLCOLS, explains how SQL*Loader proceeds in this case.
========================================== -
SQL Loader error while loading a date field
Hi,
I am getting the below error while I am trying to load a table with a date field using SQL Loader
Record 1: Rejected - Error on table RPT_HOST_USAGE, column USAGE_TIMESTAMP.
ORA-01861: literal does not match 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'
into table RPT_HOST_USAGE
fields terminated by ","
HOST_USAGE_ID,
HOST_ID,
TECHNOLOGY_ID,
ENVIRONMENT_ID,
USAGE_TIMESTAMP,
AVG_CPU_PCT,
AVG_MEMORY_MB,
CPU_SPIKE
<code>
I have tried options like USAGE_TIMESTAMP TO_DATE(USAGE_TIMESTAMP,'YYYY-MM-DD HH24:MI:SS') but didn't work...
Can you please tell me how to resolve this issue?
Any pointers on this will be helpful
Thanks
MaheshI went back and looked at some of my old *.ctl files and I did something simlilar to what you mentioned and it worked for me, but I had surrounded the option in double-quotes and included a colon in front of the item. Example:
TECHNOLOGY_ID,
ENVIRONMENT_ID,
USAGE_TIMESTAMP "to_date(:USAGE_TIMESTAMP,'YYYY-MM-DD HH24:MI:SS')",
AVG_CPU_PCT,
AVG_MEMORY_MB,
.... -
Loading data by sql loader in oracle 10g on linux
I am trying to load data in Oracle 10g on linux by using sql loader, but getting error
Problem in log showing that field length of SURNAME field is more than table field size.
Following is the error in log file of sql loader
Record 21: Rejected - Error on table TABLE1, column
SURNAME.
ORA-12899: value too large for column SURNAME (actual: 65, maximum: 64)
and it is evident from following controlfile that i am using trim to discard any space then why it is giving an error.
LOAD DATA
TRUNCATE
INTO TABLE TABLE1
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
ID INTEGER EXTERNAL,
OPTION1 CHAR,
REF1 CHAR,
OTHER_REF CHAR,
TITLE "TRIM(:TITLE)",
FORENAME "TRIM(:FORENAME)",
SURNAME "TRIM(:SURNAME)",
JOINT_TITLE "TRIM(:JOINT_TITLE)",
JOINT_FORENAME "TRIM(:JOINT_FORENAME)",
JOINT_SURNAME "TRIM(:JOINT_SURNAME)",
I checked the bad file and count number of characters, they are 64 characters.
When i am inserting individual record from bad file by sql loader, it is loadingProbably your database character set is multi-byte. That is %UTF8 or AL16UTF16%
Post your NLS Database Parameters value
select * from nls_database_parameters;
In General varchar2(65) by default means 65 BYTES unless
you have changed your Defalut NLS_LENGTH_SEMANTICS parameter from BYTE to CHAR.
With best regards
Shan -
Is it possible to pass or set a variable in SQL LOADER? In this case I want the file name (eg $data) that is getting passed from the command line to load into my table into the extract_date field.
For example. The command line:
sqlldr user/password control=deposit.ctl data=080322.txt
Control file:
Load data
infile '$data'
Append into table deposit
, id position (1-10)
, extract_date date "YYMMDD" $data
Any thoughts?user567866 wrote:
Is it possible to pass or set a variable in SQL LOADER? In this case I want the file name (eg $data) that is getting passed from the command line to load into my table into the extract_date field.
For example. The command line:
sqlldr user/password control=deposit.ctl data=080322.txt
Control file:
Load data
infile '$data'
Append into table deposit
, id position (1-10)
, extract_date date "YYMMDD" $data
Any thoughts?Just wonder, why do you need a variable, if you are passing the filename on the command line? The sqlldr is perfectly capable to read the data from the file given as argument with parameter data. Just remove the line with infile from your controlfile and leave your commandline as is.
Best regards
Maxim -
SQL Loader fails loading XML data enclosed by tag not found
The problem I'm having is my XML tree doesn't contain all possible elements. In this example the second entry doesn't contain <age> - only the first entry will be added to the database
Any idea of how I could solve this?
The fields are saved as varchar2
XML:
<rowset>
<row>
<name>Name</name>
<age>Age</age>
<city>City</city>
</row>
<row>
<name>Name2</name>
<city>City2</city>
</row>
</rowset>
LOAD DATA
INFILE 'data.xml' "str '</row>'"
APPEND
INTO TABLE test
TRAILING NULLCOLS
dummy FILLER terminated BY "<row>",
name ENCLOSED BY "<name>" AND "</name>",
age ENCLOSED BY "<age>" AND "</age>",
city ENCLOSED BY "<city>" AND "</city>"
)I noticed that failure occurs when using 11g version SQL Loader. It doesn't fail when using 10g version SQL Loader.
Delimited source data comes from:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - ProductionAnd will be loaded into
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - ProductionMy previously used SQL Loader was from:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - ProductionIt seems that I have found the real culprit. Should I know something more? -
SQL Loader Control File use of integer(n)
Dear Gentlemen,
I have an "ascii" file where some fields are binary of 2, 4 and 8 bytes. This file has to be loaded to oracle (8.1.7) Table using SQL Loader. According to SQL Loader documentation, for this case I must use as a field type: integer(n), where in my particular environment (Intel Windows), n may be 2, 4 or 8 according to the length of the field. Although I do not need to specify for integer(4); but, for integer(2) and integer(8), I need to specify it to get the rigth values. In the case of integer(2), it can be replaced by smallint; however for integer(8), I have to specify the number (8), and this form is not accepted as a sintactically correct statement by SQL Loader. Therefore I cannot load the correct data.
Could you please give some advice?.
Best regards,
Julio Porcel.Hi!
If it's not possible to implement through control file, load your data into some temporary table and then use power of SQL to do whatever you want with them.
Regards,
Andrew Velitchko
BrainBench MVP for Developer/2000
http://www.brainbench.com -
SQL Loader/External Table multiple record delimiters
Hi every one.
I have a strange problem, I have an external csv file which i wish to deal with (external tables or sql loader). This csv is totally not organized in structure and it contains records that are mixed together, meaning that some records are delimited by newline characters. So in short, i want to know if I will be able to load the data in this csv separating records by newline character and another character? So is that possible to have multiple record delimiters specified in the same ctl file?abohsin,
I think using the Stream record format would be helful in your case. Please explore that.
Using stream record option, instead of the default new line, you can specify a user defined record delimiter.
Check this link.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_control_file.htm#i1005509
Here is what I did. Not the complete answer, but it might be helpful.
Replace all delimiters witha standard delimiters (in unix)
sed s/HEAD,/**DLM**/g < test.dat >test2.dat
sed s/TAIL,/**DLM**/g < test2.dat >test3.dat
create table t(
TEXT varchar2(100)
and Use that delimiter as the standard delimiter.
load data
infile "test3.dat" "str '**DLM**'"
into table T
TRUNCATE
fields terminated by 'XXXXX' optionally enclosed by '"'
TEXT
sql> select * from t;
TEXT
1111,2222,
4444,5555,
4444
1111,3333,
8888,6666,
5555
{code}
You should also replace new line charecters with '***DLM***'.
Thanks,
Rajesh.
Maybe you are looking for
-
N95 8GB unlokced , Vibrating alert does not work
Hi I just bought used N95 8 GB from my friend which is locked to a network provider. My friend took it to shop to unlock service provider (he didn't realise that service provider does it for free), now I tried to test income call vibration but it see
-
How can i redirect to my jsp page from servlet in init() method..Becoz that servlet is calling while server startsup..so im writing some piece of code in init() method..after that i want to redirect to some jsp page ...is it possible? using RequestDi
-
My school (Highline Community College) as advised me that firefox 7 will not allow people to use the (Angel) online e-mail system. I need to stay in contact with my teachers. They said don't get firefox 7 but I already have it. They said go back to f
-
Some of you may have noticed a few things on the National Broadcast channels such as NBC ABC and CBS with tests saying if you can see this then your not on Digital. The entire Verizon Footprint is all Digital please do not allow these commercials to
-
Database, compatabiliy for TstStand 2.0
I would like to connect to a different database other than Orcale, SQL Server and Access. How can I get TestStand to give me that option. I am willing to debug this new interface, but I need some direction. Help?