Sqlldr date at when clause
Hi all,
i need to create a conditional loader script in sqlldr.
i write ctl script like this
LOAD DATA
INFILE 'COMSUMER.txt'
BADFILE 'COMSUMER.bad'
DISCARDFILE 'COMSUMER.dsc'
APPEND
INTO TABLE "RBS_CC_CUSTOMERINFO"
WHEN CODE = '0' and PROC_DT < '01/01/2009'
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
PROC_DT date "MM/DD/YYYY",
)I got the error like this
SQL*Loader-350: Syntax error at line 4.
Illegal combination of non-alphanumeric characters WHEN PROC_DT < '01/01/2009' and CODE = '0'
Please help me
Edited by: carmac on Feb 11, 2013 2:56 PM
Edited by: carmac on Feb 11, 2013 2:57 PM
Edited by: BluShadow on 11-Feb-2013 09:38
added {noformat}{noformat} tags for readability. Please read {message:id=9360002} and learn to do this yourself.
Ok, for starters:
PROC_DT < '01/01/2009' when you compare DATE datatypes you should not use strings.
In SQL or PL/SQL code such a date comparison would be something like:
PROC_DT < to_date('01/01/2009','DD/MM/YYYY')Personally, I'd consider using External Tables instead, and then apply your conditions on the SQL that queries the data from the External Table. Much more flexible and easy to do...
http://www.morganslibrary.org/reference/externaltab.html
Similar Messages
-
How to use WHEN clause in sqlldr
I want to insert RECORDS in table which are having orgno column values greater then 100 in my datafile using sqlldr.
In WHEN clause in my control file if i mention WHEN (orgno > '100')
it gives me error :
Illegal combination of non-alphanumeric characters
WHEN (orgno < '500')
^
I am able to insert records when i use WHEN (orgno = '100') but not when i use > or < sign.
what to do???Hello user8531525.
"The supported operators are equal (=) and not equal (!= or ne)"; replace the ne with less than and greater than signs. (http://www.mcs.csueastbay.edu/support/oracle/doc/10.2/server.102/b14215/ldr_control_file.htm)
Your filtering will need to be performed on the file itself or on the records after they are loaded. If your file is local to your database, consider using External Tables.
Luke
Please mark the answer as helpful or answered if it is so. If not, provide additional details.
Always try to provide create table and insert table statements to help the forum members help you better.
Edited by: Luke Mackey on Aug 5, 2010 2:58 PM -
SQL Loader to append data in same table but using differnet WHEN clauses
In my data file i have a header record and a detail record identified by Record_type = 1 and 2 respectively.
The Database table has all the columns to capture detail records but i want to capture jus one column of header record now also in my existing table. So i have added that column (DATA_DATE)in my table but how to capture that value ?
im writing my control file using two WHEN clauses, something like -
load data
into table t_bdn
append
when RECORD_TYPE = '2'
FIELDS TERMINATED BY "|" TRAILING NULLCOLS
SEQUENCE_NO
, RECORD_TYPE
, DISTRIBUTOR_CODE
, SUPPLIER_CODE
, SUPPLIER_DISTRIBUTOR_CODE
, DISTRIBUTOR_SKU
, SUPPLIER_SKU
when RECORD_TYPE = '1'
FIELDS TERMINATED BY "|" TRAILING NULLCOLS
SEQUENCE_NO FILLER
, RECORD_TYPE FILLER
, CREATE_DATE FILLER
, DATA_DATE "NVL(to_date(:DATA_DATE, 'YYYY/MM/DD'),to_date('9999/12/31', 'YYYY/MM/DD'))"
im getting error " expecting INTO and foung WHEN RECORD_TYPE = '1' "
if i give iNTO second time it will append a new row altogether in my table but i want the same row to be updated with this DATA_DATE value coming from RECORD_TYPE =1 and header record has 4 delimited data text fields only and i am interested in fetching just the 4th column..
KIndly suggest what to do ?Ravneek, I could be wrong but sqlldr is a 'load' program, that is, it inserts data. I am unaware of any ability to update existing rows as you seem to want. What you appear to want to do is more the job of a merge statement.
I would look at writing a pro* language, a .net, or a java program to perform inserts where some or all of the newly inserted rows are also to be updated.
From the manual: (Oracle® Database Utilities 10g Release 2 (10.2) Part Number B14215-01)
Updating Existing Rows
The REPLACE method is a table replacement, not a replacement of individual rows. SQL*Loader does not update existing records, even if they have null columns. To update existing rows, use the following procedure:
1. Load your data into a work table.
2. Use the SQL language UPDATE statement with correlated subqueries.
3. Drop the work table.
HTH -- Mark D Powell -- -
Sqlldr WHEN clause with function call ?
I have a requirement to load data from a file with each row being checked for good data.
But that check is wrapped inside a function, as it is somewhat complex.
So I woul like to load the data with a WHEN clause like this
WHEN ( "CHECK_IF_GOOD(:field1, :field2,.. )" = '1' )
But sqlldr compains that column CHECK_IF_GOOD(:field1, :field2,.. ) is not present in tableA
Obviously sqlldr thought CHECK_IF_GOOD(:field1, :field2, ) to be a column name.
Is there any work around for this problemThe quotes and colons are not shown in the documentation for the when clause.
http://download.oracle.com/docs/cd/B14117_01/server.101/b10825/ldr_control_file.htm#i1005657
I do not know if you can invoke your own function in the Loader operation. -
Sqlloader:only 1st when clause works for comma separated data file
LOAD DATA
INFILE 'XXMI_SUPPLIER_DATA.dat'
REPLACE
INTO TABLE APPS.XXMI_AP_SUPPLIERS_STG
when interface_record_type = '01'
Fields terminated by "," Optionally enclosed by '"'
TRAILING NULLCOLS
and
INTO TABLE APPS.XXMI_AP_SUPPLIER_SITES_STG
when interface_record_type = '02'
Fields terminated by "," Optionally enclosed by '"'
TRAILING NULLCOLS
always getting the error for second when clause:
4 Rows not loaded because all WHEN clauses were failed.
pls any one can throw some light on this?What's Oracle version.
What's your datafile looks like. Post a few sample line here.
when interface_record_type = '01'You didn't define interface_record_type in your when clause.
Sample,
INTO TABLE dept
WHEN recid = 1
(recid FILLER INTEGER EXTERNAL TERMINATED BY WHITESPACE,
deptno INTEGER EXTERNAL TERMINATED BY WHITESPACE,
dname CHAR TERMINATED BY WHITESPACE) check Oracle doc,
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_control_file.htm#i1004788 -
hi,
i am facing a problem during when clause in sql loader
here is my control file
options(direct=true)
load data
infile 'data_file.txt'
truncate
into table "TABLE_NAME"
when col1 = '1'
trailing nullcols
col1 integer external TERMINATED BY ',',
col2 integer external )
into table "TABLE_NAME"
when col1 = '2'
trailing nullcols
col1 integer external TERMINATED BY ',' ,
col2 integer external )
=======================================
this file loads only data when col1=1 and does not load data when col1=2
can any body help me
thanks in advanceHi,
I currently have the same problem. Seems that SQLLDR WHEN clause only apply for columns that based on datafile. Also, data that to be compared in WHEN clause is get from datafile and you can not make any modification on that data.
How did you do to work around with that? -
SQL Loader / WHEN clause / swich off? / bloated log files
Hallo everyone,
I am loading data from very large source files using SQL-Loader. This all works fine.
However, now, using the WHEN clause (in the control file), I would like to load only a very restricted sub-set of the main data. This also works fine ...
WHEN ARTICLECODE != '000000000000006769'
However, the log file becomes completely bloated with messages telling me of each record which has failed the WHEN clause ...
Record 55078: Discarded - failed all WHEN clauses.
This is becoming a problem because it slows down the process and creates bloated log files which are eating up my disk-space.
There must be a simple command to allow me to switch off thiese messages but, although I have googled on it, I haven't managed to find it.
Any ideas on this one? I'm sure it's simple.
Regards and many thanks,
Alan SearleTry to add key SILENT=DISCARDS to sqlldr command
Silent means - Suppress messages during run (header,feedback,errors,discards,partitions) -
SQLLDR date format issue with AM/PM
Hello Experts,
I am unable to load data into my table in oracle 11G using sql loader.
I will put my problem in a simpler way.
SQL> sho parameter nls_date_format
nls_date_format string DD-MM-YYYY HH12:MI:SS AM
SQL>
SQL> desc hero
Name Null? Type
DAT_1 TIMESTAMP(6)
hero.ctl
LOAD DATA
INFILE 'hero.dat'
INTO TABLE HERO
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
DAT_1 DATE "DD/MM/YYYY HH12:MI:SS AM"
hero.log
Column Name Position Len Term Encl Datatype
DAT_1 FIRST * , DATE DD/MM/YYYY HH12:MI:SS AM
Record 1: Rejected - Error on table HERO, column DAT_1.
ORA-01858: a non-numeric character was found where a numeric was expected
Table HERO:
0 Rows successfully loaded.
1 Row 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.
hero.bad
"28/2/2011 11:48:00 PM"Constraints :-
1. The data from the flat file cannot be formatted / edited / changed.
2. The table's datatypes cannot be altered.
Regards,
ValliThe problem is that you are trying to put a DATE into a TIMESTAMP column. The DATE needs converting to a timestamp. This would be easier if you used external tables as you could do the conversion on the fly when doing an insert...select... from the external table, rather than relying on the outdated SQL*Loader functionality.
-
Getting Date error when I process
Hi All,
I have DEV & QA Analysis services on 2 different server. This is 2005 SSAS
I am using same solution so DEV process OK but QA gives me date error
when I check with SSMS , date fields look fine .
But I am getting this error in QA
Errors in the OLAP storage engine: The attribute key cannot be found: Table: dbo_view_ftblCharge, Column: SrvDateKey, Value: 12/13/2005. Errors in the OLAP storage engine: The record
was skipped because the attribute key was not found. Attribute: Date of Dimension: Service Date from Database: Charges, Cube: Charges, Measure Group: Charges, Partition: Charges, Record: 1. Errors in the OLAP storage engine: The process operation ended because
the number of errors encountered during processing reached the defined limit of allowable errors for the operation. Errors in the OLAP storage engine: An error occurred while processing the 'Charges' partition of the 'Charges' measure group for the 'Charges'
cube from the Charges database
Thanks,
Gok12/13/2005 is an American date format (mm/dd/yyyy) whereas you need a british date format 13/12/2005 (dd/mm/yyyy).
Have a look at this topic on how you can force the correct collation (date format)
http://sqlmag.com/blog/forcing-collation-where-clause-22-jun-2011
Please click "Mark As Answer" if my post helped. Tony C. -
Help on SQL Loader When Clause
I have 2 Oracle tables of exact same structure.
ENO NUMBER
PARENT NUMBER
CHILD NUMBER
ENAME VARCHAR2 (50 Byte)
ADDRESS VARCHAR2 (50 Byte)
CITY VARCHAR2 (50 Byte)
SRCFILENAME VARCHAR2 (50 Byte)
SDATE VARCHAR2 (400 Byte)
Current_Load VARCHAR2 (1 Byte)
Have a data file and a loader control file which loads data in these 2 tables.
I need to do a conditional load using a when clause.
Condition : when PARENT=CHILD, load in table 2 else load in table 1
My control file looks like this .
LOAD DATA
INFILE 'TEST_20120815.txt'
APPEND INTO TABLE test1
fields terminated by "|"
trailing nullcols
eno,
parent,
child,
ename,
address,
city ,
sdate "to_date(:sdate,'DD/MM/YYYY')",
SrcFileName,
col7 filler,
"Current_Load" constant 'Y'
INTO TABLE test2 when (parent=child)
fields terminated by "|"
trailing nullcols
eno position(1),
parent,
child,
ename,
address,
city ,
sdate "to_date(:sdate,'DD/MM/YYYY')",
SrcFileName,
col7 filler,
"Current_Load" constant 'Y'
) But this doesn't work. It works fine if I give direct value like PARENT='P'.
Any idea as how to compare the 2 fields while doing conditional load?You cannot compare 2 fields with the WHEN clause in an SQL*Loader control file.
only literal values as defined by the syntax:
http://docs.oracle.com/cd/B19306_01/server.102/b14215/ldr_control_file.htm#i1005657
As already suggested, you would be better to load your data using an external table where you can apply any conditions you want during your SQL query that is fetching the data. -
SQL*LOADER, the WHEN clause and WILDCARDS
has anybody ever used wildcards in a WHEN clause in the SQL*LOADER control file?
WHEN string_2_load = 'GOOD' , all 'good' rows load
WHEN string_2_load = 'GO%', all rows fail the WHEN clause and end up in the discard file.
thanks in advance - if i don't go crazy first
burtI have also faced a similar problem like this. Try this control file
LOAD DATA
INFILE 'DATA.dat'
BADFILE 'MLIMA.bad'
INTO TABLE Brok_Gl_Interface
APPEND
WHEN record_type = '10'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
record_type CHAR ,
currency CHAR ,
entity CHAR ,
cost_centre CHAR ,
usd_account CHAR ,
amount CHAR
INTO TABLE Brok_Gl_Interface
WHEN record_type = '99'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
record_type POSITION(1) CHAR ,
record_count CHAR
INTO TABLE Brok_Gl_Interface
WHEN record_type = '00'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
record_type POSITION(1) CHAR,
run_date CHAR,
effective_date CHAR
)Regards,
Mohana -
SQL Loader Control file WHEN clause
LOAD DATA
REPLACE
INTO TABLE IDL_Investments
WHEN average_balance < '100.00'
FIELDS TERMINATED BY X'9'
TRAILING NULLCOLS
Borrower_Id,
Account_No,
customer_No,
cptype_id "GETID(:cptype_id)",
customer_name,
average_balance,
CP_GroupName,
CP_type,
Account_Type,
Instrument_type,
DD_date "TO_DATE(:DD_date, 'dd/mm/yy')",
fac_Maturity_date "TO_DATE(:fac_Maturity_date, 'dd/mm/yy')"
above one is the control file. when i tried to load data i waas getting the following error.
SQL*Loader-350: Syntax error at line 4.
Illegal combination of non-alphanumeric characters
WHEN average_balance < '100.00'
^
instead of '<' symbol if i place an '=' symbol then its workig fine.
So how do I use <, <=, > or >= operators in a WHEN clause of a control file can any one help me?
Thanks in advance.Thanks for the suggestion but by searching in someother sites i found that
only equality operators ('=', '!=' or '<>') are permited in the WHEN clause expressions of a control file in SQL Loader.
So now i changed my logic.
thanks anyway. -
Dear experts,
I'm trying to load txt file into table via sqlldr. I'm receiving error "Rejected - Error on table TEST_TABLE, column PERIOD_START_TIME. ORA-01843: not a valid month
The date format in flat txt file is MM:DD:YYYY; in the output table I want to have is DD.MM.YYYY
It looks that sqlldr wrongly interprets input date format - when the input is 07-08-2012 then the output is 07.08.2012 so it assumes that the input is in format MM-DD-YYYY instead of DD-MM-YYYY. And when the day is higher than 12 (13,14 etc) then an error appears
Do you know where/how to force SQLLDR to interpret it correcly? Is it somehow related to NLS_Lang. settings?
Control file looks as follow:
OPTIONS (SKIP=1)
LOAD DATA
INFILE test.txt
APPEND
INTO TABLE TEST_TABLE
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
(NE_ID,
LAC_ID,
PERIOD_START_TIME DATE 'DD.MM.YYYY HH24:MI:SS',
PERIOD_DURATION,
NSCURRENT,
NSAVERAGE
Table definition:
NE_ID NUMBER
LAC_ID NUMBER
PERIOD_START_TIME DATE
PERIOD_DURATION NUMBER
NSCURRENT NUMBER
NSAVERAGE NUMBER
INPUT DATA:
NE_ID;LAC_ID;PERIOD_START_TIME;PERIOD_DURATION;NSCURRENT;NSAVERAGE;
576527001;37000;07-16-2012 09:00:00;60;24846;24956;
576527001;37000;07-08-2012 10:00:00;60;1;1
Thanks in advance for any hints
Rgds
LukaszHi, Lukasz,
Welcome to the forum!
user8640349 wrote:
Dear experts,
I'm trying to load txt file into table via sqlldr. I'm receiving error "Rejected - Error on table TEST_TABLE, column PERIOD_START_TIME. ORA-01843: not a valid month
The date format in flat txt file is MM:DD:YYYY; in the output table I want to have is DD.MM.YYYYIn the table, if the column is a DATE, then it won't have either format. Format, such as 'MM:DD:YYYY' versus 'DD.MM.YYYY' only applies to strings.
It looks that sqlldr wrongly interprets input date format - when the input is 07-08-2012 then the output is 07.08.2012 so it assumes that the input is in format MM-DD-YYYY instead of DD-MM-YYYY. And when the day is higher than 12 (13,14 etc) then an error appears
Do you know where/how to force SQLLDR to interpret it correcly? Is it somehow related to NLS_Lang. settings?
Control file looks as follow:
OPTIONS (SKIP=1)
LOAD DATA
INFILE test.txt
APPEND
INTO TABLE TEST_TABLE
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
(NE_ID,
LAC_ID,
PERIOD_START_TIME DATE 'DD.MM.YYYY HH24:MI:SS',The format you give after the keyword DATE tessls what the input data looks like. If the month comes before the day in your input file, then you should be saying
{code}
PERIOD_START_TIME DATE 'MM.DD.YYYY HH24:MI:SS',
{code}
PERIOD_DURATION,
NSCURRENT,
NSAVERAGE
Table definition:
NE_ID NUMBER
LAC_ID NUMBER
PERIOD_START_TIME DATE
PERIOD_DURATION NUMBER
NSCURRENT NUMBER
NSAVERAGE NUMBER
INPUT DATA:
NE_ID;LAC_ID;PERIOD_START_TIME;PERIOD_DURATION;NSCURRENT;NSAVERAGE;
576527001;37000;07-16-2012 09:00:00;60;24846;24956;
576527001;37000;07-08-2012 10:00:00;60;1;1SQL*Loader only controls how data gets into a table. It has nothing to do with what you do with that data after it is in the table.
If you want a DATE column displayed in a particular format, then use TO_CHAR in the query that produces the display, or change NLS_DATE_FORMAT to set the default date format in your session. For example:
{code}
ALTER SESSION SET NLS_DATE_FORMAT = 'DD.MM.YYYY HH24:MI:SS';
SELECT ename
, hiredate
FROM scott.emp
ORDER BY hiredate
{code}
Output:
{code}
ENAME HIREDATE
SMITH 17.12.1980 00:00:00
ALLEN 20.02.1981 00:00:00
WARD 22.02.1981 00:00:00
JONES 02.04.1981 00:00:00
BLAKE 01.05.1981 00:00:00
CLARK 09.06.1981 00:00:00
TURNER 08.09.1981 00:00:00
MARTIN 28.09.1981 00:00:00
KING 17.11.1981 00:00:00
JAMES 03.12.1981 00:00:00
FORD 03.12.1981 00:00:00
MILLER 23.01.1982 00:00:00
SCOTT 19.04.1987 00:00:00
ADAMS 23.05.1987 00:00:00
{code}
It doesn't matter what format the date information was in before it was entered into the table. In the table, all DATEs have the same format. -
Regarding Sql Loader(All WHEN Clause Failed)
Below is my control file
LOAD DATA
INFILE 'DATA.dat'
BADFILE 'MLIMA.bad'
INTO TABLE Brok_Gl_Interface
APPEND
WHEN record_type = '10'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
record_type CHAR ,
currency CHAR ,
entity CHAR ,
cost_centre CHAR ,
usd_account CHAR ,
amount CHAR
INTO TABLE Brok_Gl_Interface
WHEN record_type = '99'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
record_type CHAR ,
record_count CHAR
INTO TABLE Brok_Gl_Interface
WHEN record_type = '00'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
record_type CHAR,
run_date CHAR,
effective_date CHAR
below is my data file
00,05062006,02062006,
10,EUR,82G,82GE00,46005AA600,78827.41,
10,GBP,82G,82GE00,46005AA600,-2820955.63,
10,GBP,82G,82GE00,46005AA600,340252.39,
10,GBP,82G,82GE00,46007AB100,-1665483.26,
10,EUR,82G,82GE38,46007AB100,-38924.00,
99,95,
At the time of execution the condition which is 1st is only working for others i am getting the error message 'All When Clause Failed'
pl'z help me out.I have also faced a similar problem like this. Try this control file
LOAD DATA
INFILE 'DATA.dat'
BADFILE 'MLIMA.bad'
INTO TABLE Brok_Gl_Interface
APPEND
WHEN record_type = '10'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
record_type CHAR ,
currency CHAR ,
entity CHAR ,
cost_centre CHAR ,
usd_account CHAR ,
amount CHAR
INTO TABLE Brok_Gl_Interface
WHEN record_type = '99'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
record_type POSITION(1) CHAR ,
record_count CHAR
INTO TABLE Brok_Gl_Interface
WHEN record_type = '00'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
record_type POSITION(1) CHAR,
run_date CHAR,
effective_date CHAR
)Regards,
Mohana -
SQLLoader: when clause fails
Hi,
I'm working on an
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
I've to load a file into 2 different tables, and I'm tring to do that using sqlloader and one single control file.
This the (part of) source file:
"1","20110228155443","21970","671","3","","LISSETTE CAROLIN","MORALES COBO","","","V11283202","UBICAR123","","",""
"1","20110228160121","21971","671","3","","RAFAEL GREGORIO","BRIÃEZ ZAMBRANO","","0","","","","",""
"1","20110228160505","21972","14782","3","","Noelia","Parrales","","","RRHH","rrhh123","","",""
"1","20110228163120","21973","671","3","","JOSE GREGORIO","PEREZ","","0","","","","",""
"1","20110228165534","21974","671","3","","CARMEN","ARAUJO","","","V15753282","UBICAR123","","",""
"2","20110228044646","12005","1","0","","","Cellocator Test","4","0","COMPACT 268852","","","","","","","","",
"2","20110228084454","22012","1","3","","","POLO","22","0","EG727SV","20110223000000","MASSIMO","PAMELA","WVWZZZ6RZBY201299","","","","",
"2","20110228085219","20378","1","22","","","ASTRA","4","0","EF774ND","20110120000000","ER3497","X","WOLPF6EN3BG059489","","","","",
"2","20110228091127","22122","1","3","","","GOLF","4","0","EG766SV","20110224000000","BALGARION","VETURIA","WVWZZZ1KZBW215645","","","","",And this is the control file:
OPTIONS ( DIRECT=FALSE,PARALLEL=TRUE, ERRORS=0, BINDSIZE=50000, ROWS=1000, READSIZE=65536)
LOAD DATA
CHARACTERSET UTF8
TRUNCATE
INTO TABLE "STG_ITALY"."STG_USER"
WHEN TYPE_ = "1"
FIELDS terminated by ',' enclosed by '"' TRAILING NULLCOLS
"TYPE_" INTEGER EXTERNAL,
"DATE_MODIFY" "TO_DATE(:DATE_MODIFY, 'YYYYMMDDHH24MISS')",
"ID_USER" INTEGER EXTERNAL,
"ID_USER_PARENT" INTEGER EXTERNAL,
"I_TYPE_USER" INTEGER EXTERNAL,
"COMPANY_NAME" CHAR,
"FIRST_NAME" CHAR,
"LAST_NAME" CHAR,
"MIDDLE_NAME" CHAR,
"I_NATIONALITY" INTEGER EXTERNAL,
"LOGIN_NAME" CHAR,
"LOGIN_PASSWORD" CHAR,
"NOTE" CHAR,
"DATE_VALID_TO" "TO_DATE(:DATE_VALID_TO, 'YYYYMMDDHH24MISS')",
"ID_USER_VALID_TO" INTEGER EXTERNAL
INTO TABLE "STG_ITALY"."STG_VEHICLE"
WHEN TYPE_ = "2"
FIELDS terminated by ',' enclosed by '"' TRAILING NULLCOLS
"TYPE_" INTEGER EXTERNAL,
"DATE_MODIFY" "TO_DATE(:DATE_MODIFY, 'YYYYMMDDHH24MISS')",
"ID_VEHICLE" INTEGER EXTERNAL,
"I_TYPE_VEHICLE" INTEGER EXTERNAL,
"ID_BRAND_VEHICLE" INTEGER EXTERNAL,
"ID_MODEL_VEHICLE" INTEGER EXTERNAL,
"ID_FUEL_TYPE" INTEGER EXTERNAL,
"MODEL" CHAR,
"I_COLOUR" INTEGER EXTERNAL,
"METALIC" INTEGER EXTERNAL,
"PLATE_NUMBER" CHAR,
"MATRICULATION" "TO_DATE(:MATRICULATION, 'YYYYMMDDHH24MISS')",
"VOCAL_STD_PASSWORD" CHAR,
"VOCAL_EMR_PASSWORD" CHAR,
"FRAME_NUMBER" CHAR,
"ENGINE_NUMBER" CHAR,
"NOTE" CHAR,
"DATE_VALID_TO" "TO_DATE(:DATE_VALID_TO, 'YYYYMMDDHH24MISS')",
"ID_USER_VALID_TO" INTEGER EXTERNAL
)The problem is that I can fill just first table.
The when clause of the second table always fails, and no rows are written.
This is the log:
Table "STG_ITALY"."STG_USER":
68 Rows successfully loaded.
0 Rows not loaded due to data errors.
680 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Table "STG_ITALY"."STG_VEHICLE":
0 Rows successfully loaded.
0 Rows not loaded due to data errors.
748 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.What I'm doing wrong?
Thanks in advanceTry to modify your controlfile to
OPTIONS ( DIRECT=FALSE,PARALLEL=TRUE, ERRORS=0, BINDSIZE=50000, ROWS=1000, READSIZE=65536)
LOAD DATA
CHARACTERSET UTF8
TRUNCATE
INTO TABLE "STG_ITALY"."STG_USER"
WHEN TYPE_ = "1"
FIELDS terminated by ',' enclosed by '"' TRAILING NULLCOLS
"TYPE_" INTEGER EXTERNAL,
"DATE_MODIFY" "TO_DATE(:DATE_MODIFY, 'YYYYMMDDHH24MISS')",
"ID_USER" INTEGER EXTERNAL,
"ID_USER_PARENT" INTEGER EXTERNAL,
"I_TYPE_USER" INTEGER EXTERNAL,
"COMPANY_NAME" CHAR,
"FIRST_NAME" CHAR,
"LAST_NAME" CHAR,
"MIDDLE_NAME" CHAR,
"I_NATIONALITY" INTEGER EXTERNAL,
"LOGIN_NAME" CHAR,
"LOGIN_PASSWORD" CHAR,
"NOTE" CHAR,
"DATE_VALID_TO" "TO_DATE(:DATE_VALID_TO, 'YYYYMMDDHH24MISS')",
"ID_USER_VALID_TO" INTEGER EXTERNAL
INTO TABLE "STG_ITALY"."STG_VEHICLE"
WHEN TYPE_ = "2"
FIELDS terminated by ',' enclosed by '"' TRAILING NULLCOLS
"TYPE_" POSITION(1) INTEGER EXTERNAL,
"DATE_MODIFY" "TO_DATE(:DATE_MODIFY, 'YYYYMMDDHH24MISS')",
"ID_VEHICLE" INTEGER EXTERNAL,
"I_TYPE_VEHICLE" INTEGER EXTERNAL,
"ID_BRAND_VEHICLE" INTEGER EXTERNAL,
"ID_MODEL_VEHICLE" INTEGER EXTERNAL,
"ID_FUEL_TYPE" INTEGER EXTERNAL,
"MODEL" CHAR,
"I_COLOUR" INTEGER EXTERNAL,
"METALIC" INTEGER EXTERNAL,
"PLATE_NUMBER" CHAR,
"MATRICULATION" "TO_DATE(:MATRICULATION, 'YYYYMMDDHH24MISS')",
"VOCAL_STD_PASSWORD" CHAR,
"VOCAL_EMR_PASSWORD" CHAR,
"FRAME_NUMBER" CHAR,
"ENGINE_NUMBER" CHAR,
"NOTE" CHAR,
"DATE_VALID_TO" "TO_DATE(:DATE_VALID_TO, 'YYYYMMDDHH24MISS')",
"ID_USER_VALID_TO" INTEGER EXTERNAL
)(only add a POSITION(1) keyword by the second table )
Best regards
Maxim
Maybe you are looking for
-
How to find articles if I know merchandise category?
Hi, I know merchandise category, for example, 08-03-06. How can I find articles ? Thanks.
-
Add field group and Logical field group for ANLU
Hi all, On my project, the table ANLU is containing many specifics fields. I would like to know how I could add a field group and logical field group corresponding to this specifics fields on ANLU, in order to be taking into account on my validation
-
ERROR WHEN I HIT WEBLOGIC CONSOLE
Hi all, i have installed OIM PS1 did the following steps 1) Install Database 2) Run RCU and create Schema for required products 3) Install Weblogic Server 10.3.6 4) Install SOA Server and Install SOA patches 5) Install IDM Server 6) Create Domains 7
-
Premiere Pro CC scrambles media in-outs when converting CS5.5 Project
Bit of a strange situation here. Created a project in CS5.5, edited some WAV files on the timeline. WAV files had non-zero starting time codes (they were coming from ProTools). Opened the project in CC, said yes to conversion. About 20% of the clips
-
DB2, Log File has reached its saturation point" DIA8309C Log file was full,
Hello Experts, I have successfully installed a ECC 6.0 System-ABAP + JAVA (DB2 v9.5 windows server 2008-x64 bit). Kernel: 700 , Patch: 185 ; SP level : rel 700 , level 17. However now i suddenly cannot connect to database and SAP is down. C:\Users\ds