How to use SQL*LOADER to read data in |SMITH|ALFRED| format

the data I need to upload to table using SQL*LOADER is in format as below:
|AD |Argentina  |
|CN |China       |
|US |America            |
|GB |England        |so how should I write my control file to read the data into two columns table?
I googled and people say that use Enclosed fields—delimiter (|), and I tried with below, but not working:
LOAD DATA
INFILE *
insert
INTO TABLE tmp_country_mapping
FIELDS ENCLOSED BY '|'
(country_id, country_name)
BEGINDATA
|AD |Argentina  |
|CN |China       |
|US |America            |
|GB |England        |Anyone could help?
BTW, I don`t want the spaces behind the value of the second column.
Thanks
Edited by: PhoenixBai on Dec 28, 2010 2:50 PM

Problem solved, by removing the NLS_LANG=ENGLISH.
>
before the load, data is as below:
|AD |安道尔共和国         |
|AE |阿联酋            |
|AF |阿富汗            |
|AG |安提瓜和巴布达        |
|AI |安圭拉岛           |
|AL |阿尔巴尼亚          |after the load, data displays as below:
AD      °2μà??12oí1ú
AE      °¢áa??
AF      °¢??o1
AG      °2ìá1?oí°í2?′?
AI      °21?à-μo
AL      °¢??°í?á??And my database supports Chinese words and it displays correctly for other tables, except this one.
What could be the problem?
>
Edited by: PhoenixBai on Dec 28, 2010 5:05 PM

Similar Messages

  • How to use Sql Loader in Unix Environmant

    Hi All,
    Can anyone explain me please how to use sql Loader in unix environment.
    Actually i have one control file i want to run that file in Unix how can i achive please explain me
    Thank's

    Hi Kuljeet,
    Thank you for your replay
    I just put my control file into the Unix Environmant that's fime
    and when i trying to entering the following cmd in Unix environment i am getting this error
    sqlldr username/password@string control='unix_pathname'i am not sure about the path name my question is
    1) Do i need to give the Local file Path Or Unix Path
    This is  the error in Sql Loader:
    SQL*Loader: Release 10.2.0.4.0 - Production on Mon Sep 24 13:14:23 2012
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    SQL*Loader-500: Unable to open file (/bx167a/riskbatch/rdwdbat/sample_upl.upl)
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    Could you please correct me
    Thank's

  • How to use SQL*loader in oracle9i???

    Hi,
    I have installed oracle9i, and want to use sql*loader to load text data into table.
    However, I can not find a tool called SQL*loader anywhere on the manu.
    It will be appreciated if some experts can give me an advice where I can find it, and how to use it to load text data.
    Thanks.
    Chuck

    When I go to tahiti.oracle.com and search on "external table", I get dozens of hits that explain how to create an external table and give numerous examples. If you have specific questions, I'd be happy to try to go into more detail. A generic SQL*Loader guide, however, would be well bayond the scope of this forum.
    http://otn.oracle.com/pls/db92/db92.drilldown?remark=&word=external+table&book=&preference=
    Justin

  • How to use SQL loader with DBF fixed format record

    Hi everybody!
    My situation is that: I want to use SQL loader with Foxpro DBF format, it similar to case 2 study (Fixed format record) but DBF file has header, how can I tell SQL loader skip header.
    Thank you in advance

    Another option is to apply SQL operators to fields
    LOAD DATA
       INFILE *
       APPEND
    INTO TABLE emp
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' (
       empno,
       ename,
       job,
       mgr,
       hiredate DATE(20) "DD-Month-YYYY",
       sal,
       comm,
       deptno CHAR TERMINATED BY ':',
       projno,
    loadseq "my_seq.nextval")This is a modified control file of Case Study 3 which originally demonstrated the use of the Sequence parameter

  • Help Required -- Can we use SQL Query to READ data from SAP MDM Tables

    Hi All,
    Please help.........
    Can we use SQL Query to READ(No Creation/Updation/Deletion  just Read) Data from SAP MDM tables directly, without using MDM Syndicator.
    Or direct SQL access to SAP MDM tables is not possible. Only through MDM Syndicator can we export data.
    Thanks in Advance
    Regards

    All the tables you create in Repository comes under A2i_CM_Tables in Database named as your repository name. So the tables names are fields of table A2i_CM_Tables. Now i tried it but cant make it.
    Now, I dont think its possible to extract all fields in tables and there values using select query. May be pure sql guy can do that or not.
    But there is no relation of data extraction and syndicator. Data is viewed in Data Manager. and you can also store data in a file from DM also.
    BR,
    Alok

  • Using SQL Loader to insert data based on conditionally statements

    I would like to use sql loader to insert records from a single text file into an Oracle database table. Sounds easy but the problem is that I need to check the existence of data in another table (Table A) before data can be loaded into Table B.
    Table A has two columns: dept_no (primary key value) and dept_name (char)
    Table B has five columns: emp_no (primary key value), dept_no (foreign key value to Table A), employee (char), job_title (char) and salary (number)
    Text File looks like this:
    Finance Jones President 10000
    HR Smith Admin 2000
    HelpDesk Jenkins Technician 3000
    Problem:
    1. I need sql loader to insert records into Table B by first checking if the first field in the file is in Table A.
    2. If value exists get it's dept_no value.
    3. If value doesn't exist discard record ( I might want to have sql loader insert a new record for this into Table A)
    4. Using value from #2, insert the value in Table B for dept_no column.
    5. Also assign a sequence value for the emp_no value in Table B.
    Any guidance is greatly appreciated.
    Thanks,

    Hello,
    I am not sure this is possible with SQL loader. I would rather use an external table based on your file.
    Then, I would use SQL to load your data into your table, based on your conditions.
    Your request is not very complicated, writing the SQL to do that will be really more simple than trying to do it with SQL loader.
    Hope it will help.
    Regards,
    Sylvie

  • How to use sql loader with sequence?

    Hi,
    I have create a sequence and I would like to use when I am using sql loader when import some data into table.
    Please give me some idea.
    Thanks

    Another option is to apply SQL operators to fields
    LOAD DATA
       INFILE *
       APPEND
    INTO TABLE emp
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' (
       empno,
       ename,
       job,
       mgr,
       hiredate DATE(20) "DD-Month-YYYY",
       sal,
       comm,
       deptno CHAR TERMINATED BY ':',
       projno,
    loadseq "my_seq.nextval")This is a modified control file of Case Study 3 which originally demonstrated the use of the Sequence parameter

  • How to use SQL*Loader to load XMLType Column with other columns?

    Hi,
    I am trying to use sqlldr to load an XML file into a table with an XMLType column. I have found plenty of examples where the entire table is an xmltype, but I would like to load many XML objects into a generic table for processing with one XMLType column and many other columns to identify the load. As a simple example, I have one constant column which I want to set during the upload.
    The following example does not work :(. No errors either.
    create table xml_upload
    (upload_type varchar2(10) not null,
    xml_data XMLType)
    my control file:
    LOAD DATA
    INFILE * append
    INTO TABLE xml_upload
    XMLType(xml_data)
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    upload_type constant MARKET,
    xml_data
    BEGINDATA
    <SALE_ORDER>
    <CUST_CODE>TIM</CUST_CODE>
    <ORDER_NUM>1234></ORDER_NUM>
    </SALE_ORDER>
    $ sqlldr my.ctl
    SQL*Loader: Release 10.2.0.4.0 - Production on Sun Sep 27 22:51:52 2009
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    Commit point reached - logical record count 4
    SQL> select * from xml_upload;
    no rows selected
    SQL>
    Any ideas on how I can do this? Am I missing something...
    I have also been playing with the lobfile clause of sqlldr, also without any success...
    Current database version is 10g R2.
    Thanks,
    Tim.

    Hi,
    I tried the same example as it is. but, I am getting the following error:
    SQL*Loader-350: Syntax error at line 6.
    Expecting valid column specification, "," or ")", found "filler".
    ,file_name  char(100) fillerThe table I created is:
      create table xml_upload
    (upload_type varchar2(10) not null,
    xml_data XMLType)The control file I used is:
    LOAD DATA
    INFILE *
    INTO TABLE xml_upload TRUNCATE
    upload_type constant 'MARKET'
    ,file_name  char(100) filler
    ,xml_data LOBFILE (file_name) TERMINATED BY EOF
    BEGINDATA
    test.xmlThe database I am using is 10gr2

  • Loading leap year date using SQL*Loader

    Hello,
    I have a problem loading a date '29/02/2000' using SQL*Loader. This date is on a leap year. I'm getting an error message from SQL*Loader as 'ORA-01839: date not valid for month specified'. My colleague and I have tried using various date functions to convert the data into date, but no luck.
    I would appreciate any helps,
    Bruce

    Thanks for your help, I found the bug on my control file. I was using the RTRIM function to remove bad timestamp such as '29/02/2000 0:00:00'. So instead of using this statement:
    LOG_DATE DATE "DD/MM/RRRR" "RTRIM(:LOG_DATE,'0:00:00')"
    I was using the statement below with a space before the '0:00:00' string literal, with the intention to remove a space also:
    LOG_DATE DATE "DD/MM/RRRR" "RTRIM(:LOG_DATE,' 0:00:00')"
    Well, it turned out that if there was a space before the string literal, RTRIM function would trim the matching string plus any '0' characters from the right, including the '000' that belongs to '2000'. Thus, the error.
    Thanks again,
    Bruce

  • Using SQL Loader script in a Stored Procedure

    Can I use SQL Loader script in a stored procedure and then execute it from a front-end appl.? The reason for this seemingly convoluted solution is that the users don't want a batch load though the records volume is quite high (around 1 mil). Other loads using ODBC connection or OLE DB seem to be inferior to SQL Loader.

    I would suggest a couple of solutions:
    1. Have a cgi script that can upload the file to the server from a web ui, then have the cgi script call the sql*loader file, and it will insert into the database.
    2. You can try to use External tables. This is avaliable in 9i and onwards. You will be able to make any sql DML on the external table.
    I would normally use sql*loader, move the data to a staging table with nologging, and paralle loading. After it has been loaded into the staging table I would process it into my main tables. Have used this approach with up to 60 million records in one load.
    You can do calls to C procedures, Pro*C procedures through PLSQL, as well as java calls, or use Java stored procedures.
    My experience is that SQL*Loader is the fastest way to load data into the database.

  • How to export&import data using sql *loader

    Hi all,
    How to export&import data from sql*loader. Give me the clear steps..
    Thanks in Advance

    Hi did you already exported data from SQL SERVER? if not using SQL*LOADER you cannot export data. SQL*LOADER is only mean for importing data from flat files(usually text files) into ORACLE tables.
    for importing data into oracle tables using sql*loader use below steps
    1) create a sql*loader control file.
    it looks like as follows
    LOAD DATA
    INFILE 'sample.dat'
    BADFILE 'sample.bad'
    DISCARDFILE 'sample.dsc'
    APPEND
    INTO TABLE emp
    TRAILING NULLCOLS
    or for sample script of control file search google.
    2) at command prompt issue following
    $ sqlldr test/test
    enter control file=<give control file name which you create earlier>
    debug any errors (if occured)

  • How to load date column using sql loader

    Hi,
    I am trying to load a file using sql loader. my date value in the file is '2/24/2009 8:23:05 pm',
    In control file for this column i specified like this
    rec_date date ''mm/dd/yyyy hh:mi:ss pm"
    But i am getting following error
    not avalid month.
    Thanks
    sudheer

    Hi,
    Use this example as reference:
    CTL file:
    LOAD DATA
    INFILE 'test.txt'
    BADFILE 'test.bad'
    truncate INTO TABLE T3
    FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '|' TRAILING NULLCOLS
    dt_date DATE "mm/dd/yyyy hh:mi:ss pm")DAT file:
    2/24/2009 8:23:05 pm
    C:\ext_files>sqlldr hr/hr control=test.ctl
    SQL*Loader: Release 10.2.0.1.0 - Production on Wed Jul 1 20:35:35 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 1
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    SQL> desc t3;
    Name    Type Nullable Default Comments
    DT_DATE DATE Y                        
    SQL> select to_char(dt_date, 'mm/dd/yyyy hh24:mi:ss') from t3;
    TO_CHAR(DT_DATE,'MM/DD/YYYYHH2
    02/24/2009 20:23:05
    SQL> Regards,
    Edited by: Walter Fernández on Jul 1, 2009 8:35 PM - Adding example...
    Edited by: Walter Fernández on Jul 1, 2009 8:38 PM
    Edited by: Walter Fernández on Jul 1, 2009 8:41 PM - Fixing some information...

  • How to load date with time zone using sql loader???

    Hi All,
    How to load following value in the table using SQL loader.
    [11/Jan/2006:15:20:14 -0800]
    What should be the datatype of the column in the table. I have tried with "timestamp with local time zone", but unable to load the record using sql loader. What should be the format string in the loader control file to load this type of record.
    Any help in this regard is highly appreciated.
    Sameer

    Try something like this in your control file:
    mycol char "TO_TIMESTAMP_TZ(mycol, 'DD/MON/YYYY:HH24:MI:SS TZH:TZM')"
    [pre]
    Message was edited by:
            Jens Petersen                                                                                                                                                                                                                                                                                                                                                                       

  • How to Load Arabic Data from flat file using SQL Loader ?

    Hi All,
    We need to load Arabic data from an xls file to Oracle database, Request you to provide a very good note/step to achieve the same.
    Below are the database parameters used
    NLS_CHARACTERSET AR8ISO8859P6
    nls_language american
    DB version:-10g release 2
    OS: rhel 5
    Thanks in advance,
    Satish

    Try to save your XLS file into CSV format and set either NLS_LANG to the right value or use SQL*Loader control file parameter CHARACTERSET.
    See http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_control_file.htm#i1005287

  • How to load a default value in to a column when using sql loader

    Im trying to load from a flat file using sql loader.
    for 1 column i need to update using a default value
    how to go about this?

    Hi!
    try this code --
    LOAD DATA
       INFILE 'sample.dat'
       REPLACE
       INTO TABLE emp
       empno   POSITION(01:04) INTEGER EXTERNAL NULLIF empno=BLANKS,
       ename   POSITION(06:15)  CHAR,
       job         POSITION(17:25)  CHAR,
       mgr       POSITION(27:30)  INTEGER EXTERNAL NULLIF mgr=BLANKS,
       sal        POSITION(32:39)  DECIMAL EXTERNAL NULLIF sal=BLANKS,
       comm   POSITION(41:48)  DECIMAL EXTERNAL DEFAULTIF comm = 100,
       deptno  POSITION(50:51)  INTEGER EXTERNAL NULLIF deptno=BLANKS,
       hiredate POSITION(52:62) CONSTANT SYSDATE
      )-hope this will solve ur purpose.
    Regards.
    Satyaki De.

Maybe you are looking for

  • Sandbox WebPart Postback too Large?

    Hi guys, I've done some research and it looks like the error I'm running into (when saving the web part properties) is that my post back is too large.  This is a simple sandbox web part I'm building, which works great until I added the last configura

  • Why can't I transfer HD movies to my iPod?

    I can transfer about 90% of my movies, but the two I just bought on a blu-ray+dvd+digital copy (which show us as HD in my library) won't transfer. Accorcing to iTunes, my device can't play them. why is this?

  • My isight imac got an insomnia

    It won't go to sleep by itself. Only the display is off with a constant light on, not the blinking one. I have to tell it to sleep by using the menu command. I've heard that if you have a usb peripherial plugged into the imac, it might not do auto sl

  • Regarding transfering the data into different cubes

    Hi all, The relation between infosource and cube is one to many.So by applying update rules we can transfer the the data from infosource to different cubes.So please explain a scenario where in same data is stored in different cubes thanks in advance

  • On scripts

    hi all how to develop second page in sap-scripts, give steps  4 second page. n also no. of windows on single page