SQL*Loader . A column value in data file contains comma(,)

Hi Friends,
I am getting an issue while loading a csv file to database.
A column in datafile contains a comma .. how to load such data?
For ex, a record in data file is :
453,1,452,N,5/18/2006,1,"FOREIGN, NON US$ CORPORATE",,,310
Here "FOREIGN, NON US$ CORPORATE" is a column and contains a , in the value.
I have specified optionally enclosed with " also.. but still not working
Here is my control file:
options (errors=100)
load data
infile 'TAX_LOT_DIM_1.csv'
badfile 'TAX_LOT_DIM_1.bad'
replace
into table TAX_LOT_DIM
fields terminated by ',' optionally enclosed by '"'
trailing nullcols
TAX_LOT_DIM_ID ,
TAX_LOT_NBR ,
TAX_LOT_ODS_ID ,
RESTRICTION_IND ,
LAST_UPDATE_DTM ,
TRAN_LOT_NBR integer,
MGR_GRP_CD optionally enclosed by '"' ,
RESTRICTION_AMT "TO_NUMBER(:RESTRICTION_AMT,'99999999999999999999.999999999999')" ,
RESTRICTION_INFO ,
SRC_MGR_GRP_CD
Problem is with MGR_GRP_CD column in ctrl file.
Please reply asap.
Regards,
Kishore

Thanks for the response.
Actually my ctrl file is like this with some conversion functions:
replace
into table TAX_LOT_DIM
fields terminated by ',' optionally enclosed by '"'
trailing nullcols
TAX_LOT_DIM_ID "TO_NUMBER(:TAX_LOT_DIM_ID ,'999999999999999.99999999')",
TAX_LOT_NBR ,
TAX_LOT_ODS_ID "to_number(:TAX_LOT_ODS_ID ,'999999999999999.999999')",
RESTRICTION_IND ,
LAST_UPDATE_DTM "to_date(:LAST_UPDATE_DTM ,'mm/dd/yyyy')",
TRAN_LOT_NBR integer, --"TO_NUMBER(:TRAN_LOT_NBR,'999999999999999.99999999999999999')",
MGR_GRP_CD char optionally enclosed by '"' ,
RESTRICTION_AMT "TO_NUMBER(:RESTRICTION_AMT,'99999999999999999999.999999999999')" ,
RESTRICTION_INFO ,
SRC_MGR_GRP_CD
For char columns , even i dont give any datatype, i think it will work.
And pblm is not with this hopefully.
Thanks,
Kishore

