SQLLoader When clause

Hi,
I'm loading a csv file using a sqlloader.
this is the CTL:
OPTIONS ( DIRECT=FALSE,PARALLEL=TRUE, ERRORS=1000, BINDSIZE=50000, ROWS=5000, READSIZE=65536)
LOAD DATA
CHARACTERSET UTF8
APPEND
INTO TABLE "DW"."T_DATA_SUMMARY"
FIELDS terminated by ',' enclosed by '"' TRAILING NULLCOLS
   "ID_PARTITION" INTEGER EXTERNAL "DECODE(:ID_PARTITION,671,2,1)",
   "ID_DATA" INTEGER EXTERNAL,
   "ID_VEHICLE" INTEGER EXTERNAL,
   "ID_DEVICE" INTEGER EXTERNAL,
   "DATE_PROCESS" "NULL",
   "DATE_WRITE" "SYSDATE",
   "DATE_RECEIVE" "TO_DATE(:DATE_RECEIVE, 'YYYYMMDDHH24MISS')",
   "DATE_EVENT" "TO_DATE(:DATE_EVENT, 'YYYYMMDDHH24MISS')",
   "DATA" CHAR(4000),
   "ID_TYPE_COMMUNICATION" INTEGER EXTERNAL,
   "EVENT" CHAR,
   "PACKET_LENGTH" INTEGER EXTERNAL,
   "IGNITION_EVENT" INTEGER EXTERNAL,
   "MESSAGE" CHAR(2000) "REPLACE(:MESSAGE,'!?!?','\"')",
   "DIRECTION" INTEGER EXTERNAL
INTO TABLE "DW"."T_DATA_PROCESS"
  FIELDS terminated by ',' enclosed by '"' TRAILING NULLCOLS
   "ID_PARTITION" POSITION(1) INTEGER EXTERNAL "DECODE(:ID_PARTITION,671,2,1)",
   "ID_DATA" INTEGER EXTERNAL,
   "ID_TYPE_PROCESS" "1"
INTO TABLE "DW"."T_DATA_PROCESS"
  FIELDS terminated by ',' enclosed by '"' TRAILING NULLCOLS
   "ID_PARTITION" POSITION(1) INTEGER EXTERNAL "DECODE(:ID_PARTITION,671,2,1)",
   "ID_DATA" INTEGER EXTERNAL,
   "ID_TYPE_PROCESS" "2"
  )I now need to change it a little to load records into "DW"."T_DATA_PROCESS" just when last field of the csv (the one I load into DIRECTION field of the "DW"."T_DATA_SUMMARY" table) is 1.
How should I build the WHEN clasue?
I tried WHEN (POSITION(15)="1") but it didn't work.
Thanks in advance!
Samuel

And did you tried this
WHEN (DIRECTION = '1')Best regards
Mohamed Houri

