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
Similar Messages
-
Problem with SQL loader - "maximum length"
using SQL*Loader: Release 8.1.7.0.0
===================================
(full CTL enclosed below)
I have a problem with several rows, in which I'm getting the "Field in data file exceeds maximum length" error.
the DB field (referer) is a VARCHAR2(4000), and the field in the error rows never exceeds few hundred characters. According to Oracle docs I should be able to load fields which are no bigger than the DB field, what gives?
I tried the variation
referer CHAR "SUBSTR(:referer,1,100)"
for this field, which causes all the "referer" columns in the "good" rows to load no more than 100 characters, but the same error repeats for the same rows!
the input file is an IIS log, and the field is the REFERER field. its pure ASCII encoded, is there some character that cause Oracle to behave this way? is this a bug?
here is one "bad" row: the "bad" field starts with "ht
tp://web , is enclosed with quotes. I have replaced the client IP and other fields with xxx for privacy reasons.
after that, I have enclosed my CTL as well.
any help ?
Yoram Ayalon
BTW - I verified in the LOG file that the loader is reading my options for the columns as I described in the CTL. no problem there.
"2003-06-30 11:11:12" xxx.xxx.xxx.xxx WEBSRVXX 80 GET /xxx.xxx 200 0 778 1359 "ht
tp://web.ask.com/redir?bpg=http%3a%2f%2fweb.ask.com%2fweb%3fq%3dWhat%2bis%2bsign
al%2bcommunication%253f%26o%3d0%26page%3d1&q=What+is+signal+communication%3f&u=h
ttp%3a%2f%2ftm.wc.ask.com%2fr%3ft%3dan%26s%3da%26uid%3d032EBF1A318A100F3%26sid%3
d3d2bbe4f8d2bbe4f8%26qid%3d4B2346DA8A56C6418CB4DCB9091EEBA7%26io%3d0%26sv%3dza5c
b0db2%"
LOAD DATA
INFILE '/tmp/mod_websrvxx.txt'
APPEND INTO TABLE tmpLogs
FIELDS TERMINATED BY WHITESPACE optionally enclosed by '"'
(LogDate DATE "YYYY-MM-DD HH24:MI:SS", ClientIP, ServerName, ServerPort, ClientM
ethod,UriStem,Status,BytesSent,BytesReceived,TimeTaken,Referer CHAR "SUBSTR(:Re
ferer, 1, 100)" )Use:
readsize=3000000
or some large number to raise this limit.
Check the below link for detailed explanation
http://asktom.oracle.com/pls/ask/f?p=4950:8:380010202423963671::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:2167288643374, -
Sql*loader field length issue
so I'm loading a file and it's rejected a record where "field in data file exceeds maximum length" the record it's failing on has data length of 625 characters. I'm loading it into a table with a field type of varchar2(1024).
for the life of me, I can't figure out why it's failing. I've even gone and manually copy and pasted the rogue record into the table (via Toad) and it works fine, but I need it to load via SQL*loader.
there is no white space that i'm not counting. Can anyone suggest where to look next?Hi,
Just change the problematic field in the control file as
load
field char(1000),
If you give the length in the control file, ur problem ll be solved.
- karthik -
SQL Loader Oracle 10g problem in upload date with time data -- Very urgent.
Hi
I am trying to upload data using SQL loader. There are three columns in the table
defined as DATE. When I tried upload a data like this '2007-02-15 15:10:20', it is not loading time part. The date stored as 02/15/2008' only. There is not time on that. I tried with many different format nothing work. Can please help me ?
I have also tried with to_date --> to_timestamp it did not work.
The application is going to be in production, I cannot change DATE to TIME STAMP. This is very urgent.
LASTWRITTEN "decode(:LASTWRITTEN,'null',Null, to_date(:LASTWRITTEN,'YYYY-MM-DD HH24:Mi:SS'))",
CREATEDON "decode(:CREATEDON,'null',Null, to_date(:CREATEDON,'YYYY-MM-DD HH24:Mi:SS'))",
LASTUPDATEDON(21) "decode(:LASTUPDATEDON,'null',Null, to_date(:LASTUPDATEDON(21),'DD/MM/YYYY HH24:MI:SS'))"Your problem is most likely in decode - the return type in your expression will be character based on first search value ('null'), so it will be implicitly converted to character and then again implicitly converted to date by loading into date column. At some of this conversions you probably are loosing your time part. You can try instead use cast:
SQL> desc t
Name Null? Type
LASTWRITTEN DATE
CREATEDON DATE
LASTUPDATEDON DATE
SQL> select * from t;
no rows selected
SQL> !cat t.ctl
LOAD DATA
INFILE *
INTO TABLE T
TRUNCATE
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
LASTWRITTEN
"decode(:LASTWRITTEN,'null',cast(Null as date),
to_date(:LASTWRITTEN,'YYYY-MM-DD HH24:MI:SS'))",
CREATEDON
"decode(:CREATEDON,'null',cast(Null as date),
to_date(:CREATEDON,'YYYY-MM-DD HH24:MI:SS'))",
LASTUPDATEDON
"decode(:LASTUPDATEDON,'null',cast(Null as date),
to_date(:LASTUPDATEDON,'DD/MM/YYYY HH24:MI:SS'))"
BEGINDATA
2007-02-15 15:10:20,null,null
null,2007-02-15 15:10:20,null
null,null,15/02/2007 15:10:20
SQL> !sqlldr userid=scott/tiger control=t.ctl log=t.log
SQL*Loader: Release 10.2.0.3.0 - Production on Fri Feb 29 00:20:07 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 3
SQL> select * from t;
LASTWRITTEN CREATEDON LASTUPDATEDON
15.02.2007 15:10:20
15.02.2007 15:10:20
15.02.2007 15:10:20Best regards
Maxim -
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 unicode (umlaut) problem
Hi
I want to load some data with SQL Loader. The data contains german umlaut like ä, ö, ü.
The loading process works, but the umlaut are transformed to something like 'ü' in the DB. How can I get to load them correctly?
My environment:
- DB 10g Rel.2
- Windows XP
- Registry key in Ora_Home: NLS_LANG=GERMAN_GERMANY.WE8MSWIN1252
I tried it with setting the character set in the CTL file:
characterset 'WE8MSWIN1252'
That didn't help either.
Does anyone have an idea? I searched the forum but didn't find a solution.
Thanks for your help,
RogerMaybe a codepage issue ? See this example :
C:\tmp>type umlaut.ctl
load data
infile umlaut.dat
replace
into table umlaut_tab
(a)
C:\tmp>sqlldr test/test control=umlaut.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Tue Jun 10 13:19:50 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 2
Commit point reached - logical record count 3
C:\tmp>sqlplus test/test
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jun 10 13:19:56 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> select * from umlaut_tab;
A
õ
÷
³
SQL> exit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Produ
ction
C:\tmp>chcp 1252
Tabella codici attiva: 1252
C:\tmp>sqlplus test/test
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jun 10 13:20:19 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> select * from umlaut_tab;
A
ä
ö
ü
SQL> -
Sql loader - maximum lengths?
can someone tell me if the datatype CHAR has a maximum length in sql loader ( i think it may be 255, but am not sure) if so, how can i load a 2000 fields into a column on the database, i have tried varchar and i still get an error
What's the error? What's the Oracle version?
See this:
http://download-west.oracle.com/docs/cd/B13789_01/server.101/b10825/ldr_field_list.htm#g1044967
and search (ctrl-f) for this string:
"The syntax for the CHAR datatype is"
Tom Best -
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 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, data rejection problem
Hi all ,
I am trying to load data using sql loader.The first field is a long and the rest all are varchar2 and date. After the long datatype is loaded the rest of the data is rejected. What are the possible causes of data rejection by sql loader?
I am pasting the code that is working and the code which is not working( they are two different scenario's)
Working Code:
nl -w10 -s, $4/BookingDetails$3.txt > Book1.txt
echo "LOAD DATA" > booking_det.ctl
echo "INFILE 'Book1.txt'" >> booking_det.ctl
echo "REPLACE PRESERVE BLANKS INTO TABLE booking_det" >> booking_det.ctl
echo "FIELDS TERMINATED BY ','" >> booking_det.ctl
echo "TRAILING NULLCOLS" >> booking_det.ctl
echo "(SLNO, ALL_VALUES CHAR(2000), BOOKING_STATUS, " >> booking_det.ctl
echo "BOOKING_DATE, ACCT_CITY)" >> booking_det.ctl
echo '\n'Invoking SQLLDR ......
sqlldr "$1"\/"$2" silent=ALL errors=100000 control=booking_det.ctl
Code which is not working:
nl -w10 -s, $4/BookingDetails2$3.txt > Book4.txt
echo "LOAD DATA" > booking_det1.ctl
echo "INFILE 'Book4.txt'" >> booking_det1.ctl
echo "REPLACE PRESERVE BLANKS INTO TABLE booking_det" >> booking_det1.ctl
echo "FIELDS TERMINATED BY ','" >> booking_det1.ctl
echo "TRAILING NULLCOLS" >> booking_det1.ctl
echo "(SLNO, ALL_VALUES CHAR(2000), BOOKING_STATUS, BOOKING_DATE)" >> booking_de
t1.ctl
echo '\n'Invoking SQLLDR ......
sqlldr "$1"\/"$2" silent=ALL errors=100000 control=booking_det1.ctl
after inserting all_values in case 2, the rest of the data is not getting loaded in the tmep table.
Please suggest what could go wrong.
TIA
Regards
Ankur
nullHello,
Modify the column and use empty_clob() as default
ALTER TABLE EMP_TABLE
MODIFY(RESUME DEFAULT EMPTY_CLOB());
Your control file should look like this
LOAD DATA
INFILE emp.txt "str '|\r\n'"
INSERT INTO TABLE EMP_TABLE
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
ID NULLIF (TARGET_ID=BLANKS)
, NAME NULLIF (NAME=BLANKS)
, SALARY NULLIF (SALARY=BLANKS)
, RESUME CHAR(10000)
)Regards
Edited by: OrionNet on Jan 30, 2009 11:56 AM -
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. -
PL/SQL variables allowed lengths problem in higher version.
Hi All,
Before getting in to my problem here are two different DBs version.
DB1:
===========
SQL*Plus: Release 9.2.0.1.0
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit
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
DB2:
===========
SQL*Plus: Release 9.2.0.5.0
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit
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 - Production
My problem is plsql block which is working fine in DB1 (which is lower version) is erroring in DB2 (which is higher version).
Below is the block I am running and I have listed the results beneath the same. Please advise me on porting code from DB1 to DB2.
Program:
DECLARE
l_var1 VARCHAR2(32767);
l_clob_var1 CLOB;
l_clob_var2 CLOB;
l_clob_var3 CLOB;
l_clob_var4 CLOB;
l_position NUMBER;
BEGIN
l_position := 0;
FOR i IN 1..8191 LOOP -- This is (2 to the power of 13 )-1
l_clob_var1 := l_clob_var1 || 'a';
END LOOP;
l_position := 1;
FOR i IN 1..8192 LOOP
l_clob_var2 := l_clob_var2 || 'a';
END LOOP;
l_position := 2;
FOR i IN 1..8193 LOOP
l_clob_var3 := l_clob_var3 || 'a';
END LOOP;
l_position := 3;
FOR i IN 1..8617 LOOP
l_clob_var4 := l_clob_var4 || 'b';
END LOOP;
l_position := 4;
l_var1 := l_clob_var1;
l_position := 5;
l_var1 := l_clob_var2; ---- Error reported for this in DB2. Observe the position value 5 in below results.
l_position := 6;
l_var1 := l_clob_var3;
l_position := 7;
l_var1 := l_clob_var4;
l_position := 8;
dbms_output.put_line('No Errors reported');
l_position := 9;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20999,'Error at position '||l_position||', SQLERRM : '||SQLERRM);
END;
Results:
======================================================
DB1:
======================================================
No Errors reported
PL/SQL procedure successfully completed.
All variable lenghts till 32767 are allowed here.
Db2:
======================================================
DECLARE
ERROR at line 1:
ORA-20999: Error at position 5, SQLERRM : ORA-06502: PL/SQL: numeric or value
error
ORA-06512: at line 38
PLSQL variable length till 8191 ((2 to the power of 13 )-1) chars are allowed here.
Thank you.
Mahi.Here is results:
DB1
================================
SQL> select *from nls_database_parameters
2 where parameter = 'NLS_CHARACTERSET';
PARAMETER VALUE
NLS_CHARACTERSET US7ASCII
SQL> select * from nls_session_parameters
2 where parameter = 'NLS_LENGTH_SEMANTICS'
3 ;
PARAMETER VALUE
NLS_LENGTH_SEMANTICS BYTE
DB2
============================================
SQL> select *from nls_database_parameters
2 where parameter = 'NLS_CHARACTERSET';
PARAMETER
VALUE
NLS_CHARACTERSET
UTF8
SQL> select * from nls_session_parameters
2 where parameter = 'NLS_LENGTH_SEMANTICS';
PARAMETER
VALUE
NLS_LENGTH_SEMANTICS
BYTE
Please suggest me on below:
(1) Is this problem because of multicharacter set?
(2) If so, Can I ask my DBA to ask Oracle to fix this problem? Or is my requirements is not genuine?
Please suggest me up on my course of action.
Thank you. -
SQL Loader Problem with Date Format
Dear all,
I am dealing with a problem in loading data with SQL Loader. The problem is in the date format.
More specifically, I created the following Control File:
file.ctl
LOAD DATA
INFILE 'D:\gbal\chatium.log'
APPEND INTO TABLE CHAT_SL
FIELDS TERMINATED BY WHITESPACE
TRAILING NULLCOLS
(SL1 DATE "Mon DD, YYYY HH:MI:SS FF3AM",
SL2 char,
SL3 DATE "Mon DD, YYYY HH:MI:SS FF3AM",
SL4 char,
SL5 char,
SL6 char,
SL7 char,
SL8 char,
SL9 char,
SL10 char,
SL11 char,
SL12 char,
SL13 char,
SL14 char,
SL15 char)
The data we want to load are in the following file:
Apr 29, 2007 12:05:49 AM 1060615 Apr 29, 2007 12:05:35 AM 306978537730 24026384 chatium.user.userinfo WAP 0
Apr 29, 2007 12:12:51 AM 1061251 Apr 29, 2007 12:12:27 AM 306978537730 24026384 chatium.channel.list WAP 0
Apr 29, 2007 12:12:51 AM 1061264 Apr 29, 2007 12:12:32 AM 306978537730 24026384 chatium.channel.listdetail WAP 0
Apr 29, 2007 12:13:51 AM 1061321 Apr 29, 2007 12:13:31 AM 306978537730 24026384 chatium.user.search WAP 0
Apr 29, 2007 12:13:51 AM 1061330 Apr 29, 2007 12:13:37 AM 306978537730 24026384 chatium.user.userinfo WAP 0
The error log file is the following:
SQL*Loader: Release 9.2.0.1.0 - Production on Mon Apr 30 11:29:16 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Control File: file.ctl
Data File: D:\gbal\chatium.log
Bad File: chatium.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 CHAT_SL, loaded from every logical record.
Insert option in effect for this table: APPEND
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
SL1 FIRST * WHT DATE MonDD,YYYYHH:MI:SS
SL2 NEXT * WHT CHARACTER
SL3 NEXT * WHT CHARACTER
SL4 NEXT * WHT CHARACTER
SL5 NEXT * WHT CHARACTER
SL6 NEXT * WHT CHARACTER
SL7 NEXT * WHT CHARACTER
SL8 NEXT * WHT CHARACTER
SL9 NEXT * WHT CHARACTER
SL10 NEXT * WHT CHARACTER
SL11 NEXT * WHT CHARACTER
SL12 NEXT * WHT CHARACTER
SL13 NEXT * WHT CHARACTER
SL14 NEXT * WHT CHARACTER
SL15 NEXT * WHT CHARACTER
Record 1: Rejected - Error on table CHAT_SL, column SL1.
ORA-01840: input value not long enough for date format
Record 2: Rejected - Error on table CHAT_SL, column SL1.
ORA-01840: input value not long enough for date format
Record 3: Rejected - Error on table CHAT_SL, column SL1.
ORA-01840: input value not long enough for date format
Record 4: Rejected - Error on table CHAT_SL, column SL1.
ORA-01840: input value not long enough for date format
I wonder if you could help me.
Thank you very much in advance.
Giorgos BaliotisSQL> select to_date('Apr 29, 2007 12:05:49 AM','Mon DD, YYYY HH:MI:SS FF3AM') from dual;
select to_date('Apr 29, 2007 12:05:49 AM','Mon DD, YYYY HH:MI:SS FF3AM') from dual
ERROR at line 1:
ORA-01821: date format not recognized
SQL> ed
Wrote file afiedt.buf
1* select to_date('Apr 29, 2007 12:05:49 AM','Mon DD, YYYY HH:MI:SS AM') from dual
SQL> /
TO_DATE(
29/04/07
SQL> Then, you defined blank space as separator, but there is spaces in your date inside your file. So, you should add double-quotes around the date field like below, and add optionally enclosed by '"' into your ctlfile.
"Apr 29, 2007 12:05:49 AM" 1060615 "Apr 29, 2007 12:05:35 AM" 306978537730 24026384 chatium.user.userinfo WAP 0
"Apr 29, 2007 12:12:51 AM" 1061251 "Apr 29, 2007 12:12:27 AM" 306978537730 24026384 chatium.channel.list WAP 0
"Apr 29, 2007 12:12:51 AM" 1061264 "Apr 29, 2007 12:12:32 AM" 306978537730 24026384 chatium.channel.listdetail WAP 0
"Apr 29, 2007 12:13:51 AM" 1061321 "Apr 29, 2007 12:13:31 AM" 306978537730 24026384 chatium.user.search WAP 0
"Apr 29, 2007 12:13:51 AM" 1061330 "Apr 29, 2007 12:13:37 AM" 306978537730 24026384 chatium.user.userinfo WAP 0Example :
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_concepts.htm#sthref477
Nicolas. -
(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>
Maybe you are looking for
-
Say I receive email from clothing company and it has shop now which you click on and it takes you to their site this isn't working.
-
i have a 13 inch macbook 4g 2.26ghz intel core 2 duo. will it run the new final cut software?
-
Can I use gift card with iTunes to buy additional iCloud storage on my ipad2
I need to purchase additional iCloud storage. My question is I have a couple gift cards with iTunes. Can I use one or both gift cards to buy this additional storage? Thank you. I await a response.
-
Error in CAF Project Deployment
Hi All, I have created a simple CAF project named as "firstcaf" in NWDS of NetWeaver CE. But at the deployment time I am getting an error like bellow May 30, 2007 7:11:43 PM /userOut/daView_category (eclipse.UserOutLocation) [Thread[Deploy Thread,5,m
-
Need urgent help in AIR-LAP-1242G-E-K9
Hi all, Im new into the Cisco Wireless. I have a Cisco's AIR-LAP1242G-E-K9...I dont have WLC, i want to use it as standalone AP for wireless Access to my users ... i took the console of AP & got the following msgs!!!! AP68ef.bde3.3ad4# AP68ef.bde3.3a