Similar Messages

  • SQL*Loader-510: Physical record in data file (clob_table.ldr) is long

    If I generate loader / Insert script from Raptor, it's not working for Clob columns.
    I am getting error:
    SQL*Loader-510: Physical record in data file (clob_table.ldr) is long
    er than the maximum(1048576)
    What's the solution?
    Regards,

    Hi,
    Has the file been somehow changed by copying it between windows and unix? Ora file transfer done as binary or ASCII? The most common cause of your problem. Is if the end of line carriage return characters have been changed so they are no longer /n/r could this have happened? Can you open the file in a good editor or do an od command in unix to see what is actually present?
    Regards,
    Harry
    http://dbaharrison.blogspot.co.uk/

  • SQL Loader: handling difference datatypes in data file and table column

    Hi,
    I am not sure if my question is valid but I am having this doubt.
    I am trying to load data from my data file into a table with just a single column of FLOAT datatype using SQL Loader. But very few insertions take place, leaving a large number of record rejected for the same reason-
    Record 7: Rejected - Error on table T1, column MSISDN.
    ORA-01722: invalid number
    The data in my datafile goes like this: (with a single space before every field)
       233207332711<EOFD><EORD>    233208660745<EOFD><EORD>    233200767380<EOFD><EORD>
    Here I want to know if there is any way to type cast the data read from the data file to suit my table column's datatype.
    How do I handle this? I want to load all the data from my datafile into my table.

    Pl continue the discussion in your original post - Pls help: SQL Loader loads only one record

  • SQL Loader - adding column values

    Hi everybody,
    Is it possible to have a column value in SQL Loader control file that is a function of two other columns. For example I have table of 3 columns c1, c2, c3
    and data file is having c1, c2 and I want to specify c3 as c1+c2 in the control file, so that it's populated in the table while loading data file. I tried this on date column but it gave me error ora-00981.
    Can you tell me exact sysntax if possible.

    LOAD DATA
    INFILE 'C:\SQLLOADER\AREA.TXT'
    APPEND INTO TABLE AREA
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    (c1,
    c2,
    c3 ":c2+:c1"
    kuljeet pal singh

  • SQL*Loader - Skipping columns in the source file.

    Hi
    I have a comma delimted source file with 4 columns. I however only want to load columns 2 and 3 into my table using SQL*Loader. This seems like something that should be fairly simple but I can't seem to find any doc or examples of this.
    Any guidance would be appreciated.
    Thanks
    Dave

    Hello Dave,
    Here is a sample of what you'll need to have in your control fileLOAD DATA
    APPEND
    INTO TABLE <target_table>
    FIELDS TERMINATED BY ','
    ( column_1  FILLER
    , column_2
    , column_3
    , column_4  FILLER
    )Hope this helps,
    Luke

  • Error: SQL Loader-466 column not exist ???

    dear all.
    i have a problem with sql loader.
    The error is:
    SQL*Loader-466: Column NUM_PAQ does not exist in table PLANELEC.file
    i saw desc table:
    SQL> DESC PLANELEC.file
    Nombre ¿Nulo? Tipo
    num_paq NOT NULL CHAR(8)
    formulario NOT NULL CHAR(4)
    norden NOT NULL NUMBER(38)
    cod_docide_dec NOT NULL NUMBER(38)
    num_docide_dec NOT NULL VARCHAR2(11)
    num_correl_a NOT NULL NUMBER(38)
    cod_docide_aseg NOT NULL NUMBER(38)
    num_docide_aseg NOT NULL VARCHAR2(15)
    cod_cat_tra NOT NULL NUMBER(38)
    cod_tipo NOT NULL NUMBER(38)
    fec_ini_perlab NOT NULL DATE
    fec_fin_perlab DATE
    cod_extincion CHAR(2)
    ind_envio NUMBER(38)
    fec_envio DATE
    num_ctl CHAR(6)
    my ctl file is:
    Load DATA
    INFILE file.UNL
    INSERT
    INTO TABLE PLANELEC.file
    fields terminated by '|'
    TRAILING NULLCOLS
    NUM_PAQ,FORMULARIO,NORDEN,COD_DOCIDE_DEC,NUM_DOCIDE_DEC,NUM_CORREL_A,COD_DOCIDE_ASEG,
    NUM_DOCIDE_ASEG,COD_CAT_TRA,COD_TIPO,FEC_INI_PERLAB,FEC_FIN_PERLAB,COD_EXTINCION,
    IND_ENVIO,FEC_ENVIO,NUM_CTL
    and the first line of the file.unl is:
    00000000|0601|2000043|6|20100066603|1|1|90000001|1|20|01/02/2002|||0||613954|
    what could be the problem with that?
    thanks a lot !
    cesar
    ORACLE 10GR2
    RHEL AS V4.0

    Hi ThinkingEye,
    Please check the definition of the control file. Did you for instance inclose the file name in quotes?
    That's usually the reason for the 466 error with SQL*Loader.
    Also check column definitions and column formats that are in the definition.
    Cheers, Patrick
    ps Is this thread related to the other 2 you have with the same target table STG_GEM_EVENT_ITS?

  • SQL LOADER , EXTERNAL  TABLE and ODBS DATA SOURCE

    hello
    Can any body help loading data from dbase file .dbt to an oracle 10g table.
    I tried last day with SQL LOADER, EXTERNAL table , and ODBC data source.
    Why all of these utilities still failing to solve my problem ?
    Is there an efficient way to reach this goal ?
    Thanks in advance

    export the dbase data file to text file,
    then you have choice of using either sql loader or external table option to use.
    regards

  • Sql*loader-604 Error occurred on an attempt to commit

    Hi,
    Iam trying to insert data in to dept table using sqlloader.It worked fine for first 2 attempts but when iam trying it later its giving an error.
    E:\ sqlldr userid=scott/tiger@test,control='E:\oracle\dept.ctl'
    sql*loader-604 Error occurred on an attempt to commit
    ora-03114: not connected to oracle
    Regards,
    Krithika

    ora-03114: not connected to oracle
    Your DBA might have wriiten a procedure to Kill an Oracle session if idle for 15 mins or so or he might have killed the session for some maintenance purpose and that to forcefully . Try reconnectiing again

  • I need sample basic data file containing Product,Market,Measures etc

    I need sample basic data file containing Product,Market,Measures etc to load data in to Sample Basic applications. Where can I get this?

    As I am the World Domain Lead for Sample.Basic (this is a joke, btw, it's sort of like being King of my front stoop, and besides, I just made it up) I will note two things about CALCDAT.TXT.
    1) It is not in columnar format, but instead in Essbase free-form data load format as user2571802 notes. This means if you take a look at it with a text editor, it's a bit confusing to read till you realize that it contains all dimensional information in the data file itself. See the DBAG's section on [Data Sources That Do Not Need A Rules File|http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/html_esb_dbag/ddlintro.htm#ddlintro1029529].
    2) CALCDAT.TXT contains level 0 and calculated results. Just load it -- there's no need to calculate it.
    Regards,
    Cameron Lackpour

  • SQL Loader-How to insert -ve & date values from flat text file into coloumn

    Question: How to insert -ve & date values from flat text file into coloumns in a table.
    Explanation: In the text file, the negative values are like -10201.30 or 15317.10- and the date values are as DDMMYYYY (like 10052001 for 10th May, 2002).
    How to load such values in columns of database using SQL Loader?
    Please guide.

    Question: How to insert -ve & date values from flat text file into coloumns in a table.
    Explanation: In the text file, the negative values are like -10201.30 or 15317.10- and the date values are as DDMMYYYY (like 10052001 for 10th May, 2002).
    How to load such values in columns of database using SQL Loader?
    Please guide. Try something like
    someDate    DATE 'DDMMYYYY'
    someNumber1      "TO_NUMBER ('s99999999.00')"
    someNumber2      "TO_NUMBER ('99999999.00s')"Good luck,
    Eric Kamradt

  • Use of PL/SQL to populate table columns from XML data file

    I'm trying to find the easiest way to transfer data from a flat file that is in XML format into a traditional Oracle table. Not retaining the XML but actually map an XML element to a column so standard SQL, Forms, Reports, etc can access like it was created using a Form.
    Example: Table A has column names Tom, Dick and Harry and the XML file has elements Tom, Dick and Harry and I just want a function that maps and inserts/loads the data into Table As individual columns.
    The process needs to be easily initiated by an end user. The user gets the XML data file via an email attachment and needs to do something like a Concurrent Request to pull in the file and load it. Using PL/SQL would be great.
    I appreciate any help that can be provided.

    Hi,
    HELP!!!!!
    We are having the same problem and we are using oracle 10ir2.
    We create an object type (sql type globally not in a package):
    CREATE OR REPLACE TYPE G_EX AS OBJECT
    ( EX_ID NUMBER ,
    EX_CON VARCHAR2 ( 100 ) ,
    EX_L VARCHAR2 ( 30 ) ,
    EX_T VARCHAR2 ( 4000 ) );
    CREATE OR REPLACE TYPE G_EX LIST AS TABLE OF  GEX AS ;
    then we insert data through a bulk collect within the package with the table declared of this array of object types:
    v_table G_EX _LIST:= NULL;
    SELECT G_EX (ex_id
    ,ex_con
    ,ex_l
    ,ex_t )
    BULK COLLECT INTO v_table
    FROM exs_lookup;
    I am using the syntax (below) but it gives PL/SQL: ORA-00902: invalid datatype
    sometimes not always:
    SELECT G_EX ( ex_id
    ,ex_con
    ,ex_l
    ,ex_t )
    BULK INTO v_data_record
    FROM TABLE (v_table)
    WHERE ex_id = p_key;
    where p_key - is a number type
    and v_data_record is a G_EX object type.
    I was wondering if anyone else encountered a similar problem, and knows what we may have done wrong. Since we dont understand why this piece of code is throwing this ora-00902 errors occasionally not always.
    Also, if we restart the database up once this errors occurs it appears to stop throwing this ora_00902 error for a lenght of time. Then it comes up with the ora-00902 error again (why?)
    thanks

  • Sql Loader INFILE name value in table column Value

    Hi,
    Here is my Sql Loader Script
    LOAD DATA
    infile '%1'
    APPEND INTO TABLE XX_SUPPLIER_UPD
    FIELDS TERMINATED BY ";" OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
    ACTION Char
    ,ADDRESS_TYPE Char
    ,REGION Char "LTRIM(RTRIM(:REGION))"
    ,PO_BOX Char
    ,,WWW_ADDRESS Char
    ,status Char "NVL(:status,'X')"
    ,filename Char "replace(:infile,'\"','')"
    I am getting the infile name as the parameter and i want to insert that parameter value in the column name fillename. Can any one guide me to how to do.
    Cheers!
    Jayaraj.S

    If you were to use external tables instead of SQL*Loader, you can dynamically change the location of the external table (i.e. the filename) using a simple ALTER TABLE statement.
    External tables also mean that all the control is inside the database rather than relying on external utilities and external scripts.
    ;)

  • SQL*Loader and timestamp values

    I'm loading timestamp values (among other data) from a text file into Oracle using SQL*Loader.
    The data I load is formatted like the following:
    2008/11/13 23:55:21.366
    2008/11/13 23:55:22.782
    2008/11/13 23:55:25.879
    Hence my control file look like this:
    TSTAMP TIMESTAMP "YYYY/MM/DD HH24:MI:SS.FF",
    The timestamp data in the input file are in UTC, however I load into a column that is of type "TIMESTAMP(3)", i.e. in server time. This is on purpose. I do not want the data to be in UTC when I look at them.
    Therefore after the load I have to manually do
    UPDATE mytable
    SET tstamp = tstamp + (tstamp - sys_extract_utc(tstamp));
    This update-after-loading actually takes quite some time due to the amount of records. I would like to avoid it and instead do it as part of the load. Is this possible somehow?
    I'm on Oracle 10.2.
    Thanks.

    Hi
    What about setting a special Time Zone in your database?
    You have two options when setting which time zone the database belongs to. You can either qualify it as a displacement from GMT/UTC in the format of 'hh:mm' or you can specify it as a name that has an entry in the V$TIMEZONE table.
    select tzname,tzabbrev from V$TIMEZONE_NAMES;
    select DBTIMEZONE from dual;
    ALTER database SET TIME_ZONE = 'Denmark/Copenhagen';
    select SESSIONTIMEZONE from dual;
    select CURRENT_TIMESTAMP from dual;
    See that link
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/create.htm#sthref319
    Edited by: Hub on Dec 7, 2008 3:58 PM

  • SQL Loader for Enclosed values.

    i have a data file having '|' seperated values:
    |1|ABC|XYZ||123|891|11|8|9|WELL|
    all values are enclosed in |. some values can be null.
    the control file looks like,
    LOAD DATA
    INFILE contact.dat
    append INTO TABLE Contact
    FIELDS TERMINATED BY '|'
    ADDRESSID,
    FNAME,
    LNAME,
    NOTES,
    PHONENUM,
    PHONEEXT,
    CONTACTINT,
    RESPCODE,
    SEQNUMBER,
    TITLE
    this script is not inserting any values in table. kindly help!

    looks fine on 10.2.0.1
    SQL> create table contact (
      2   addressid varchar2(10)
      3  ,fname varchar2(10)
      4  ,lname varchar2(10)
      5  ,notes varchar2(10)
      6  ,phonenum varchar2(10)
      7  ,phoneext varchar2(10)
      8  ,contactint varchar2(10)
      9  ,respcode varchar2(10)
    10  ,seqnumber varchar2(10)
    11  ,title varchar2(10)
    12  )
    13  /
    Table created.
    SQL> !sqlldr test/test control=contact.ctl
    SQL> select * from contact;
    ADDRE FNAME LNAME NOTES PHONENUM   PHONEEXT   CONTACTINT RESPCODE   SEQNUMBER  TITLE               
          1     ABC   XYZ              123        891        11         8          9                   
    SQL> spool off;What about a contact.log file, is there any reason specified why no rows were inserted?
    Perhaps you are trying to insert a character into column where number is expected.
    Ants

  • On load, getting error:  Field in data file exceeds maximum length

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0    Production
    TNS for Solaris: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    I'm trying to load a table, small in size (110 rows, 6 columns).  One of the columns, called NOTES is erroring when I run the load.  It is saying that the column size exceeds max limit.  As you can see here, the table column is set to 4000 Bytes)
    CREATE TABLE NRIS.NRN_REPORT_NOTES
      NOTES_CN      VARCHAR2(40 BYTE)               DEFAULT sys_guid()            NOT NULL,
      REPORT_GROUP  VARCHAR2(100 BYTE)              NOT NULL,
      AREACODE      VARCHAR2(50 BYTE)               NOT NULL,
      ROUND         NUMBER(3)                       NOT NULL,
      NOTES         VARCHAR2(4000 BYTE),
      LAST_UPDATE   TIMESTAMP(6) WITH TIME ZONE     DEFAULT systimestamp          NOT NULL
    TABLESPACE USERS
    RESULT_CACHE (MODE DEFAULT)
    PCTUSED    0
    PCTFREE    10
    INITRANS   1
    MAXTRANS   255
    STORAGE    (
                INITIAL          80K
                NEXT             1M
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
                FLASH_CACHE      DEFAULT
                CELL_FLASH_CACHE DEFAULT
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    I did a little investigating, and it doesn't add up.
    when i run
    select max(lengthb(notes)) from NRIS.NRN_REPORT_NOTES
    I get a return of
    643
    That tells me that the largest size instance of that column is only 643 bytes.  But EVERY insert is failing.
    Here is the loader file header, and first couple of inserts:
    LOAD DATA
    INFILE *
    BADFILE './NRIS.NRN_REPORT_NOTES.BAD'
    DISCARDFILE './NRIS.NRN_REPORT_NOTES.DSC'
    APPEND INTO TABLE NRIS.NRN_REPORT_NOTES
    Fields terminated by ";" Optionally enclosed by '|'
      NOTES_CN,
      REPORT_GROUP,
      AREACODE,
      ROUND NULLIF (ROUND="NULL"),
      NOTES,
      LAST_UPDATE TIMESTAMP WITH TIME ZONE "MM/DD/YYYY HH24:MI:SS.FF9 TZR" NULLIF (LAST_UPDATE="NULL")
    BEGINDATA
    |E2ACF256F01F46A7E0440003BA0F14C2|;|DEMOGRAPHICS|;|A01003|;3;|Demographic results show that 46 percent of visits are made by females.  Among racial and ethnic minorities, the most commonly encountered are Native American (4%) and Hispanic / Latino (2%).  The age distribution shows that the Bitterroot has a relatively small proportion of children under age 16 (14%) in the visiting population.  People over the age of 60 account for about 22% of visits.   Most of the visitation is from the local area.  More than 85% of visits come from people who live within 50 miles.|;07/29/2013 16:09:27.000000000 -06:00
    |E2ACF256F02046A7E0440003BA0F14C2|;|VISIT DESCRIPTION|;|A01003|;3;|Most visits to the Bitterroot are fairly short.  Over half of the visits last less than 3 hours.  The median length of visit to overnight sites is about 43 hours, or about 2 days.  The average Wilderness visit lasts only about 6 hours, although more than half of those visits are shorter than 3 hours long.   Most visits come from people who are fairly frequent visitors.  Over thirty percent are made by people who visit between 40 and 100 times per year.  Another 8 percent of visits are from people who report visiting more than 100 times per year.|;07/29/2013 16:09:27.000000000 -06:00
    |E2ACF256F02146A7E0440003BA0F14C2|;|ACTIVITIES|;|A01003|;3;|The most frequently reported primary activity is hiking/walking (42%), followed by downhill skiing (12%), and hunting (8%).  Over half of the visits report participating in relaxing and viewing scenery.|;07/29/2013 16:09:27.000000000 -06:00
    Here is the full beginning of the loader log, ending after the first row return.  (They ALL say the same error)
    SQL*Loader: Release 10.2.0.4.0 - Production on Thu Aug 22 12:09:07 2013
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Control File:   NRIS.NRN_REPORT_NOTES.ctl
    Data File:      NRIS.NRN_REPORT_NOTES.ctl
      Bad File:     ./NRIS.NRN_REPORT_NOTES.BAD
      Discard File: ./NRIS.NRN_REPORT_NOTES.DSC
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array:     64 rows, maximum of 256000 bytes
    Continuation:    none specified
    Path used:      Conventional
    Table NRIS.NRN_REPORT_NOTES, loaded from every logical record.
    Insert option in effect for this table: APPEND
       Column Name                  Position   Len  Term Encl Datatype
    NOTES_CN                            FIRST     *   ;  O(|) CHARACTER
    REPORT_GROUP                         NEXT     *   ;  O(|) CHARACTER
    AREACODE                             NEXT     *   ;  O(|) CHARACTER
    ROUND                                NEXT     *   ;  O(|) CHARACTER
        NULL if ROUND = 0X4e554c4c(character 'NULL')
    NOTES                                NEXT     *   ;  O(|) CHARACTER
    LAST_UPDATE                          NEXT     *   ;  O(|) DATETIME MM/DD/YYYY HH24:MI:SS.FF9 TZR
        NULL if LAST_UPDATE = 0X4e554c4c(character 'NULL')
    Record 1: Rejected - Error on table NRIS.NRN_REPORT_NOTES, column NOTES.
    Field in data file exceeds maximum length...
    I am not seeing why this would be failing.

    HI,
    the problem is delimited data defaults to char(255)..... Very helpful I know.....
    what you need to two is tell sqlldr hat the data is longer than this.
    so change notes to notes char(4000) in you control file and it should work.
    cheers,
    harry

Maybe you are looking for

  • How to read specific lines from a text file using external table or any other method?

    Hi, I have a text file with delimited data, I have to pick only odd number rows and load into a table... Ex: row1:  1,2,2,3,3,34,4,4,4,5,5,5,,,5  ( have to load only this row) row2:   8,9,878,78,657,575,7,5,,,7,7 Hope this is enough.. I am using Orac

  • Issue with inbound xml..

    Hi All, We have an issue with inbound XML : XML structure is as follows: <?xml version="1.0" encoding="UTF-8" ?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">    

  • Allocation of multiple expenses in single posting template

    Hi With reference to Message 843069, we would like to suggest improvement to enable multiple allocation of expenses to respective departmental segments using a single Posting Template when each expense is allocated in various proportions of 100% amon

  • Screen Exit in Transaction LM50

    Hi Experts, I created a screen exit for transaction LM50 (Count Inventory By System Guided). I created the subscreen SAPLXLRF 7152 because i need to add a field, this screen replace screen 2152. In transaction CMOD i created and activated a new proje

  • IFrame hack for IE6 in Tooltip Widget

    The iFrame, that is called up in IE6 to cover form elements doesn't seem to get placed right. Obviously, this issue has to be viewed with IE6 since that's the only browser that uses the iFrame hack built into the Tooltip Widget. The following page sh