SQL Loader reads Data file Sequentially or Randomly?

Will SQL Loader loads the data read from file Sequentially or Randomly?
I have the data file like the below
one
two
three
four
and my control file is
LOAD DATA
INFILE *
TRUNCATE
INTO TABLE T TRAILING NULLCOLS
x RECNUM,
y POSITION (1:4000)
so my table will be polulated like
X Y
1 one
2 Two
3 Three
4 Four
Will this happend sequentially even for the large data sets? say i have from one to one million datas in my data files.
Please clarify.
Thanks,
Rajesh.

SQL Loader may read the file sequentially, but you should not rely on the physical ordering of the rows in the table.
It looks like that's what you were hinting at.

Similar Messages

  • Sql loader maximum data file size..?

    Hi - I wrote sql loader script runs through shell script which will import data into table from CSV file. CSV file size is around 700MB. I am using Oracle 10g with Sun Solaris 5 environment.
    My question is, is there any maximum data file size. The following code from my shell script.
    SQLLDR=
    DB_USER=
    DB_PASS=
    DB_SID=
    controlFile=
    dataFile=
    logFileName=
    badFile=
    ${SQLLDR} userid=$DB_USER"/"$DB_PASS"@"$DB_SID \
              control=$controlFile \
              data=$dataFile \
              log=$logFileName \
              bad=$badFile \
              direct=true \
              silent=all \
              errors=5000Here is my control file code
    LOAD DATA
    APPEND
    INTO TABLE KEY_HISTORY_TBL
    WHEN OLD_KEY <> ''
    AND NEW_KEY <> ''
    FIELDS TERMINATED BY ','
    TRAILING NULLCOLS
            OLD_KEY "LTRIM(RTRIM(:OLD_KEY))",
            NEW_KEY "LTRIM(RTRIM(:NEW_KEY))",
            SYS_DATE "SYSTIMESTAMP",
            STATUS CONSTANT 'C'
    )Thanks,
    -Soma
    Edited by: user4587490 on Jun 15, 2011 10:17 AM
    Edited by: user4587490 on Jun 15, 2011 11:16 AM

    Hello Soma.
    How many records exist in your 700 MB CSV file? How many do you expect to process in 10 minutes? You may want to consider performing a set of simple unit tests with 1) 1 record, 2) 1,000 records, 3) 100 MB filesize, etc. to #1 validate that your shell script and control file syntax function as expected (including the writing of log files, etc.), and #2 gauge how long the processing will take for the full file.
    Hope this helps,
    Luke
    Please mark the answer as helpful or answered if it is so. If not, provide additional details.
    Always try to provide actual or sample statements and the full text of errors along with error code to help the forum members help you better.

  • SQL Loader - CSV Data file with carraige returns and line fields

    Hi,
    I have a CSV data file with occasional carraige returns and line feeds in between, which throws my SQL loader script off. Sql loader, takes the characters following the carraige return as a new record and gives me error. Is there a way I could handle carraige returns and linefeeds in SQL Loader.
    Please help. Thank you for your time.
    This is my Sql Loader script.
    load data
    infile 'D:\Documents and Settings\user1\My Documents\infile.csv' "str '\r\n'"
    append
    into table MYSCHEMA.TABLE1
    fields terminated by ','
    OPTIONALLY ENCLOSED BY '"'
    trailing nullcols
    ( NAME CHAR(4000),
    field2 FILLER,
    field3 FILLER,
    TEST DEPT CHAR(4000)
    )

    You can "regexp_replace" the columns for special characters

  • SQL Loader: Multiple data files to Multiple Tables

    How do you create one control file that refrences multiple data file and each file loads data in a different table.
    Eg.
    DataFile1 --> Table 1
    DataFile2 --> Table 2
    Contents and Structure of both data files are different. Data file is comma seperated.
    Below example is for 1 data file to 1 table. Need to modify this or create a wrapper that would call multiple control files.
    OPTIONS (SKIP=1)
    LOAD DATA
    INFILE DataFile1
    BADFILE DataFile1_bad.txt'
    DISCARDFILE DataFile1_dsc.txt'
    REPLACE
    INTO TABLE Table1
    FIELDS TERMINATED BY ","
    TRAILING NULLCOLS
    Col1,
    Col2,
    Col3,
    create_dttm sysdate,
    MySeq "myseq.nextval"
    Welcome any other suggestions.

    I was thinking if there is a way to indicate what file goes with what table (structure) in one control file.
    Example ( This does not work but wondering if something similar is allowed..)
    OPTIONS (SKIP=1)
    LOAD DATA
    INFILE DataFile1
    BADFILE DataFile1_bad.txt'
    DISCARDFILE DataFile1_dsc.txt'
    REPLACE
    INTO TABLE Table1
    FIELDS TERMINATED BY ","
    TRAILING NULLCOLS
    Col1,
    Col2,
    Col3,
    create_dttm sysdate,
    MySeq "myseq.nextval"
    INFILE DataFile2
    BADFILE DataFile2_bad.txt'
    DISCARDFILE DataFile2_dsc.txt'
    REPLACE
    INTO TABLE "T2"
    FIELDS TERMINATED BY ","
    TRAILING NULLCOLS
    T2Col1,
    T2Col2,
    T2Col3
    )

  • How to load unicode data files with fixed records lengths?

    Hi!
    To load unicode data files with fixed records lengths (in terms of charachters and not of bytes!) using SQL*Loader manually, I found two ways:
    Alternative 1: one record per row
    SQL*Loader control file example (without POSITION, since POSITION always refers to bytes!)<br>
    LOAD DATA
    CHARACTERSET UTF8
    LENGTH SEMANTICS CHAR
    INFILE unicode.dat
    INTO TABLE STG_UNICODE
    TRUNCATE
    A CHAR(2) ,
    B CHAR(6) ,
    C CHAR(2) ,
    D CHAR(1) ,
    E CHAR(4)
    ) Datafile:
    001111112234444
    01NormalDExZWEI
    02ÄÜÖßêÊûÛxöööö
    03ÄÜÖßêÊûÛxöööö
    04üüüüüüÖÄxµôÔµ Alternative2: variable length records
    LOAD DATA
    CHARACTERSET UTF8
    LENGTH SEMANTICS CHAR
    INFILE unicode_var.dat "VAR 4"
    INTO TABLE STG_UNICODE
    TRUNCATE
    A CHAR(2) ,
    B CHAR(6) ,
    C CHAR(2) ,
    D CHAR(1) ,
    E CHAR(4)
    ) Datafile:
    001501NormalDExZWEI002702ÄÜÖßêÊûÛxöööö002604üuüüüüÖÄxµôÔµ Problems
    Implementing these two alternatives in OWB, I encounter the following problems:
    * How to specify LENGTH SEMANTICS CHAR?
    * How to suppress the POSITION definition?
    * How to define a flat file with variable length and how to specify the number of bytes containing the length definition?
    Or is there another way that can be implemented using OWB?
    Any help is appreciated!
    Thanks,
    Carsten.

    Hi Carsten
    If you need to support the LENGTH SEMANTICS CHAR clause in an external table then one option is to use the unbound external table and capture the access parameters manually. To create an unbound external table you can skip the selection of a base file in the external table wizard. Then when the external table is edited you will get an Access Parameters tab where you can define the parameters. In 11gR2 the File to Oracle external table can also add this clause via an option.
    Cheers
    David

  • How to read .dat files that are hidden?

    Is it possible to read .dat files that are set to hidden? 'cause what i did was i created a .dat file and set its attributes to hidden and my Read file code cannot read hidden files.
    here's my Read file code:
    Scanner read=new Scanner(FileReader("C:\password.dat"));
    and another thing, how do you Write a .dat file that is hidden too? 'cause my password.dat file needs to be updated.
    here's my Write file code:
    PrintWriter write=new PrintWriter("C:\password.dat");
    thank for the help.

    There should not be any problems opening up hidden files. Your problem is probably elsewhere (for example, you didn't escape the backslash, so what you posted is not your code).

  • SQL Loader - read 1st line to one table, rest of data to another

    Hi
    I looked around the FAQs and forums and find similar cases but not mine...
    I am running Oracle 9i and have a text file which has the 1st line as a control header and everything beneath it as data, something like this:
    14/07/2010|8
    12345678|0
    12345679|0
    12345680|10.87
    12345681|7655.8
    12345682|100
    12345683|0
    12345684|-90.44
    12345685|0
    The first (header) line has a date field and a counter (the number of records expected beneath it)
    The rest of the data is an account number and balance.
    Since SQL Loader is invoked outside of Oracle (Unix in my case) I assume I should create two tables, such as:
    Create table
    TIF_CURRENT_BALANCE_DTL
      ACCOUNT_REF_NO   VARCHAR2(30),  
      BALANCE_AMT      NUMBER(12,2)         
    Create table
    TIF_CURRENT_BALANCE_HDR
      HDR_DATE         DATE,  
      HDR_COUNT        NUMBER(10)
    );And use a control file which will load line 1 to TIF_CURRENT_BALANCE_HDR and other lines (SKIP=1) to TIF_CURRENT_BALANCE_DTL.
    Since the header/detail lines are not (necessarily) distinguishable, is there a way to achieve this, without modifying the input file in anyway?
    Thanks
    Martin

    Thanks for your reply - the solution should not be OS dependant as it will run on a Linux and UNIX installation.
    The DB will be (for now) Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    I looked at that web page you provided and had some hope with the ROWS option, but this is the number of rows to load before each commit.
    Any other solutions?
    I know I could load it to a common table (text and number) and then convert the values accordingly in the PL/SQL procedure which will run afterwards, but I feel loading the data in the final format is going to be faster.
    I am considering using SQL Load to load records (SKIPping row 1) into the DTL table and within the PL.SQL loading the 1st record and performing validation. Since the file has approx 2million rows and is processed daily, 1.99999 million records read with SQL Loader and 1 with conventional methods will still be a vast improvement!
    Thanks

  • SQL Loader deletes data, after reporting a file not found error

    I have several control files beginning:
    LOAD DATA
    INFILE <dataFile>
    REPLACE INTO TABLE <tableName>
    FIELDS TERMINATED BY '<separator>'
    When running SQL Loader, in the case of one particular control file, if the file referenced does not exist, SQL Loader first reports that the file could not be found, but then proceeds to delete all the data in the table in which the import was meant to take place. The corresponding log file reveals that the file could not be found, but also states that 0 records were loaded and 0 records were skipped.
    In the case of all other control files, if the file is not found, the log files simply report this exception but do not show any statisitcs about the number of records loaded/skipped nor does SQL Loader delete the data in any of the referenced tables. This is obviously the expected behaviour.
    Why is SQL Loader deleting the data referenced by one particular control file, even though this file does not exist and the corresponding log file has correctly picked up on this?

    in the ressource name box of your file model, when you push the search button ("...") do you see the file ?
    Cause the problem can occur when you write directly the path without selectionning the file with the assistant.
    Try this.
    I think too that that you can't see the data by right clicking and selectionning View Data ?
    Let me know the avancement...

  • SQL Loader and control file

    I know I've done this before but, I don't use SQL Loader often and I'm having issues getting a file to load.
    The table has 6 columns in it - one of which is a timestamp.
    I was having issues loading it initially with date format issues. I ruled out any issues with the timestamp format by simply loading a dummy table with some timestamp based data and had no issue.
    So - I think the issue is around the fact that the table I'm loading's first column being a value I'm attempting to default with a sequence when loading and - that I'm screwing up something there.
    Table is as such:
    CREATE TABLE ACS_IPS
        (seq_ips NUMBER,
        col2   VARCHAR2(100),
        col3  VARCHAR2(100),
        col4    VARCHAR2(100),
        col5 TIMESTAMP,
        col6    VARCHAR2(100),
        col7    VARCHAR2(100),
        col8 DATE  DEFAULT SYSDATE NOT NULL,
        col9 VARCHAR2(30) DEFAULT USER);The control file is:
    load data
    truncate
    into table acs_ips
    fields terminated by ","
    trailing nullcols
        seq_ips "seq_ips.nextval",
        col2,
        col3,
        col4,
        col5 TIMESTAMP "YYYY-MM-DD HH24:MI:SS.FF9",
        col6,
        col7
        )The sequence column isn't in the file being loaded... and - there are additional columns that are defaulted on the table that aren't in the control file.
    Any help is appreciated... The error I'm getting is:
    Rejected - Error on table CAMS.ACS_IPS, column ACTION_START.
    ORA-01841: (full) year must be between -4713 and +9999, and not be 0

    Yeah - not sure that clears it up...
    The sequence in my table is the first column - and - I think that's the problem... the sequence is being loaded as the first column in the control file but - it's not in the file being loaded so - it's skewing (again - I think??) the data being read in - which is why I'm getting the timestamp issues on the one column (it's actually reading the next column in the file vs. the actual timestamp one).
    If that's the issue - I'm not sure how to avoid it without restructuring the table to stick the sequence physically at the end. I'm certain that's not necessary and - I'm overlooking something that's otherwise simple but evading me.

  • SQL*Loader and multiple files

    Hello, am tasked with loading tables with 21+ million rows. Will SQL*Loader perform better with one large file or many smaller files? Is there any ideal file size for optimal performance? Thank you
    David

    Don, when I tried to loada 21M row table using direct, I get the following messages:
    Record 2373: Rejected - Error on table STAGE_CUSTOMER.
    ORA-03113: end-of-file on communication channel
    SQL*Loader-926: OCI error while uldlfca:OCIDirPathColArrayLoadStream for table STAGE_CUSTOMER
    SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
    SQL*Loader-925: Error while uldlgs: OCIStmtExecute (ptc_hp)
    ORA-03114: not connected to ORACLE
    SQL*Loader-925: Error while uldlgs: OCIStmtFetch (ptc_hp)
    ORA-24338: statement handle not executed
    Here is the SQL*Loader log:
    SQL*Loader: Release 9.2.0.1.0 - Production on Thu Apr 26 15:38:29 2007
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Control File: stage_customer.ctl
    Character Set UTF8 specified for all input.
    First primary datafile stage_Customer_20070301.csv has a
    utf8 byte order mark in it.
    Data File: stage_Customer_20070301.csv
    Bad File: stage_Customer_20070301.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 1000
    Continuation: none specified
    Path used: Direct
    Silent options: FEEDBACK
    Table STAGE_CUSTOMER, 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
    ROW_ID SEQUENCE (MAX, 1)
    CUSTOMER_ACCT_NUM FIRST * , O(") CHARACTER
    IS_DELETED NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:Is_Deleted) IN ('FALSE','0') THEN 0 ELSE 1 END"
    NAME_PREFIX NEXT * , O(") CHARACTER
    FIRST_NAME NEXT * , O(") CHARACTER
    MIDDLE_NAME NEXT * , O(") CHARACTER
    LAST_NAME NEXT * , O(") CHARACTER
    NAME_SUFFIX NEXT * , O(") CHARACTER
    NICK_NAME NEXT * , O(") CHARACTER
    ALT_FIRST_NAME NEXT * , O(") CHARACTER
    ALT_LAST_NAME NEXT * , O(") CHARACTER
    MARKETING_SOURCE_ID NEXT * , O(") CHARACTER
    HOME_PHONE NEXT * , O(") CHARACTER
    WORK_PHONE NEXT * , O(") CHARACTER
    MOBILE_PHONE NEXT * , O(") CHARACTER
    ALTERNATE_PHONE NEXT * , O(") CHARACTER
    EMAIL_ADDR NEXT * , O(") CHARACTER
    ALT_EMAIL_ADDR NEXT * , O(") CHARACTER
    BIRTH_DATE NEXT * , O(") CHARACTER
    SQL string for column : "TRUNC(TO_DATE(:Birth_Date, 'MM/DD/YYYY HH24:MI:SS'))"
    SALES_CHANNEL_ID NEXT * , O(") CHARACTER
    SQL string for column : "decode(:Sales_Channel_id,NULL,NULL,NULL)"
    ASSOCIATE_NUMBER NEXT * , O(") CHARACTER
    ALT_ASSOCIATE_NUMBER NEXT * , O(") CHARACTER
    UPDATE_LOCATION_CD NEXT * , O(") CHARACTER
    UPDATE_DATE NEXT * , O(") CHARACTER
    SQL string for column : "TRUNC(TO_DATE(:Update_Date, 'MM/DD/YYYY HH24:MI:SS'))"
    CUSTOMER_LOGIN_NAME NEXT * , O(") CHARACTER
    DISCOUNT_CD NEXT * , O(") CHARACTER
    DISCOUNT_PERCENT NEXT * , O(") CHARACTER
    BUSINESS_NAME NEXT * , O(") CHARACTER
    POS_TAX_FLAG NEXT * , O(") CHARACTER
    POS_TAX_PROMPT NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:POS_TAX_PROMPT) IN ('FALSE','0') THEN 0 ELSE 1 END"
    POS_DEFAULT_TAX_ID NEXT * , O(") CHARACTER
    POS_TAX_ID_EXPIRATION_DATE NEXT * , O(") CHARACTER
    POS_AUTHORIZED_USER_FLAG NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:POS_AUTHORIZED_USER_FLAG) IN ('FALSE','0') THEN 0 ELSE 1 END"
    POS_ALLOW_PURCHASE_ORDER_FLAG NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:POS_ALLOW_PURCHASE_ORDER_FLAG) IN ('FALSE','0') THEN 0 ELSE 1 END"
    ADDRESS1 NEXT * , O(") CHARACTER
    ADDRESS2 NEXT * , O(") CHARACTER
    ADDRESS3 NEXT * , O(") CHARACTER
    CITY NEXT * , O(") CHARACTER
    STATE_CD NEXT * , O(") CHARACTER
    POSTAL_CD NEXT * , O(") CHARACTER
    COUNTRY_CD NEXT * , O(") CHARACTER
    ALLOW_UPDATE NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:ALLOW_UPDATE) IN ('FALSE','0') THEN 0 ELSE 1 END"
    ACTION_CODE NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:action_code) IN ('FALSE','0') THEN 0 ELSE 1 END"
    ACCOUNT_TYPE_ID NEXT * , O(") CHARACTER
    LOCALE_CD NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN :Locale_CD IS NOT NULL AND :Locale_CD LIKE '__-__' THEN :Locale_CD ELSE 'en-US' END"
    IS_READY_FOR_PROCESSING CONSTANT
    Value is '1'
    IS_BUSINESS CONSTANT
    Value is '0'
    HAD_ERRORS CONSTANT
    Value is '0'
    Record 2373: Rejected - Error on table STAGE_CUSTOMER.
    ORA-03113: end-of-file on communication channel
    SQL*Loader-926: OCI error while uldlfca:OCIDirPathColArrayLoadStream for table STAGE_CUSTOMER
    SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
    SQL*Loader-925: Error while uldlgs: OCIStmtExecute (ptc_hp)
    ORA-03114: not connected to ORACLE
    SQL*Loader-925: Error while uldlgs: OCIStmtFetch (ptc_hp)
    ORA-24338: statement handle not executed
    Table STAGE_CUSTOMER:
    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.
    Bind array size not used in direct path.
    Column array rows : 5000
    Stream buffer bytes: 256000
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 3469
    Total logical records rejected: 1
    Total logical records discarded: 0
    Direct path multithreading optimization is disabled
    Run began on Thu Apr 26 15:38:29 2007
    Run ended on Thu Apr 26 15:38:30 2007
    Elapsed time was: 00:00:01.18
    CPU time was: 00:00:00.32

  • Problem import csv file with SQL*loader and control file

    I have a *csv file looking like this:
    E0100070;EKKJ 1X10/10 1 KV;1;2003-06-16;01C;75
    E0100075;EKKJ 1X10/10 1 KV;500;2003-06-16;01C;67
    E0100440;EKKJ 2X2,5/2,5 1 KV;1;2003-06-16;01C;37,2
    E0100445;EKKJ 2X2,5/2,5 1 KV;500;2003-06-16;01C;33,2
    E0100450;EKKJ 2X4/4 1 KV;1;2003-06-16;01C;53
    E0100455;EKKJ 2X4/4 1 KV;500;2003-06-16;01C;47,1
    I want to import this csv file to this table:
    create table artikel (artnr varchar2(10), namn varchar2(25), fp_storlek number, datum date, mtrlid varchar2(5), pris number);
    My controlfile looks like this:
    LOAD DATA
    INFILE 'e:\test.csv'
    INSERT
    INTO TABLE ARTIKEL
    FIELDS TERMINATED BY ';'
    TRAILING NULLCOLS
    (ARTNR, NAMN, FP_STORLEK char "to_number(:fp_storlek,'99999')", DATUM date 'yyyy-mm-dd', MTRLID, pris char "to_number(:pris,'999999D99')")
    I cant get sql*loader to import the last column(pris) as I want. It ignore my decimal point which in this case is "," and not "." maybe this is the problem. If the decimal point is the problem how can I get oracle to recognize "," as a decimal point??
    the result from the import now, is that a decimal number (37,2) becomes 372 in the table

    Set NLS_NUMERIC_CHARACTERS environment variable at OS level, before running SqlLoader :
    $ cat test.csv
    E0100070;EKKJ 1X10/10 1 KV;1;2003-06-16;01C;75
    E0100075;EKKJ 1X10/10 1 KV;500;2003-06-16;01C;67
    E0100440;EKKJ 2X2,5/2,5 1 KV;1;2003-06-16;01C;37,2
    E0100445;EKKJ 2X2,5/2,5 1 KV;500;2003-06-16;01C;33,2
    E0100450;EKKJ 2X4/4 1 KV;1;2003-06-16;01C;53
    E0100455;EKKJ 2X4/4 1 KV;500;2003-06-16;01C;47,1
    $ cat artikel.ctl
    LOAD DATA
    INFILE 'test.csv'
    replace
    INTO TABLE ARTIKEL
    FIELDS TERMINATED BY ';'
    TRAILING NULLCOLS
    (ARTNR, NAMN, FP_STORLEK char "to_number(:fp_storlek,'99999')", DATUM date 'yyyy-mm-dd', MTRLID, pris char "to_number(:pris,'999999D99')")
    $ sqlldr scott/tiger control=artikel
    SQL*Loader: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:01 2005
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Commit point reached - logical record count 6
    $ sqlplus scott/tiger
    SQL*Plus: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:11 2005
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select * from artikel;
    ARTNR      NAMN                      FP_STORLEK DATUM      MTRLI       PRIS
    E0100070   EKKJ 1X10/10 1 KV                  1 16/06/2003 01C           75
    E0100075   EKKJ 1X10/10 1 KV                500 16/06/2003 01C           67
    E0100440   EKKJ 2X2,5/2,5 1 KV                1 16/06/2003 01C          372
    E0100445   EKKJ 2X2,5/2,5 1 KV              500 16/06/2003 01C          332
    E0100450   EKKJ 2X4/4 1 KV                    1 16/06/2003 01C           53
    E0100455   EKKJ 2X4/4 1 KV                  500 16/06/2003 01C          471
    6 rows selected.
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    $ export NLS_NUMERIC_CHARACTERS=',.'
    $ sqlldr scott/tiger control=artikel
    SQL*Loader: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:41 2005
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Commit point reached - logical record count 6
    $ sqlplus scott/tiger
    SQL*Plus: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:45 2005
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select * from artikel;
    ARTNR      NAMN                      FP_STORLEK DATUM      MTRLI       PRIS
    E0100070   EKKJ 1X10/10 1 KV                  1 16/06/2003 01C           75
    E0100075   EKKJ 1X10/10 1 KV                500 16/06/2003 01C           67
    E0100440   EKKJ 2X2,5/2,5 1 KV                1 16/06/2003 01C         37,2
    E0100445   EKKJ 2X2,5/2,5 1 KV              500 16/06/2003 01C         33,2
    E0100450   EKKJ 2X4/4 1 KV                    1 16/06/2003 01C           53
    E0100455   EKKJ 2X4/4 1 KV                  500 16/06/2003 01C         47,1
    6 rows selected.
    SQL>                                                                            Control file is exactly as yours, I just put replace instead of insert.

  • SQL Loader - Conditional Data Loading

    Hello Friends,
    I am trying to use SQL Loader to load the following records in to the Emp table (columns being - empno, ename, job, mgr, hiredate, sal, comm, deptno ).
    7876,ADAMS,CLERK,7788,"23-MAY-87",1100,,20
    7900,JAMES,CLERK,7698,"03-DEC-81",950,,30
    7902,FORD,ANALYST,7566,"03-DEC-81",3000,,20
    7934,MILLER,CLERK,7782,"23-JAN-82",1300,,10
    I want to put a condition that the data should be loaded only when the 5th field in the record (i.e, the Hiredate field) should be greater than "01-JAN-82". So with this condition, the only records to be loaded are the 1st, and the 4th one... the other two records have the hiredates being less than "01-JAN-82".
    load data
    infile 'c:\mydata.csv'
    into table emp1
    when .....
    fields terminated by "," optionally enclosed by '"'          
    ( empno, ename, job, mgr, hiredate, sal, comm, deptno )
    I am unable to put the when condition in the control file above and would be grateful if you kindly can give me some pointer as to how to achieve this.
    Thanks and Regards.
    Edited by: user645883 on Dec 29, 2008 12:45 AM

    Hello Friends,
    Thanks for your replies.
    The examples only show the when clauses where we can only use "=" or "<>" in the clause. I am trying to see if we can use ">=" or "<=" in the when clause to load the conditional data. Also trying to find out if date fields can be compared in the when clause. I am unable to do so till now and it throws syntax errors everytime
    I am able to test the when with string literals and with "=" and "<>" conditions though.
    Please help.
    Thanks & Regards.

  • SQL Loader: ignore data field

    Hi,
    in a SQL Loader control file, how do you specify that you do not wish to load a particular field?
    E.g. if I wanted to ignore the second field in the data file and load the first and third fields into a table, how would I modify the control file below?
    Thanks.
    load data
    infile 'example.dat'
    into table example
    fields terminated by ',' optionally enclosed by '"'
    col1 char,
    ignore char,
    col2 char
    )

    User FILLER keyword:
    col1 char,
    ignore filler char,
    col2 char
    )

  • SQL Loader with date formatting

    Hi,
    I'm trying to get sql loader to insert a date into a column. After much browsing, reading trial and error I still get an array of errors.
    I'm using oracle XE
    my control file looks like this
    LOAD DATA
    INFILE 'posmeters/meters.csv'
    INTO TABLE position_meters
    FIELDS terminated by ","
    ID CONSTANT '0',
    POSITION_ID,
    DATETIME DATE "DD/MM/YYYY HH24:MI:SS",
    CASH_IN,
    CASH_OUT,
    NOTES_IN,
    CHANGE_OUT,
    WINNINGS,
    VTP,
    REFILL,
    TOKEN_IN,
    TOKEN_OUT,
    ELEC_PAY,
    ELEC_CREDIT,
    REMOTE_PAY,
    REMOTE_CREDIT,
    INSERT_TS EXPRESSION "TO_CHAR(SYSDATE, 'DD/MM/YYYY HH24:MI:SS')",
    FIFTY_PND,
    TWENTY_PND,
    TEN_PND,
    FIVE_PND,
    TWO_PND,
    ONE_PND,
    FIFTY_P,
    TWENTY_P,
    TEN_P,
    FIVE_P
    It is the DATETIME field which gives me grief. I have a test data file that looks like this
    0,1010,29/09/2011 10:23:24,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24
    and my table is defined as follows
    ID NUMBER NOT NULL,
    POSITION_ID NUMBER,
    DATETIME TIMESTAMP(6) DEFAULT localTIMESTAMP NOT NULL,
    CASH_IN NUMBER,
    CASH_OUT NUMBER,
    NOTES_IN NUMBER,
    CHANGE_OUT NUMBER,
    WINNINGS NUMBER,
    VTP NUMBER,
    REFILL NUMBER,
    TOKEN_IN NUMBER DEFAULT (0) NOT NULL,
    TOKEN_OUT NUMBER DEFAULT (0) NOT NULL,
    ELEC_PAY NUMBER DEFAULT (0) NOT NULL,
    ELEC_CREDIT NUMBER DEFAULT (0) NOT NULL,
    REMOTE_PAY NUMBER DEFAULT (0) NOT NULL,
    REMOTE_CREDIT NUMBER DEFAULT (0) NOT NULL,
    INSERT_TS TIMESTAMP(6) DEFAULT (localtimestamp) NOT NULL,
    FIFTY_PND NUMBER DEFAULT 0,
    TWENTY_PND NUMBER DEFAULT 0,
    TEN_PND NUMBER DEFAULT 0,
    FIVE_PND NUMBER DEFAULT 0,
    TWO_PND NUMBER DEFAULT 0,
    ONE_PND NUMBER DEFAULT 0,
    FIFTY_P NUMBER DEFAULT 0,
    TWENTY_P NUMBER DEFAULT 0,
    TEN_P NUMBER DEFAULT 0,
    FIVE_P NUMBER DEFAULT 0
    I have tried defining the control file with
    DATETIME DATE "DD/MM/YYYY HH24:MI:SS",
    DATETIME EXPRESSION "TO_DATE(:DATETIME, 'DD/MM/YYYY HH24:MI:SS')",
    DATETIME EXPRESSION "TO_TIMESTAMP(:DATETIME, 'DD/MM/YYYY HH24:MI:SS')",
    I get errors such as
    Record 1: Rejected - Error on table "SITE_MAIN"."POSITION_METERS", column DATETIME.
    ORA-01861: literal does not match format string
    SQL*Loader-291: Invalid bind variable DATETIME in SQL string for column DATETIME.
    any help would greatfully appreciated.

    It seems that the problem was caused by the constant at the beginning of the record and had nothing to do with date formats.
    My control file now looks like this
    LOAD DATA
    INFILE 'posmeters/meters.csv'
    APPEND INTO TABLE position_meters
    FIELDS terminated by ","
    POSITION_ID          ,
    DATETIME      date "DD/MM/YYYY HH24:MI:SS",
    CASH_IN          ,
    CASH_OUT          ,
    NOTES_IN          ,
    CHANGE_OUT          ,
    WINNINGS          ,
    VTP               ,
    REFILL          ,
    TOKEN_IN          ,
    TOKEN_OUT          ,
    ELEC_PAY          ,
    ELEC_CREDIT          ,
    REMOTE_PAY          ,
    REMOTE_CREDIT     ,
    INSERT_TS      "TO_TIMESTAMP(SYSDATE, 'DD/MM/YYYY HH24:MI:SS')",
    FIFTY_PND          ,
    TWENTY_PND          ,
    TEN_PND          ,
    FIVE_PND          ,
    TWO_PND          ,
    ONE_PND          ,
    FIFTY_P          ,
    TWENTY_P          ,
    TEN_P          ,
    FIVE_P          
    all is good :o)

  • Re: Can SQL Loader read newline chars - multiline column?

    I have a scenario where the data file has values separated by ^.While loading this data into the table using sql loader I want to convert it into multiple lines.eg:
    data file:
    1|1013 park ridge~12345~irving|
    2|2013 park ridge~12345~irving|
    3|1013 park ridge|
    while loading it into table i want the data like
        ID ADDRESS
    1 "1013 hidden ridge
    12345
    irving"
    2 "2013 hidden ridge
    12345
    irving"
    22 "22013 hidden ridge
    12345
    irving"
    1 1013 hidden ridge
    My control file says:
    load data
    infile "/usr2/home2/adistest/h91ftp/temp/owb_test/owb_test1.csv"
    preserve blanks INTO TABLE owbrep.owb_test1
    TRUNCATE
    fields terminated by '|' TRAILING NULLCOLS
       id,
       address
    Please suggest what should I do?

    You can use the REPLACE function in your control file to replace whatever character, like ~ in your sample data, is where the newline should be with whatever your newline is on your system, like chr(10) as in the example below.
    SCOTT@orcl12c_11gR2> host type owb_test1.csv
    1|1013 park ridge~12345~irving|
    2|2013 park ridge~12345~irving|
    3|1013 park ridge|
    SCOTT@orcl12c_11gR2> host type test.ctl
    load data
    infile "owb_test1.csv"
    preserve blanks INTO TABLE owb_test1
    TRUNCATE
    fields terminated by '|' TRAILING NULLCOLS
    id,
    address "REPLACE (:address, '~', CHR(10))"
    SCOTT@orcl12c_11gR2> create table owb_test1
      2    (id       number,
      3     address  varchar2(60))
      4  /
    Table created.
    SCOTT@orcl12c_11gR2> host sqlldr scott/tiger control=test.ctl log=test.log
    SQL*Loader: Release 12.1.0.1.0 - Production on Mon Aug 12 10:17:45 2013
    Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.
    Path used:      Conventional
    Commit point reached - logical record count 3
    Table OWB_TEST1:
      3 Rows successfully loaded.
    Check the log file:
      test.log
    for more information about the load.
    SCOTT@orcl12c_11gR2> select * from owb_test1
      2  /
            ID ADDRESS
             1 1013 park ridge
               12345
               irving
             2 2013 park ridge
               12345
               irving
             3 1013 park ridge
    3 rows selected.

Maybe you are looking for

  • Oracle 9i on HP-UX 11

    Currently using an 32 bit Brio reporting app on a HP-UX11 machine which connects to a repository in Oracle on the same machine. We just upgraded from 8.1 to 9.2.0.6 and can no longer connect to Oracle with this app. I get the following error: /usr/li

  • How to create Chart within a web page NOT as seperate page?

    Hi, I am using JCharts and am trying to figure out how (or if it is even possible) to create a chart and then place it in a web page. All the examples I've seen show you how to create a JPEG of the chart and then link to this image from your web page

  • Problem using string to store evt.target.data and apply property filters

    I have about 9 buttons on my stage and I want to write code for the rollover and rollout effects, I only want to write the code once so I am trying to pass the button info into a string via evt.target.data and it pass the info properly into my string

  • Custom XSLT for Biztalk Maps

    Hi, I have a input xml file and the output xml file. The input message is multi-part message. I have to create a custom xslt to convert input xml to output xml. The xslt should give an xml output. I have an another xslt to take this output as input a

  • MSI p7n Platinum and E2160 Overclock

    This is my first build and I'm trying to get my CPU overclocked to 3.0ghz.  I've read that the e2160 is capable of 3.0Ghz with stock cooling and voltages. I cannot get mine higher then 2.4 Ghz. I am new so haven't tried anything other then changing t