SQL Loader ContinueIf
Hi All,
Iam working with PCARD Transactions Interface and USbank sends file in the below fomat where we need to add logical records
into one uisng continue if statement.
File
054730770006048059240
104730770006048059100
054730770006048059240
204730770006048059100
054730770006048059240
054730770006048059240
SQLLOADER
continueif next(1:2) <> '05'
into table ap_credit_card_trxns_all
when (1:2) = '05'
so the above statement means continue reading untill you find 05 in the position (1:2) but I need to check the condition
as when (1:2) = '05'.
But as we all know you cant use to read or check the condition if the position is used in continueif next statement.
So I need to use the position for condition checking.
Did any one come accross this issue or any one have work around for this.
Thanks in advance.
Regards
SSV
Your explanation is not clear, your did not read the FAQ and learn how to use tags to format your listing, and I've no idea your version number.
That said ... if the issue is that you could potentially have two different meanings for the same characters in the same position I would go back to the vendor, since obviously they are sending this file to others, and ask them to get you the answer or give you a referral to someone that has.
Similar Messages
-
SQL*Loader ContinueIf with X'hex'
Hi all,
i am using SQL*Loader: Release 9.2.0.6.0 to import a text file with this CTL file :
LOAD DATA
INFILE AZUPI00F.TXT
REPLACE
CONTINUEIF THIS (1:3) != X'0D0A1A'
INTO TABLE SP_AZUPI00F
(UPIUPI POSITION (1:5) INTEGER EXTERNAL,
UPINOM POSITION (6:40) CHAR,
UPIIND POSITION (41:90) CHAR,
UPILOC POSITION (91:125) CHAR,
...but the log return this :
Errors allowed: 10001
Bind array: 10000 rows, maximum of 256000 bytes
Continuation: 1:3 != 0X0d0a1a(character ''), in current physical record
Path used: Conventional
Silent options: FEEDBACK, ERRORS and DISCARDS
...and the import fails. What i miss in the syntax?
I am trying to exclude from import the last line in my text file that contain the hexadecimal
Thank to all for sugestions and solutions.Following link might be helpful ->
[SQL Loader 1|http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10825/ldr_cases.htm#i1010200]
[SQL Loader 2|http://www.psoug.org/reference/sqlloader.html]
Regards.
Satyaki De. -
SQL*Loader and CONTINUEIF clause
Hi,
I used SQL*Loader to load in a table some files coming from main frame environnement.
The length of the physical record is 1662 characters. For some lines of the file, the characters CR (X'0C') could appear anywhere in the position 1158 to 1165 inclusively. I just want to know how to tell to SQL*Loader to concatenate the next record by using CONTINUEIF clause.
I made a simple test. I checked only the position 1165 and it works. Here is the "ctl":
OPTIONS (ERRORS=999999)
LOAD DATA
infile 'T:\RéalDelisle\AGR.PBC1.SCOPY001.de test avec x25 aux positions 1158 a 1165.txt'
BADFILE 'D:\Sinpac\Bad\sinpac_YT.bad'
DISCARDFILE 'D:\Sinpac\Disc\sinpac_YT.dsc'
APPEND
CONTINUEIF THIS PRESERVE (1165)=X'0C'
INTO TABLE AGRMDHD1.Sinpac_YT
+(+
CODEFICHIER constant "D501.A0405",
C001_CP12 position (1:12) ,
C001_record position (1:1662),
C001_record_1157 position (1:1157),
C001_record_1166 position (1166:1662),
+ C001_Mont_subv_adm position (1644:1652) "TO_NUMBER(:c001_mont_subv_adm,'999999D99', 'NLS_NUMERIC_CHARACTERS = ''. '' ')",+
C001_Mont_subv_adm_nouv position (1654:1662) "TO_NUMBER(:c001_mont_subv_adm_nouv,'999999D99', 'NLS_NUMERIC_CHARACTERS = ''. '' ')"
+)+
But, I want to do the test for the position 1158 to 1165 (the character X'0C' could appear in one of those positions). I tried this but it didn't work (I've got a syntax error):
OPTIONS (ERRORS=999999)
LOAD DATA
infile 'T:\RéalDelisle\AGR.PBC1.SCOPY001.de test avec x25 aux positions 1158 a 1165.txt'
BADFILE 'D:\Sinpac\Bad\sinpac_YT.bad'
DISCARDFILE 'D:\Sinpac\Disc\sinpac_YT.dsc'
APPEND
CONTINUEIF THIS PRESERVE (1158)=X'0C'
CONTINUEIF THIS PRESERVE (1150)=X'0C'
CONTINUEIF THIS PRESERVE (1160)=X'0C'
CONTINUEIF THIS PRESERVE (1161)=X'0C'
CONTINUEIF THIS PRESERVE (1162)=X'0C'
CONTINUEIF THIS PRESERVE (1163)=X'0C'
CONTINUEIF THIS PRESERVE (1164)=X'0C'
CONTINUEIF THIS PRESERVE (1165)=X'0C'
INTO TABLE AGRMDHD1.Sinpac_YT
+(+
CODEFICHIER constant "D501.A0405",
C001_CP12 position (1:12) ,
C001_record position (1:1662),
C001_record_1157 position (1:1157),
C001_record_1166 position (1166:1662),
+ C001_Mont_subv_adm position (1644:1652) "TO_NUMBER(:c001_mont_subv_adm,'999999D99', 'NLS_NUMERIC_CHARACTERS = ''. '' ')",+
C001_Mont_subv_adm_nouv position (1654:1662) "TO_NUMBER(:c001_mont_subv_adm_nouv,'999999D99', 'NLS_NUMERIC_CHARACTERS = ''. '' ')"
+)+
I looked in the documentation but I found nothing about the way to do it.
Does anybody have an idea?
Thank'sIf a record contains CR (X'0C'), then is the CR (X'0C') always the last character of the record? If so, I think you'd use LAST (it's all in the Docs.).
If not, then I don't think SQL*Loader will do what you want. Instead, I think you'd need to manipulate the data before it reaches SQL*Loader. You use Windows, so what about installing CygWin? It's a winner, really, and you can then do lovely sed,vi & awk stuff on your data - and it's very fast, too.
Regards - Don Lewis -
Multiple CONTINUEIF statements in SQL Loader
Anyone know how to do this?
Yes. I have read the Oracle documentation on SQL Loader and use of the CONTINUEIF statement. It doesn't state what the syntax is when setting CONTINUEIF for different columns, some that may not be contiguous.
I want to say something like
CONTINUEIF THIS (10)='-' AND THIS (11)='/'
I've tried various permutations of this syntax and a few others. Nothing I've tried works.
I can get CONTINUEIF to work if I only use one instance(column) specification.
Thank You in advance for any help.You can only use a single CONTINUEIF clause in a SQL*Loader command file. If the characters are contiguous, then you can use CONTINUEIF THIS (10-11)='-/'
-
I am moving data from an oracle 10g table to another oracle 10g table, transforming the data in Access, filtering records, merging fields, etc.., then via Access VBA creating CTL files and neccessary scripts, then loading the data via SQL Loader. Getting the CLOBs to load is not a problem, getting it to load with the formatting is. The records in the control file look fine, the formatting is kept just fine in the CTL file, but when it is loaded all the carriage returns, line feeds, etc are removed
Here is the header of my CTL file:
LOAD DATA
INFILE *
CONTINUEIF LAST != "|"
INTO TABLE table_name
APPEND
FIELDS TERMINATED BY '||' TRAILING NULLCOLS
(field1, field2, field3....etc)
begindata
field1||field2||field3||fieldx|
At first i thought taking out the TRAILING NULLCOLS would help but i get the same result.
The end result i am looking for is keeping the data formatted exactly as it is in the source table.
Thanks
MikeAfter doing some research it seems that the only way is creating a file with the clob, see http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_loading.htm#i1007627
Control File Contents:LOAD DATA
INFILE 'sample.dat'
INTO TABLE person_table
FIELDS TERMINATED BY ','
(name CHAR(20),
ext_fname FILLER CHAR(40),
"RESUME" LOBFILE(ext_fname) TERMINATED BY EOF)
Datafile (sample.dat):
Johny Quest,jqresume.txt,
Speed Racer,'/private/sracer/srresume.txt',
Secondary Datafile (jqresume.txt):
Johny Quest,479 Johny Quest
500 Oracle Parkway
[email protected]>
HTH
Enrique -
Loading XML file using sql*loader (10g)
Hi Everyone....
I have a major problem. I have a 10g database and I need to use sql loader to load a large XML file into the database. This file contains records for many, many customers. This will be done several times and the number of records will vary. I want to use sql loader and load to a staging table, BUT SPLIT THE RECORDS OUT and add a sequence. I am having 2 problems.
In the 10g documentation, when you want to split the records you use the BEGINDATA clause and indicate something (like a 0) for each instance of a record. Well my first file has 3,722 records in it. How do I know the number of records in each XML file?
The second problem is that because this is XML, I thought that I could use ENCLOSED BY. But the start tag has an attribute /counter in it, sql*loader doesnt recognize the starting tag. (i.e.: start tag is: </CustomerRec number=1>
end tag is: </CustomerRec> )
So, I used TERMINATED BY '</CustomerRec>'. This will split out the records, but it will NOT include the ending tag of </CustomerRec> and when I use extract, I receive an XML parsing error.
I have tried to get the ending tag using CONTINUEIF and SKIP. But those options are for "records" and not lines.
Does anyone have any ideas for the 2 problems above. I am at my wits end and I need to finish this ASAP. Any help would be appreciated.
Thank you!Sorry.... here is an example of what my control file looks like. At the end, I have 92 "0", but remember, I have 3722 records in this first file.
LOAD DATA (SKIP 1)
INFILE *
INTO TABLE RETURN_DATA_STG
TRUNCATE
XMLType(xmldata)
FIELDS
(fill FILLER CHAR(1),
loadseq SEQUENCE(MAX,1),
xmldata LOBFILE (CONSTANT F001AB.XML)
TERMINATED BY '</ExtractObject>'
------ ":xmldata||'</ExtractObject>'"
BEGINDATA
0
0
0
0
0
0 -
SQL Loader is creating a log file of 0 (zero) bytes.
Hello!!
I am using SQL Loader to load data from a .txt file to a Oracle table.
Following is the control file:
LOAD DATA
CHARACTERSET UTF8
CONTINUEIF LAST != "|"
INTO TABLE product_review_dtl
FIELDS TERMINATED BY '||' TRAILING NULLCOLS
indiv_review_id INTEGER EXTERNAL,
pid INTEGER EXTERNAL,
merchant_review_id INTEGER EXTERNAL,
merchant_user_id CHAR "SUBSTR(:merchant_user_id,1,20)",
review_status_txt CHAR "SUBSTR(:review_status_txt,1,20)",
review_create_date DATE "YYYY-MM-DD",
helpful_votes_cnt INTEGER EXTERNAL,
not_helpful_votes_cnt INTEGER EXTERNAL,
review_source_txt CHAR "SUBSTR(:review_source_txt,1,30)",
overall_rating_num INTEGER EXTERNAL,
comment_txt CHAR(4000) "SUBSTR(:comment_txt,1,4000)",
nickname CHAR "SUBSTR(:nickname,1,30)",
headline_txt CHAR "SUBSTR(:headline_txt,1,100)",
confirmed_status_grp INTEGER EXTERNAL "TO_NUMBER(SUBSTR(TO_CHAR(:confirmed_status_grp),1,5))",
location_txt CHAR "SUBSTR(:location_txt,1,100)"
Some records are loaded. A log file is also created but it is empty. Can you help me find out why the log file is empty?user525235 wrote:
Hello Folks!!
I have 2 input files with different encoding (apparent in case of special characters).
File 1 loads successfully. For File 2 loader gives a memory fault while loading. Hence the log file is of 0 bytes. I still have no clue as to why is the loader giving a memory fault. It is not an OS level memory fault as analysed by the OS team. Please help!
Thanks in advance :)Unknown OS
Unknown database version
No details about what import command was used or the options specified
No samples / details of input files or their encoding
No details about exact error message of "memory fault"
No help is possible ;-)
Srini -
Problem with SQL*Loader loading long description with carriage return
I'm trying to load new items into mtl_system_items_interface via a concurrent
program running the SQL*Loader. The load is erroring due to not finding a
delimeter - I'm guessing it's having problems with the long_description.
Here's my ctl file:
LOAD
INFILE 'create_prober_items.csv'
INTO TABLE MTL_SYSTEM_ITEMS_INTERFACE
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(PROCESS_FLAG "TRIM(:PROCESS_FLAG)",
SET_PROCESS_ID "TRIM(:SET_PROCESS_ID)",
TRANSACTION_TYPE "TRIM(:TRANSACTION_TYPE)",
ORGANIZATION_ID "TRIM(:ORGANIZATION_ID)",
TEMPLATE_ID "TRIM(:TEMPLATE_ID)",
SEGMENT1 "TRIM(:SEGMENT1)",
SEGMENT2 "TRIM(:SEGMENT2)",
DESCRIPTION "TRIM(:DESCRIPTION)",
LONG_DESCRIPTION "TRIM(:LONG_DESCRIPTION)")
Here's a sample record from the csv file:
1,1,CREATE,0,546,03,B00-100289,PROBEHEAD PH100 COMPLETE/ VACUUM/COAX ,"- Linear
X axis, Y,Z pivots
- Movement range: X: 8mm, Y: 6mm, Z: 25mm
- Probe tip pressure adjustable contact
- Vacuum adapter
- With shielded arm
- Incl. separate miniature female HF plug
The long_description has to appear as:
- something
- something
It can't appear as:
-something-something
Here's the errors:
Record 1: Rejected - Error on table "INV"."MTL_SYSTEM_ITEMS_INTERFACE", column
LONG_DESCRIPTION.
Logical record ended - second enclosure character not present
Record 2: Rejected - Error on table "INV"."MTL_SYSTEM_ITEMS_INTERFACE", column
ORGANIZATION_ID.
Column not found before end of logical record (use TRAILING NULLCOLS)
I've asked for help on the Metalink forum and was advised to add trailing nullcols to the ctl so the ctl line now looks like:
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
I don't think this was right because now I'm getting:
Record 1: Rejected - Error on table "INV"."MTL_SYSTEM_ITEMS_INTERFACE", column LONG_DESCRIPTION.
Logical record ended - second enclosure character not present
Thanks for any help that may be offered.
-TracyLOAD
INFILE 'create_prober_items.csv'
CONTINUEIF LAST <> '"'
INTO TABLE MTL_SYSTEM_ITEMS_INTERFACE
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
(PROCESS_FLAG "TRIM(:PROCESS_FLAG)",
SET_PROCESS_ID "TRIM(:SET_PROCESS_ID)",
TRANSACTION_TYPE "TRIM(:TRANSACTION_TYPE)",
ORGANIZATION_ID "TRIM(:ORGANIZATION_ID)",
TEMPLATE_ID "TRIM(:TEMPLATE_ID)",
SEGMENT1 "TRIM(:SEGMENT1)",
SEGMENT2 "TRIM(:SEGMENT2)",
DESCRIPTION "TRIM(:DESCRIPTION)",
LONG_DESCRIPTION "REPLACE (TRIM(:LONG_DESCRIPTION), '-', CHR(10) || '-')") -
HELP: SQL*LOADER AND Ref Column
Hallo,
I have already posted and I really need help and don't come further with this
I have the following problem. I have 2 tables which I created the following way:
CREATE TYPE gemark_schluessel_t AS OBJECT(
gemark_id NUMBER(8),
gemark_schl NUMBER(4),
gemark_name VARCHAR2(45)
CREATE TABLE gemark_schluessel_tab OF gemark_schluessel_t(
constraint pk_gemark PRIMARY KEY(gemark_id)
CREATE TYPE flurstueck_t AS OBJECT(
flst_id NUMBER(8),
flst_nr_zaehler NUMBER(4),
flst_nr_nenner NUMBER(4),
zusatz VARCHAR2(2),
flur_nr NUMBER(2),
gemark_schluessel REF gemark_schluessel_t,
flaeche SDO_GEOMETRY
CREATE TABLE flurstuecke_tab OF flurstueck_t(
constraint pk_flst PRIMARY KEY(flst_id),
constraint uq_flst UNIQUE(flst_nr_zaehler,flst_nr_nenner,zusatz,flur_nr),
flst_nr_zaehler NOT NULL,
flur_nr NOT NULL,
gemark_schluessel REFERENCES gemark_schluessel_tab
Now I have data in the gemark_schluessel_tab which looks like this (a sample):
1 101 Borna
2 102 Draisdorf
Now I wanna load data in my flurstuecke_tab with SQL*Loader and there I have problems with my ref column gemark_schluessel.
One data record looks like this in my file (it is without geometry)
1|97|7||1|1|
If I wanna load my data record, it does not work. The reference (the system generated OID) should be taken from gemark_schluessel_tab.
LOAD DATA
INFILE *
TRUNCATE
CONTINUEIF NEXT(1:1) = '#'
INTO TABLE FLURSTUECKE_TAB
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS (
flst_id,
flst_nr_zaehler,
flst_nr_nenner,
zusatz,
flur_nr,
gemark_schluessel REF(CONSTANT 'GEMARK_SCHLUESSEL_TAB',GEMARK_ID),
gemark_id FILLER
BEGINDATA
1|97|7||1|1|
Is there a error I made?
Thanks in advance
Tigmultiple duplicate threads:
to call an oracle procedure and sql loader in an unix script
Re: Can some one help he sql loader issue. -
Sql*loader and sdo_geometry field
Is there a way to load longitude/latitude coordinates from a flat file directly into an sdo_geometry field with sql*loader? If so, does anyone have an example? I just want to create point features.
Thanks,
DavidDavid,
Section 4.1.2 of the Spatial User Guide has examples for this:
LOAD DATA
INFILE *
TRUNCATE
CONTINUEIF NEXT(1:1) = '#'
INTO TABLE POINT
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS (
GID INTEGER EXTERNAL,
GEOMETRY COLUMN OBJECT
SDO_GTYPE INTEGER EXTERNAL,
SDO_POINT COLUMN OBJECT
(X FLOAT EXTERNAL,
Y 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 need to add the SRID field if you want to add the SRID to the geometry.
Or you can do that with SQL after the data is loaded into the DB.
siva -
I'm trying to lad a file into Oracle and I getting errors like:
Record 1: Rejected - Error on table "DW_SUPPORT"."ISAEO", column CLASS_CDE.
Variable length field exceeds maximum length.
This is for all my columns. Oracle is giving me different column widths than for the ones I've specified. In my control file, I've put:
OPTIONS ( SKIP=1, DIRECT=TRUE)
LOAD DATA
INFILE 'C:\CBOE\ICS\isaback_shrt.dat' "fix 89 "
BADFILE 'C:\CBOE\ICS\isaback_shrt.bad'
DISCARDFILE 'C:\CBOE\ICS\isaback_shrt.dsc'
INTO TABLE "DW_SUPPORT"."ISAEO"
INSERT
(CLASS_CDE POSITION (1:5) VARCHAR (5),
PUT_CALL_IND POSITION (6:6) VARCHAR (1),
EXPR_YR_DTE POSITION (7:8) VARCHAR (2),
EXPR_MO_DTE POSITION (9:10) VARCHAR (2),
EXER_PRC_INT POSITION (11:13) VARCHAR (3),
EXER_PRC_FRC POSITION (14:14) VARCHAR (1),
QUO_MO_SYM_CDE POSITION (15:15) VARCHAR (1),
QUO_PRC_SYM_CDE POSITION (16:16) VARCHAR (1),
SERS_ACTV_DTE POSITION (17:22) VARCHAR (6),
SERS_INACT_DTE POSITION (23:28) VARCHAR (6),
SERS_LSTMOD_DTE POSITION (29:34) VARCHAR (6),
DEC_FRAC_IND POSITION (35:35) VARCHAR (1),
FOUR_DIG_STRK POSITION (36:36) VARCHAR (1),
FIVE_DIG_STRK POSITION (37:37) VARCHAR (1),
FILLER POSITION (38:39) VARCHAR (2),
RAES_VOL_QTY POSITION (40:44) VARCHAR (5),
CARS_VOL_QTY POSITION (45:49) VARCHAR (5),
EXPR_RESN_CDE POSITION (50:50) VARCHAR (1),
AS_OF_CC POSITION (51:52) VARCHAR (2),
AS_OF_YY POSITION (53:54) VARCHAR (2),
AS_OF_MM POSITION (55:56) VARCHAR (2),
AS_OF_DD POSITION (57:58) VARCHAR (2),
FILLER2 POSITION (59:89) VARCHAR (31))
But Oracle, for some reason, has added two extra characters to each column giving me:
Table "DW_SUPPORT"."ISAEO", loaded from every logical record.
Insert option in effect for this table: INSERT
Column Name Position Len Term Encl Datatype
CLASS_CDE 1:5 7 VARCHAR
PUT_CALL_IND 6:6 3 VARCHAR
EXPR_YR_DTE 7:8 4 VARCHAR
EXPR_MO_DTE 9:10 4 VARCHAR
EXER_PRC_INT 11:13 5 VARCHAR
EXER_PRC_FRC 14:14 3 VARCHAR
QUO_MO_SYM_CDE 15:15 3 VARCHAR
QUO_PRC_SYM_CDE 16:16 3 VARCHAR
SERS_ACTV_DTE 17:22 8 VARCHAR
SERS_INACT_DTE 23:28 8 VARCHAR
SERS_LSTMOD_DTE 29:34 8 VARCHAR
DEC_FRAC_IND 35:35 3 VARCHAR
FOUR_DIG_STRK 36:36 3 VARCHAR
FIVE_DIG_STRK 37:37 3 VARCHAR
FILLER 38:39 4 VARCHAR
RAES_VOL_QTY 40:44 7 VARCHAR
CARS_VOL_QTY 45:49 7 VARCHAR
EXPR_RESN_CDE 50:50 3 VARCHAR
AS_OF_CC 51:52 4 VARCHAR
AS_OF_YY 53:54 4 VARCHAR
AS_OF_MM 55:56 4 VARCHAR
AS_OF_DD 57:58 4 VARCHAR
FILLER2 59:89 33 VARCHAR So it's giving me errors like:
SQL*Loader-307: Warning: conflicting lengths 5 and 7 specified for column CLASS_CDE table "DW_SUPPORT"."ISAEO"
I have no idea why its done this. It looks like it thinks I have spaces between my fields. Since I'm working with fixed width input fields do I somehow need to specify that I there are no spaces between fields? What do I need to do?If you have some way for SQL Loader to identify that the the record is split or if you can alter how the files are generated to include a set character at the start of a record then you should be able to do this using CONTINUEIF.
If you can insert a character say $$ at the start of the record then include continueif this (1:2) = '%%' in the control file.
Other than that, it will depend on the format of your file. If your first field is always 3 characters wide you could do continueif this preserve (3:3) = ',' If it happens that the CR/LF occurs just before the closing quotes you could try continueif next preserve (1:1) = '"' Anything else and its going to be pretty difficult... -
Problem with field-length in sql-loader
Hello,
(sorry I see it's the wrong forum -> SQL-Developer, I searched for SQL-Loader, is there a possibility to change the forum ?)
I can't find an answer for my question at google, so I hope there is someone in this forum who can help me.
I have a dat-File that contains 12 500 000 records and want to laod it via sql-loader. The first field contains the ID and there were numbers from 1 to 12 500 000 stored.
When I run the sql-loader, the ID run up to 9 999 999 and then, for the last 2 500 001 records, ist starts at 1 again.
I noticed a few things :
1. Numbers < 10 000 000 don't make Problems
2. Numbers >= 10 000 000 make Problems, the first digit ( in this example "1") is cut, so the number "10 000 001" ist stored as "1". It comes to double entries (IDs 1 to 2 500 000).
3. The same field-definition, I have for the third field of the record -> there is no Problem. THERE I can store any number.
4. I tried to store a number > 100 000 000 -> the first digit was cut too, but ONLY the first digit.
5. I'm able to store any number manually in the Database.
So, I have a problem with the first field. If the number is greater then 10 000 000, the first Number is cut. It doesn't make any differance, if the number is 10 000 000 or 999 999 999, just the first digit, in the first field, is cut.
Any idea ??????????
Here some infos :
Database :
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
SQL-PLUS :
SQL*Plus: Release 10.2.0.4.0 - Production
Script sqlldr :
sqlplus ${schema}/$2 <<EOF >>LOAD.LOG
set timing on
set echo on
set heading off
set heading on
!sqlldr userid=${schema}/$2 control=surface_geometry.ctl log=surface_geometry.log
exit
EOF
ctl-File :
LOAD DATA
INFILE imp_surface_geometry_test2
TRUNCATE
CONTINUEIF NEXT(1:1) = '#'
INTO TABLE SURFACE_GEOMETRY
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS (
ID INTEGER EXTERNAL ,
GMLID,
GMLID_CODESPACE,
PARENT_ID NULLIF PARENT_ID = BLANKS,
ROOT_ID NULLIF ROOT_ID = BLANKS,
IS_SOLID,
IS_COMPOSITE,
IS_TRIANGULATED,
IS_XLINK,
IS_REVERSE,
GEB_ID,
GEOMETRY COLUMN OBJECT
SDO_GTYPE INTEGER EXTERNAL,
SDO_SRID CONSTANT 31468,
SDO_ELEM_INFO VARRAY TERMINATED BY '|/'
(X FLOAT EXTERNAL),
SDO_ORDINATES VARRAY TERMINATED BY '|/'
(X FLOAT EXTERNAL)
Table-Definition (sql-File) :
CREATE TABLE SURFACE_GEOMETRY (
ID NUMBER,
GMLID VARCHAR2(256),
GMLID_CODESPACE VARCHAR2(1000),
PARENT_ID NUMBER,
ROOT_ID NUMBER,
IS_SOLID NUMBER(1,0),
IS_COMPOSITE NUMBER(1,0),
IS_TRIANGULATED NUMBER(1,0),
IS_XLINK NUMBER(1,0),
IS_REVERSE NUMBER(1,0),
GEB_ID CHAR(7),
GEOMETRY MDSYS.SDO_GEOMETRY,
CONSTRAINT c_unique_id UNIQUE (ID))
storage (initial 1M next 1M maxextents 1024) ;
Some Entries in the dat-File :
12556067| |XXX|12556066|12556066|0|0|0|0|0| |
#3003|1|1003|1|/
#4479400.000000|5333360.000000| 526.870000|4479380.000000|5333360.000000| 526.720000|4479400.000000|5333340.000000| 526.980000|4479400.000000|5333360.000000| 526.870000|/
12556068| |XXX| |12556068|0|0|1|0|0| |
#||/
#|/
12556069| |XXX|12556068|12556068|0|0|0|0|0| |
#3003|1|1003|1|/
#4479380.000000|5333380.000000| 526.600000|4479380.000000|5333360.000000| 526.720000|4479400.000000|5333360.000000| 526.870000|4479380.000000|5333380.000000| 526.600000|/
log-File : (100 records for the test)
SQL*Loader: Release 10.2.0.4.0 - Production on Fr Mai 28 15:16:43 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Kontrolldatei: surface_geometry.ctl
Datendatei: imp_surface_geometry_test.dat
Fehlerdatei: imp_surface_geometry_test.bad
Datei für zurückgewiesene Sätze: nichts spezifiziert
(alle Discards zulassen)
Zu ladende Anzahl: ALL
Zu überspringende Anzahl: 0
Zulässige Fehler: 50
Bind-Array: 64 Zeilen, maximal 256000 Bytes
Fortsetzung: 1:1 = 0X23(Zeichen '#'), im nächsten physischen Satz
Benutzer Pfad: Konventionell
Tabelle SURFACE_GEOMETRY, geladen von jedem logischen Satz.
Insert-Option in Kraft für diese Tabelle: TRUNCATE
Option TRAILING NULLCOLS ist wirksam
Spaltenname Position Läng Term Eing Datentyp
ID FIRST * | CHARACTER
GMLID NEXT * | CHARACTER
GMLID_CODESPACE NEXT * | CHARACTER
PARENT_ID NEXT * | CHARACTER
NULL wenn PARENT_ID = BLANKS
ROOT_ID NEXT * | CHARACTER
NULL wenn ROOT_ID = BLANKS
IS_SOLID NEXT * | CHARACTER
IS_COMPOSITE NEXT * | CHARACTER
IS_TRIANGULATED NEXT * | CHARACTER
IS_XLINK NEXT * | CHARACTER
IS_REVERSE NEXT * | CHARACTER
GEB_ID NEXT * | CHARACTER
GEOMETRY DERIVED * COLUMN OBJECT
*** Felder in GEOMETRY
SDO_GTYPE NEXT * | CHARACTER
SDO_SRID CONSTANT
Wert ist '31468'
SDO_ELEM_INFO DERIVED * VARRAY
Abschlusszeichenfolge : '|/'
*** Felder in GEOMETRY.SDO_ELEM_INFO
X FIRST * | CHARACTER
*** Feldende in GEOMETRY.SDO_ELEM_INFO
SDO_ORDINATES DERIVED * VARRAY
Abschlusszeichenfolge : '|/'
*** Felder in GEOMETRY.SDO_ORDINATES
X FIRST * | CHARACTER
*** Feldende in GEOMETRY.SDO_ORDINATES
*** Feldende in GEOMETRY
Tabelle SURFACE_GEOMETRY:
100 Zeilen erfolgreich geladen.
0 Zeilen aufgrund von Datenfehlern nicht geladen.
0 Zeilen nicht geladen, da alle WHEN-Klauseln fehlerhaft waren.
0 Zeilen nicht geladen, da alle Felder NULL waren.
Zugewiesener Bereich für Bind-Array: 232576 Bytes (64 Zeilen)
Byte in Lese-Puffer: 1048576
Gesamtzahl der übersprungenen logischen Datensätze: 0
Gesamtzahl der gelesenen logischen Datensätze: 100
Gesamtzahl der abgelehnten logischen Datensätze: 0
Gesamtzahl der zurückgewiesenen logischen Datensätze: 0
Lauf begonnen am Fr Mai 28 15:16:43 2010
Lauf beendet am Fr Mai 28 15:16:43 2010
Abgelaufene Zeit: 00:00:00.19
CPU-Zeit: 00:00:00.01
Edited by: user9338988 on 28.05.2010 06:21sorry, wrong forum. I opened the thread in forum "Export/Import/SQL-Loader & External Tables"
-
I have a text file that has multiple records on a line, i want to bring in each as a separate record, then drop to the next line and continue a new set of data. each record is separated by a space. each line has max number of 40 records 54 characters long. I couldn't figure out how to use continueif with sql loader and make this work. Any suggestions??
Thank you,
STevenHi Steven
from whati understand you have a line in a flat file and this line will be seperated to seperate rows and inserted into the db??
if yes then this might help you
i suggest you create a function with an IN OUT parameter, which you feed the line and seperate it by a defined seperater, and use each portion as a seperate record/row.
ie:
FUNCTION TO_TEXTVAL
(P_TEXT_LINE IN OUT VARCHAR2)
RETURN VARCHAR2 IS
V_SEP NUMBER(1000):= 0;
V_TEXT_LINE VARCHAR2(10000);
BEGIN
V_SEP := INSTR(P_TEXT_LINE,';');
IF V_SEP = 0 THEN
V_TEXT_LINE := P_TEXT_LINE;
ELSE
V_TEXT_LINE := SUBSTR(P_TEXT_LINE, 1, V_SEP - 1);
P_TEXT_LINE := SUBSTR(P_TEXT_LINE, V_SEP + 1);
END IF;
RETURN (V_TEXT_LINE);
END TO_TEXTVAL;
here i have used a ';' as my seperator u can replace that with a ' ' (space) to do the job .
FUNCTION TO_TEXTVAL
(P_TEXT_LINE IN OUT VARCHAR2)
RETURN VARCHAR2 IS
V_SEP NUMBER(1000):= 0;
V_TEXT_LINE VARCHAR2(10000);
BEGIN
V_SEP := INSTR(P_TEXT_LINE,' ');
IF V_SEP = 0 THEN
V_TEXT_LINE := P_TEXT_LINE;
ELSE
V_TEXT_LINE := SUBSTR(P_TEXT_LINE, 1, V_SEP - 1);
P_TEXT_LINE := SUBSTR(P_TEXT_LINE, V_SEP + 1);
END IF;
RETURN (V_TEXT_LINE);
END TO_TEXTVAL;
then you can use this function in a procedure that calls UTL_FILE.GET_LINE builtin
ie:
UTL_FILE.GET_LINE(v_filehandle, v_text);
v_item_code := TO_TEXTVAL(v_text);
v_item_qty := TO_TEXTVAL(v_text);
v_prod_date := TO_DATE(TO_TEXTVAL(v_text), 'MM/DD/YYYY HH:MI:SS AM');
hope this helps.
Regards
Tony G. -
Hallo,
I have the following problem. I have 2 tables which I created the following way:
CREATE TYPE gemark_schluessel_t AS OBJECT(
gemark_id NUMBER(8),
gemark_schl NUMBER(4),
gemark_name VARCHAR2(45)
CREATE TABLE gemark_schluessel_tab OF gemark_schluessel_t(
constraint pk_gemark PRIMARY KEY(gemark_id)
CREATE TYPE flurstueck_t AS OBJECT(
flst_id NUMBER(8),
flst_nr_zaehler NUMBER(4),
flst_nr_nenner NUMBER(4),
zusatz VARCHAR2(2),
flur_nr NUMBER(2),
gemark_schluessel REF gemark_schluessel_t,
flaeche SDO_GEOMETRY
CREATE TABLE flurstuecke_tab OF flurstueck_t(
constraint pk_flst PRIMARY KEY(flst_id),
constraint uq_flst UNIQUE(flst_nr_zaehler,flst_nr_nenner,zusatz,flur_nr),
flst_nr_zaehler NOT NULL,
flur_nr NOT NULL,
gemark_schluessel REFERENCES gemark_schluessel_tab
Now I have data in the gemark_schluessel_tab which looks like this (a sample):
1 101 Borna
2 102 Draisdorf
Now I wanna load data in my flurstuecke_tab with SQL*Loader and there I have problems with my ref column gemark_schluessel.
One data record looks like this in my file (it is without geometry)
1|97|7||1|1|
If I wanna load my data record, it does not work. The reference (the system generated OID) should be taken from gemark_schluessel_tab.
LOAD DATA
INFILE *
TRUNCATE
CONTINUEIF NEXT(1:1) = '#'
INTO TABLE FLURSTUECKE_TAB
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS (
flst_id,
flst_nr_zaehler,
flst_nr_nenner,
zusatz,
flur_nr,
gemark_schluessel REF(CONSTANT 'GEMARK_SCHLUESSEL_TAB',GEMARK_ID),
gemark_id FILLER
BEGINDATA
1|97|7||1|1|
Is there a error I made?
Thanks in advance
TigI am sure, on rereading the OPs email, you will see a disconnect between what was written and your response.
The maximum size of a VARCHAR2 columns is always 4000 bytes. The maximum size of a VARCHAR2 PL/SQL variable is always 32K bytes.
If someone is trying to load the text from an email that may exceed 4K into a table they must use a CLOB column if they wish it to be searchable as text. -
I'm trying to execute a control file.
Below is the error message
SQL*Loader: Release 10.2.0.1.0 - Production on Thu Sep 10 10:54:10 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]
ORA-12560: TNS:protocol adapter errorulcase4.dat
*7782 CLARK MANAGER 7839 2572.50 -10 10 12-NOV-85
*7839 KING PRESIDENT 5500.00 20 05-APR-83
*7934 MILLER CLERK 7782 920.00 10 08-MAY-80
*7566 JONES MANAGER 7839 3123.75 30 17-JUL-85
*7499 ALLEN SALESMAN 7698 1600.00 300.00 10 03-JUN-84
*7654 MARTIN SALESMAN 7698 1312.50 1400.00 30 21-DEC-85
*7658 CHAN ANALYST 7566 3450.00 20 16-FEB-84ulcase4.ctl
LOAD DATA
INFILE 'c:\data\ulcase4.dat'
DISCARDFILE 'ulcase4.dsc'
DISCARDMAX 999
REPLACE
CONTINUEIF THIS (1) = "*"
INTO TABLE emp
(empno POSITION(1:4) INTEGER EXTERNAL,
ename POSITION(6:11) CHAR,
job POSITION(13:21) CHAR,
mgr POSITION(23:26) INTEGER EXTERNAL,
sal POSITION(28:34) DECIMAL EXTERNAL,
comm POSITION(36:42) DECIMAL EXTERNAL,
deptno POSITION(44:45) INTEGER EXTERNAL,
hiredate POSITION(47:55) DATE)What could be the reason? Thanks.Thanks Solomon that worked...
I've an other issue..
When I try to run the control file, only one row is inserted into the table. what could be the reason?
below is the data from the log file.
Column Name Position Len Term Encl Datatype
EMPNO 1:4 4 CHARACTER
ENAME 6:11 6 CHARACTER
JOB 13:21 9 CHARACTER
MGR 23:26 4 CHARACTER
SAL 28:34 7 CHARACTER
COMM 36:42 7 CHARACTER
DEPTNO 44:45 2 CHARACTER
HIREDATE 47:55 9 DATE DD-MON-RR
Table EMP:
1 Row successfully loaded.
0 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: 4352 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 1
Total logical records rejected: 0
Total logical records discarded: 0
Maybe you are looking for
-
Unable to create function based spatial index
Maybe someone can help me. I can't seem to find the answer for what I'm doing here. I'm trying to create a function based spatial index - so that I can utilize coordinates in tables when I have no SDO_GEOMETRY column. Is there a fundamental problem w
-
CPU load with request on Uniquemember attribute
Hi All, I migrate 3 directory server of Iplanet Directory Server 5.1SP4 to Sun One Directory Server 5.2SP4 and since this day, I have several problems on the 3 migrated servers, especially with requests on Uniquemember attribute !! I already checked
-
Ok, recently I've downloaded the new Ovi Maps and I find that it has finally added useable maps for my country. Now I can't seem to find to "Go to My Position" option on the map, like the one on google maps. Help? If you find my post helpful please c
-
JSP 2.1 and JSF 1.2 support?
hi when can we expect to see JSP 2.1 and JSF 1.2 support in JDeveloper? br. aspa
-
I iphone 3g(s) is stuck on recovery mode.
Recently my iphone 3g(s) has been shutting off randomly and cant turn back on untill i recharge it even though it was at 100%. Two days ago its shut off and is stuck on recovery mode. I tried restoring it but i got an error. I try to restart the ipho