Similar Messages

  • 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 advance

    Try 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

  • 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

  • Multibyte character error in SqlLoader when utf8 file with chars like €Ää

    hello,
    posting from Germany, special charactes like german umlaute and euro sign in UTF8 Textfile, SqlLoader rejecting row with Multibyte character error
    Oracle Database 11g Release 11.2.0.2.0 - 64bit Production
    Database Characterset: WE8MSWIN1252
    OS: SLES 11 x86_64
    Testcase SqlDeveloper:
    CREATE TABLE utf8file_to_we8mswin1252 (
    ID NUMBER,
    text VARCHAR2(40 CHAR)
    can't enter euro symbol in this posting, end's in '€' (?)
    SELECT ascii(euro symbol) FROM dual;
    128
    SELECT chr(128) from dual;
    INSERT INTO utf8file_to_we8mswin1252 (ID, text) VALUES (1, '0987654321098765432109876543210987654321');
    INSERT INTO utf8file_to_we8mswin1252 (ID, text) VALUES (2, 'äüöäüöäüöäÄÖÜÄÖÜÄÖÜÄßßßßßßßßß߀€€€€€€€€€');
    INSERT INTO utf8file_to_we8mswin1252 (ID, text) VALUES (3, 'äüöäüöäüöäÄÖÜÄÖÜÄÖÜÄäüöäüöäüöäÄÖÜÄÖÜÄÖÜÄ');
    INSERT INTO utf8file_to_we8mswin1252 (ID, text) VALUES (4, 'ۧۧۧۧۧۧۧۧۧۧ1');
    INSERT INTO utf8file_to_we8mswin1252 (ID, text) VALUES (5, 'äüöäüöäüöäÄÖÜÄÖÜÄÖÜÄäüöäüöäüöä');
    INSERT INTO utf8file_to_we8mswin1252 (ID, text) VALUES (6, 'ßßßßßßßßß߀€€€€€€€€€1');
    INSERT INTO utf8file_to_we8mswin1252 (ID, text) VALUES (7, 'ßßßßßßßßß߀€€€€€€€€€äüöäüöäüöäÄÖÜÄÖÜÄÖÜÄ');
    commit;
    Select shows correct result, no character is wrong or missing!!!!
    put this in a UTF8 file without delimiter and enclosure like
    10987654321098765432109876543210987654321
    the SqlLoader controlfile:
    LOAD DATA characterset UTF8
    TRUNCATE                              
    INTO TABLE utf8file_to_we8mswin1252
    ID CHAR(1)     
    , TEXT CHAR(40)
    on a linux client machine, NOT the Oracle-Server
    export NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252
    sqlldr user/pwd@connectstring CONTROL=TEST01.ctl DATA=TEST01.dat LOG=TEST01.log
    Record 6: Rejected - Error on table UTF8FILE_TO_WE8MSWIN1252, column TEXT.
    Multibyte character error.
    Record 7: Rejected - Error on table UTF8FILE_TO_WE8MSWIN1252, column TEXT.
    Multibyte character error.
    Select shows missing characters in row 4 and 5, SqlLoader loads only the first 20 characters (maybe at random)
    and as shown above, row 6 and 7 never loaded
    Problem:
    can't load UTF8 Flatfiles with SqlLoader when german umlaute and special characters like euro symbol included.
    Any hint or help would be appreciated
    Regards
    Michael

    ## put this in a UTF8 file without delimiter and enclosure like
    The basic question is how you put the characters into the file. Most probably, you produced a WE8MSWIN1252 file and not an UTF8 file. To confirm, a look at the binary codes in the file would be necessary. Use a hex-mode-capable editor. If the file is WE8MSWIN1252, and not UTF8, then the SQL*Loader control file should be:
    LOAD DATA characterset WE8MSWIN1252
    TRUNCATE
    INTO TABLE utf8file_to_we8mswin1252
    ID CHAR(1)
    , TEXT CHAR(40)
    )-- Sergiusz

  • How to specify when clause in a database trigger

    I would like to create a database trigger that only fires on database create statements. In particular, it only needs to fire when tables with a specific prefix fire.
    I'd like to be able to specify something in the when clause along the lines of :
    CREATE OR REPLACE
    TRIGGER CAPTURE_STATS
         after CREATE ON rtrei.schema
         WHEN ( NEW.table_name like 'RT_FOO%' )
    begin
    add_stats_capture( :new.min_range, :new.max_range);
    end;
    It looks like I should be able to use a when as part of a database trigger, but I have no idea what new would be defined to be so that I could use it... perhaps it is an object and the clause would look something like
    when (new.objecttype = 'TABLE' and new.name like 'RT_FOO%')?
    Any ideas? I've searched through the docs, but have not been able to find anything relevant.
    thanks very much,
    Robin

    You can use the WHEN clause with DDL triggers. You can move Todd's IF-THEN clause up into the WHEN clause.
    See http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10795/adfns_ev.htm for all of the System-Defined Event Attributes.
    CREATE OR REPLACE TRIGGER capture_stats
    AFTER CREATE ON SCHEMA
    WHEN (ora_dict_obj_type = 'TABLE' AND ora_dict_obj_name LIKE 'RT_FOO%')
    BEGIN
            --Do whatever here.
    END capture_stats;

  • 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

  • When clause in SQL Loader

    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 advance

    Hi,
    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?

  • 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
    burt

    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

  • 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.

  • 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 --

  • 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 Searle

    Try to add key SILENT=DISCARDS to sqlldr command
    Silent means - Suppress messages during run (header,feedback,errors,discards,partitions)

  • 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

  • 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 problem

    The 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.

  • When Clause with FIELDS TERMINATED BY and TRAILING NULLCOLS option?

    Dear all
    If i have the following datafields:
    E;15;
    D;14;16;
    E;18;
    to load into table tab1 (Type_ligne VARCHAR2(1),
                                     Nombre1 NUMBER(2),
                                     Nombre2 NUMBER(2))
    Is it possible to have the following control file :
    LOAD DATA
    TRUNCATE
    INTO TABLE Tab1
    when (1) ='E'
    FIELDS TERMINATED BY ';' TRAILING NULLCOLS
    (Type_Ligne CHAR,
    Nombre1 INTEGER EXTERNAL)
    INTO TABLE Tab1
    when (1) ='D'
    FIELDS TERMINATED BY ';' TRAILING NULLCOLS
    (Type_Ligne  CHAR,
    Nombre1 INTEGER EXTERNAL,
    Nombre2 INTEGER EXTERNAL)
    If no! please show me the correct syntax.

    Yes, you can, but for each WHEN clause after the first one, you have to specify the starting position for the first field, as shown in bold below.
    LOAD DATA
    TRUNCATE
    INTO TABLE Tab1
    when (1) ='E'
    FIELDS TERMINATED BY ';' TRAILING NULLCOLS
    (Type_Ligne CHAR,
    Nombre1 INTEGER EXTERNAL)
    INTO TABLE Tab1
    when (1) ='D'
    FIELDS TERMINATED BY ';' TRAILING NULLCOLS
    (Type_Ligne  POSITION(1) CHAR,
    Nombre1 INTEGER EXTERNAL,
    Nombre2 INTEGER EXTERNAL)

Maybe you are looking for

  • How do I play all the tracks ?

    How do I play all the tracks in track view?  I did it once and am unable to do it again.  It only plays the 1 track I am working on and not the entire song.  I am using garage band on an iphone5

  • Essbase hangs on solaris

    Hi all, We installed System 9 in Dev Env. We are testing the installation by creating sample reports in webanalysis and FR.It worked fine when we craeted. later on when we are trying to create new reports from (DEMO -> basic) Essbase, the process han

  • Verizon rip off

    I have been with Verizon for 15 years. Att comes up with a great plan 160 per month. Verizon wants you to purchase all new phones at retail price to get this type of offer. do you not think this is a total let down to its current customers. Its bad e

  • Mac Help windows always on top

    Is there a way to turn off the Mac Help windows from always appearing on top of all other windows opened? I thought there was an option to turn this off somewhere but I can't remember where. I checked all my settings in Cocktail and System Preference

  • I have photoshop elements 9. what's the best to move the application to a new PC?

    I have photoshop element 9. I will be getting a new PC. Would a software migration tool like Laplink's PC Mover work? Or, is there a better way to move program and settings? I'll be going from Win 7 Ultimate 64 bit to Windows 8,1 if that matters. thx