SQL Loader - field concatenation

Is it possible to concatenate several columns in a comma-delimited input file into one column in the database.
For example:
INPUT FILE:
1234,Description 1,Description2
DATABASE FILE (has to columns)
1.
Product Number (to be populated from '1234' in the input file)
2.
Description (to be populated from 'Description 1 Description 2' in the input file)
Please let me know how to do this. I was trying column object but it doesn't work.

Please find below the contents of my control file
LOAD DATA
INFILE '/home/apsprod/DD20100603007.txt'
REPLACE
INTO TABLE DD_EPMP_STAGING_TAB
fields terminated by '||~||' optionally enclosed by '"' trailing nullcols
DD_Case_ID,
DD_Action_Status,
DD_Employee_Name,
DD_Emp_no,
DD_Perform_period_start_date     date "DD/MM/YYYY HH24:MI:SS",
DD_Perform_period_end_date     date "DD/MM/YYYY HH24:MI:SS",
DD_Employees_Rank
)

Similar Messages

  • SQL LOADER - fields containing CRs

    I am using SQL loader for uploading some data extracted from another database. data contains one field that has 'Carriage Return' characters. when sql loader reads this character it treats it as beginning of another record. This results in load errors.
    Can anybody suggest a way to handle the fields containing Carriage Returns ?
    Thanks much.
    -shailesh

    Hello,
    You can load the data as in a stg table and the move from stg table to regular table concatenating both call_temp and call_date column together.
    load data
    infile 'Cell_Phones.dbo.Account_Details.dat' "str '<EORD>'"
    into table MD_CELLPHONE.Account_Details_stg
    fields terminated by '<EOFD>'
    trailing nullcols
    Account_Number ,
    Phone_Number ,
    Call_temp,
    Call_Date
    Convert  to right date format
    Insert into account_details (col1 , col2, col3, ...)  select  val1 , val2 , to_date ( val3 || ' ' || val4) ...
    from account_details_stg;
    Regards
    Edited by: OrionNet on Feb 2, 2009 5:11 PM

  • SQL Loader - Field in data file exceeds maximum length

    Dear All,
    I have a file which has more than 4000 characters in a field and I wish to load the data in a table with field length = 4000. but I receive error as
    Field in data file exceeds maximum lengthThe below given are the scripts and ctl file
    Table creation script:
    CREATE TABLE "TEST_TAB"
        "STR"  VARCHAR2(4000 BYTE),
        "STR2" VARCHAR2(4000 BYTE),
        "STR3" VARCHAR2(4000 BYTE)
      );Control file:
    LOAD DATA
    INFILE 'C:\table_export.txt'
    APPEND INTO TABLE TEST_TAB
    FIELDS TERMINATED BY '|'
    TRAILING NULLCOLS
    ( STR CHAR(4000) "SUBSTR(:STR,1,4000)" ,
    STR2 CHAR(4000) "SUBSTR(:STR2,1,4000)" ,
    STR3 CHAR(4000) "SUBSTR(:STR3,1,4000)"
    )Log:
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon Jul 26 16:06:25 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Control File:   C:\TEST_TAB.CTL
    Data File:      C:\table_export.txt
      Bad File:     C:\TEST_TAB.BAD
      Discard File:  none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 0
    Bind array:     64 rows, maximum of 256000 bytes
    Continuation:    none specified
    Path used:      Conventional
    Table TEST_TAB, 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
    STR                                 FIRST  4000   |       CHARACTER           
        SQL string for column : "SUBSTR(:STR,1,4000)"
    STR2                                 NEXT  4000   |       CHARACTER           
        SQL string for column : "SUBSTR(:STR2,1,4000)"
    STR3                                 NEXT  4000   |       CHARACTER           
        SQL string for column : "SUBSTR(:STR3,1,4000)"
    value used for ROWS parameter changed from 64 to 21
    Record 1: Rejected - Error on table TEST_TAB, column STR.
    Field in data file exceeds maximum length
    MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.
    Table TEST_TAB:
      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.
    Space allocated for bind array:                 252126 bytes(21 rows)
    Read   buffer bytes: 1048576
    Total logical records skipped:          0
    Total logical records read:             1
    Total logical records rejected:         1
    Total logical records discarded:        0
    Run began on Mon Jul 26 16:06:25 2010
    Run ended on Mon Jul 26 16:06:25 2010
    Elapsed time was:     00:00:00.22
    CPU time was:         00:00:00.15Please suggest a way to get it done.
    Thanks for reading the post!
    *009*

    Hi Toni,
    Thanks for the reply.
    Do you mean this?
    CREATE TABLE "TEST"."TEST_TAB"
        "STR"  VARCHAR2(4001),
        "STR2" VARCHAR2(4001),
        "STR3" VARCHAR2(4001)
      );However this does not work as the error would be:
    Error at Command Line:8 Column:20
    Error report:
    SQL Error: ORA-00910: specified length too long for its datatype
    00910. 00000 -  "specified length too long for its datatype"
    *Cause:    for datatypes CHAR and RAW, the length specified was > 2000;
               otherwise, the length specified was > 4000.
    *Action:   use a shorter length or switch to a datatype permitting a
               longer length such as a VARCHAR2, LONG CHAR, or LONG RAW*009*
    Edited by: 009 on Jul 28, 2010 6:15 AM

  • SQL loader Field in data file exceeds maximum length for CLOB column

    Hi all
    I'm loading data from text file separated by TAB and i got the error below for some lines.
    Event the column is CLOB data type is there a limitation of the size of a CLOB data type.
    The error is:
    Record 74: Rejected - Error on table _TEMP, column DEST.
    Field in data file exceeds maximum length
    I'm using SQL Loader and the database is oracle 11g r2 on linux Red hat 5
    Here are the line causing the error fronm my data file and my table description for test:
    create table TEMP
    CODE VARCHAR2(100),
    DESC VARCHAR2(500),
    RATE     FLOAT,
    INCREASE VARCHAR2(20),
    COUNTRY VARCHAR2(500),
    DEST     CLOB,
    WEEK     VARCHAR2(10),
    IS_SAT VARCHAR2(50),
    IS_SUN VARCHAR2(50)
    CONTROL FILE:
    LOAD DATA
    INTO TABLE TEMP
    APPEND
    FIELDS TERMINATED BY X'9' TRAILING NULLCOLS
    CODE,
    DESC,
    RATE,
    INCREASE,
    COUNTRY),
    DEST,
    WEEK,
    IS_SAT,
    IS_SUN
    Data file:
    BHS Mobile     Bahamas - Mobile     0.1430          1     "242357, 242359, 242375, 242376, 242395, 242421, 242422, 242423, 242424, 242425, 242426, 242427, 242428, 242429, 242431, 242432, 242433, 242434, 242435, 242436, 242437, 242438, 242439, 242441, 242442, 242443, 242445, 242446, 242447, 242448, 242449, 242451, 242452, 242453, 242454, 242455, 242456, 242457, 242458, 242462, 242463, 242464, 242465, 242466, 242467, 242468, 24247, 242524, 242525, 242533, 242535, 242544, 242551, 242552, 242553, 242554, 242556, 242557, 242558, 242559, 242565, 242577, 242636, 242646, 242727"               
    BOL Mobile ENTEL     Bolivia - Mobile Entel     0.0865     Increase     591     "67, 68, 71, 72, 73, 740, 7410, 7411, 7412, 7413, 7414, 7415, 7420, 7421, 7422, 7423, 7424, 7425, 7430, 7431, 7432, 7433, 7434, 7435, 7436, 7437, 7440, 7441, 7442, 7443, 7444, 7445, 7450, 7451, 7452, 7453, 7454, 7455, 746, 7470, 7471, 7472, 7475, 7476, 7477, 7480, 7481, 7482, 7483, 7484, 7485, 7486, 7490, 7491, 7492, 7493, 7494, 7495, 7496"               Thank you.

    Hi
    Thank you for youe help, I found the solution and here what i do in my Control file i added
    char(40000) OPTIONALLY ENCLOSED BY '"' .
    LOAD DATA
    INTO TABLE TEMP
    APPEND
    FIELDS TERMINATED BY X'9' TRAILING NULLCOLS
    CODE,
    DESC,
    RATE,
    INCREASE,
    COUNTRY,
    DEST
    char(40000) OPTIONALLY ENCLOSED BY '"',
    WEEK,
    IS_SAT,
    IS_SUN
    Thank you for your help.

  • Sql*loader field length issue

    so I'm loading a file and it's rejected a record where "field in data file exceeds maximum length" the record it's failing on has data length of 625 characters. I'm loading it into a table with a field type of varchar2(1024).
    for the life of me, I can't figure out why it's failing. I've even gone and manually copy and pasted the rogue record into the table (via Toad) and it works fine, but I need it to load via SQL*loader.
    there is no white space that i'm not counting. Can anyone suggest where to look next?

    Hi,
    Just change the problematic field in the control file as
    load
    field char(1000),
    If you give the length in the control file, ur problem ll be solved.
    - karthik

  • SQL Loader - field seperator

    Hi All,
    I am using SQL*Loader: Release 8.0.6.3.0 to load data into oracle. I want to use ||~|| as the field seperator. It gives me below error if I try to use ||~|| as the field seperator. How to use multiple characters as the field seperator
    SQL*Loader-350: Syntax error at line 5.
    Expecting single char, found "||~||".
    Please help. Hope I am clear, if not please let me know

    Please find below the contents of my control file
    LOAD DATA
    INFILE '/home/apsprod/DD20100603007.txt'
    REPLACE
    INTO TABLE DD_EPMP_STAGING_TAB
    fields terminated by '||~||' optionally enclosed by '"' trailing nullcols
    DD_Case_ID,
    DD_Action_Status,
    DD_Employee_Name,
    DD_Emp_no,
    DD_Perform_period_start_date     date "DD/MM/YYYY HH24:MI:SS",
    DD_Perform_period_end_date     date "DD/MM/YYYY HH24:MI:SS",
    DD_Employees_Rank
    )

  • Can SQL*Loader Insert concatenated string into table

    Hi All,
    I want to insert a column, whose format is "abc" + to_char(sysdate,'YYYYMMDD'), into temp table. How can I do it? Thank you in advance.
    Best Regards,
    Sheng

    Hi Lukasz,
    Thank you for your help! The "abc" is a constant string, it isn't a column. And I use concat function to solve the problem. like this
    LOAD DATA
    INFILE data.txt
    INTO TABLE tmp_table
    fields terminated by "," optionally enclosed by '"'
    ( c1 "concat('abc',TO_CHAR(SYSDATE, 'YYYYMMDD'))"
    Sheng
    Edited by: Sheng on 2013-5-26 下午4:44

  • SQL Loader Inserting Log File Statistics to a table

    Hello.
    I'm contemplating how to approach gathering the statistics from the SQL Loader log file to insert them into a table. I've approached this from a Korn Shell Script perspective previously, but now that I'm working in a Windows environment and my peers aren't keen about batch files and scripting I thought I'd attempt to use SQL Loader itself to read the log file and insert one or more records into a table that tracks data uploads. Has anyone created a control file that accomplishes this?
    My current environment:
    Windows 2003 Server
    SQL*Loader: Release 10.2.0.1.0
    Thanks,
    Luke

    Hello.
    Learned a little about inserting into multiple tables with delimited records. Here is my current tested control file:
    LOAD DATA
    APPEND
    INTO TABLE upload_log
    WHEN (1:12) = 'SQL*Loader: '
    FIELDS TERMINATED BY WHITESPACE
    TRAILING NULLCOLS
    (  upload_log_id   RECNUM
    , filler_field_0  FILLER
    , filler_field_1  FILLER
    , filler_field_2  FILLER
    , filler_field_3  FILLER
    , filler_field_4  FILLER
    , filler_field_5  FILLER
    , day_of_week
    , month
    , day_of_month
    , time_of_day
    , year
    , log_started_on          "TO_DATE((:month ||' '|| :day_of_month ||' '|| :time_of_day ||' '|| :year), 'Mon DD HH24:MI:SS YYYY')"
    INTO TABLE upload_log
    WHEN (1:11) = 'Data File: '
    FIELDS TERMINATED BY ':'
    (  upload_log_id    RECNUM
    , filler_field_0   FILLER  POSITION(1)
    , input_file_name          "TRIM(:input_file_name)"
    INTO TABLE upload_log
    WHEN (1:6) = 'Table '
    FIELDS TERMINATED BY WHITESPACE
    (  upload_log_id   RECNUM
    , filler_field_0  FILLER  POSITION(1)
    , table_name              "RTRIM(:table_name, ',')"
    INTO TABLE upload_rejects
    WHEN (1:7) = 'Record '
    FIELDS TERMINATED BY ':'
    (  upload_rejects_id  RECNUM
    , record_number      POSITION(1)  "TO_NUMBER(SUBSTR(:record_number,8,20))"
    , reason
    INTO TABLE upload_rejects
    WHEN (1:4) = 'ORA-'
    FIELDS TERMINATED BY ':'
    (  upload_rejects_id  RECNUM
    , error_code         POSITION(1)
    , error_desc
    INTO TABLE upload_log
    WHEN (1:22) = 'Total logical records '
    FIELDS TERMINATED BY WHITESPACE
    (  upload_log_id      RECNUM
    , filler_field_0     FILLER  POSITION(1)
    , filler_field_1     FILLER
    , filler_field_2     FILLER
    , action                     "RTRIM(:action, ':')"
    , number_of_records
    INTO TABLE upload_log
    WHEN (1:13) = 'Run began on '
    FIELDS TERMINATED BY WHITESPACE
    TRAILING NULLCOLS
    (  upload_log_id   RECNUM
    , filler_field_0  FILLER  POSITION(1)
    , filler_field_1  FILLER
    , filler_field_2  FILLER
    , day_of_week
    , month
    , day_of_month
    , time_of_day
    , year
    , run_began_on            "TO_DATE((:month ||' '|| :day_of_month ||' '|| :time_of_day ||' '|| :year), 'Mon DD HH24:MI:SS YYYY')"
    INTO TABLE upload_log
    WHEN (1:13) = 'Run ended on '
    FIELDS TERMINATED BY WHITESPACE
    TRAILING NULLCOLS
    (  upload_log_id   RECNUM
    , filler_field_0  FILLER  POSITION(1)
    , filler_field_1  FILLER
    , filler_field_2  FILLER
    , day_of_week
    , month
    , day_of_month
    , time_of_day
    , year
    , run_ended_on            "TO_DATE((:month ||' '|| :day_of_month ||' '|| :time_of_day ||' '|| :year), 'Mon DD HH24:MI:SS YYYY')"
    INTO TABLE upload_log
    WHEN (1:18) = 'Elapsed time was: '
    FIELDS TERMINATED BY ':'
    (  upload_log_id   RECNUM
    , filler_field_0  FILLER  POSITION(1)
    , filler_field_1  FILLER
    , filler_field_2  FILLER
    , elapsed_time
    INTO TABLE upload_log
    WHEN (1:14) = 'CPU time was: '
    FIELDS TERMINATED BY ':'
    (  upload_log_id   RECNUM
    , filler_field_0  FILLER  POSITION(1)
    , filler_field_1  FILLER
    , filler_field_2  FILLER
    , cpu_time
    )Here are the basic table create scripts:
    TRUNCATE TABLE upload_log;
    DROP TABLE upload_log;
    CREATE TABLE upload_log
    (  upload_log_id      INTEGER
    , day_of_week        VARCHAR2(  3)
    , month              VARCHAR2(  3)
    , day_of_month       INTEGER
    , time_of_day        VARCHAR2(  8)
    , year               INTEGER
    , log_started_on     DATE
    , input_file_name    VARCHAR2(255)
    , table_name         VARCHAR2( 30)
    , action             VARCHAR2( 10)
    , number_of_records  INTEGER
    , run_began_on       DATE
    , run_ended_on       DATE
    , elapsed_time       VARCHAR2(  8)
    , cpu_time           VARCHAR2(  8)
    TRUNCATE TABLE upload_rejects;
    DROP TABLE upload_rejects;
    CREATE TABLE upload_rejects
    (  upload_rejects_id  INTEGER
    , record_number      INTEGER
    , reason             VARCHAR2(255)
    , error_code         VARCHAR2(  9)
    , error_desc         VARCHAR2(255)
    );Now, if I could only insert a single record to the upload_log table (per table logged); adding separate columns for skipped, read, rejected, discarded quantities. Any advice on how to use SQL Loader to do this (writing a procedure would be fairly simple, but I'd like to perform all of the work in one place if at all possible)?
    Thanks,
    Luke
    Edited by: Luke Mackey on Nov 12, 2009 4:28 PM

  • SQL Loader combine fields into one.

    Hi i am using sql loader to convert a db from sql server to oracle.
    my SQL Server DB has a field for the date and another for the time, i want to convert this into on filed called date. I cannot seem to figure out how to do this.
    my ctl file looks like this.
    load data
    infile '[Cell_Phones].[dbo].[Account_Details].dat' "str '<EORD>'"
    into table MD_CELLPHONE.Account_Details
    fields terminated by '<EOFD>'
    trailing nullcols
    Account_Number ,
    Phone_Number ,
    Call_temp FILLER,
    Call_Date "TO_DATE(:Call_temp ||' ' ||':Call_Date', 'mm/dd/yyyy HH:miam')"
    BEGINDATA
    3817913.0<EOFD>1234567890.0<EOFD>2007-03-31 00:00:00<EOFD>4:25 PM<EOFD>3817913.0<EOFD>1234567890.0<EOFD>2007-03-24 00:00:00<EOFD>8:19 PM<EOFD>3817913.0<EOFD>1234567890.0<EOFD>2007-03-31 00:00:00<EOFD>4:25 PM<EOFD>
    But if i run this i get the following error
    SQL*Loader-291: Invalid bind variable CALL_TEMP in SQL string for column CALL_DATE.
    basically i cant find a way to do this to combine 2 columns into one and discard the one i am not using.
    Any help would be appreciated.
    Jeff

    Hello,
    You can load the data as in a stg table and the move from stg table to regular table concatenating both call_temp and call_date column together.
    load data
    infile 'Cell_Phones.dbo.Account_Details.dat' "str '<EORD>'"
    into table MD_CELLPHONE.Account_Details_stg
    fields terminated by '<EOFD>'
    trailing nullcols
    Account_Number ,
    Phone_Number ,
    Call_temp,
    Call_Date
    Convert  to right date format
    Insert into account_details (col1 , col2, col3, ...)  select  val1 , val2 , to_date ( val3 || ' ' || val4) ...
    from account_details_stg;
    Regards
    Edited by: OrionNet on Feb 2, 2009 5:11 PM

  • How do i map one field to another in control file via SQL Loader

    Can someone please reply back to this question
    Hi,
    I have a flat file (student.dat delimiter %~| ) using control file (student.ctl) through sql loader. Here are the details.
    student.dat
    student_id, student_firstname, gender, student_lastName, student_newId
    101%~|abc%~|F %~|xyz%~|110%~|
    Corresponding table
    Student (
    Student_ID,
    Student_FN,
    Gender,
    Student_LN
    Question:
    How do i map student_newId field to student_id field in STUDENT DB table so that new id should be inserted in student_id column. How do i specify the mapping in control file. I dont want to create a new column in student table. Please let me know the best way to do this.
    Can someone please reply back to this question.
    My approach:
    In control file i will sepecify the below, Is this a best approach?. Do we have any othe way?
    STUDENT_ID *(:STUDENT_NEWID)*,
    STUDENT_FN,
    GENDER,
    STUDENT_LNAME,
    STUDENT_NEWID BOUNDFILLER
    Thanks
    Sunil
    Edited by: 993112 on Mar 13, 2013 12:28 AM
    Edited by: 993112 on Mar 13, 2013 12:30 AM
    Edited by: 993112 on Mar 13, 2013 12:31 AM
    Edited by: 993112 on Mar 18, 2013 2:52 AM

    OK, ok...
    Here is the sample data:
    101%~|abc%~|F %~|xyz%~|110%~|
    102%~|def%~|M %~|pqr%~|120%~|
    103%~|ghi%~|M %~|stu%~|130%~|
    104%~|jkl%~|F %~|vwx%~|140%~|
    105%~|mno%~|F %~|yza%~|150%~|Here is the control file:
    LOAD DATA
    INFILE student.dat
    TRUNCATE INTO TABLE STUDENT
    FIELDS TERMINATED BY '%~|' TRAILING NULLCOLS
      student_old  FILLER
    , student_fn
    , gender
    , student_ln
    , student_id
    )And here is the execution:
    SQL> CREATE TABLE student
      2  (
      3    student_id   NUMBER
      4  , student_fn   VARCHAR2 (10)
      5  , gender       VARCHAR2 (2)
      6  , student_ln   VARCHAR2 (10)
      7  );
    Table created.
    SQL>
    SQL> !sqlldr / control=student.ctl
    SQL*Loader: Release 11.2.0.3.0 - Production on Tue Mar 19 14:37:31 2013
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    Commit point reached - logical record count 5
    SQL> select * from student;
    STUDENT_ID STUDENT_FN                     GENDER STUDENT_LN
           110 abc                            F      xyz
           120 def                            M      pqr
           130 ghi                            M      stu
           140 jkl                            F      vwx
           150 mno                            F      yza
    SQL>:p

  • How to handle Multiple date formats for the same date field in SQL*Loader

    Dear All,
    I got a requirement where I need to get data from a text file and insert the same into oracle table.
    I am using SQL*Loader to populate the data from the text file into my table.
    The file has one field where I am expecting date date data in multiple formats, like dd/mon/yyyy, yyyy/dd/mon, yyyy/mon/dd, ,mm/dd/yyyy, mon/dd/yyyy.
    While using SQL*Loader, I can see Loading is failing for records where we have formats like yyyy/dd/mon, yyyy/mon/dd, mon/dd/yyyy.
    Is there any way in SQL*Loader where we can mention all these date formats so that this date data should go smoothly into the underlying date column in the table.
    Appreciate your response on this.
    Thanks,
    Madhu K.

    The point being made was, are you sure that you can uniquely identify a date format from the value you receieve? Are you sure that the data stored is only of a particular limited set of formats?
    e.g. if you had a value of '07/08/03' how do you know what format that is?
    It could be...
    7th August 2003 (thus assuming it's DD/MM/RR format)
    or
    8th July 2003 (thus assuming it's MM/DD/RR format)
    or
    3rd August 2007 (thus assuming it's RR/MM/DD format)
    or
    8th March 2007 (thus assuming it's RR/DD/MM format)
    or even more obscurely...
    3rd July 2008 (MM/RR/DD)
    or
    7th March 2008 (DD/RR/MM)
    Do you have any information to tell you what formats are valid that would allow you to be specific and know what date format is meant?
    This is a classic example of why dates should be stored on the database using DATE datatype and not VARCHAR2. It can lead to corruption of data, especially if the date can be entered in any format a user wishes.

  • SQL Loader error while loading a date field

    Hi,
    I am getting the below error while I am trying to load a table with a date field using SQL Loader
    Record 1: Rejected - Error on table RPT_HOST_USAGE, column USAGE_TIMESTAMP.
    ORA-01861: literal does not match format string
    My input file is as below
    <code>
    Host_Usage_ID,Host_ID,Technology_ID,Environment_ID,Usage_Timestamp,Avg_CPU_Pct,Avg_Memory_MB,CPU_Spike
    1,12,1,8,'2009-08-01 00:00:00',0.000000000,23875.000000000,0.000000000
    <code>
    My Loader.ctl is
    <code>
    OPTIONS (SKIP=1)
    load data
    infile 'C:\rpt_Host_Usage.txt'
    into table RPT_HOST_USAGE
    fields terminated by ","
    HOST_USAGE_ID,
    HOST_ID,
    TECHNOLOGY_ID,
    ENVIRONMENT_ID,
    USAGE_TIMESTAMP,
    AVG_CPU_PCT,
    AVG_MEMORY_MB,
    CPU_SPIKE
    <code>
    I have tried options like USAGE_TIMESTAMP TO_DATE(USAGE_TIMESTAMP,'YYYY-MM-DD HH24:MI:SS') but didn't work...
    Can you please tell me how to resolve this issue?
    Any pointers on this will be helpful
    Thanks
    Mahesh

    I went back and looked at some of my old *.ctl files and I did something simlilar to what you mentioned and it worked for me, but I had surrounded the option in double-quotes and included a colon in front of the item. Example:
    TECHNOLOGY_ID,
    ENVIRONMENT_ID,
    USAGE_TIMESTAMP "to_date(:USAGE_TIMESTAMP,'YYYY-MM-DD HH24:MI:SS')",
    AVG_CPU_PCT,
    AVG_MEMORY_MB,
    ....

  • SQL*Loader and "Variable length field was truncated"

    Hi,
    I'm experiencing this problem using SQL*Loader: Release 8.1.7.0.0
    Here is my control file (it's actually split into separate control and data files, but the result is the same)
    LOAD DATA
    INFILE *
    APPEND INTO TABLE test
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    first_id,
    second_id,
    third_id,
    language_code,
    display_text VARCHAR(2000)
    begindata
    2,1,1,"eng","Type of Investment Account"
    The TEST table is defined as:
    Name Null? Type
    FIRST_ID NOT NULL NUMBER(4)
    SECOND_ID NOT NULL NUMBER(4)
    THIRD_ID NOT NULL NUMBER(4)
    LANGUAGE_CODE NOT NULL CHAR(3)
    DISPLAY_TEXT VARCHAR2(2000)
    QUESTION_BLOB BLOB
    The log file displays:
    Record 1: Warning on table "USER"."TEST", column DISPLAY_TEXT
    Variable length field was truncated.
    And the results of the insert are:
    FIRST_ID SECOND_ID THIRD_ID LANGUAGE_CODE DISPLAY_TEXT
    2 1 1 eng ype of Investment Account"
    The language_code field is imported correctly, but display_text keeps the closing delimiter, and loses the first character of the string. In other words, it is interpreting the enclosing double quote and/or the delimiter, and truncating the first two characters.
    I've also tried the following:
    LOAD DATA
    INFILE *
    APPEND INTO TABLE test
    FIELDS TERMINATED BY '|'
    first_id,
    second_id,
    third_id,
    language_code,
    display_text VARCHAR(2000)
    begindata
    2|1|1|eng|Type of Investment Account
    In this case, display_text is imported as:
    pe of Investment Account
    In the log file, I get this table which seems odd as well - why is the display_text column shown as having length 2002 when I explicitly set it to 2000?
    Column Name Position Len Term Encl Datatype
    FIRST_ID FIRST * | O(") CHARACTER
    SECOND_ID NEXT * | O(") CHARACTER
    THIRD_ID NEXT * | O(") CHARACTER
    LANGUAGE_CODE NEXT 3 | O(") CHARACTER
    DISPLAY_TEXT NEXT 2002 VARCHAR
    Am I missing something totally obvious in my control and data files? I've played with various combinations of delimiters (commas vs '|'), trailing nullcols, optional enclosed etc.
    Any help would be greatly appreciated!

    Use CHAR instead aof VARCHAR
    LOAD DATA
    INFILE *
    APPEND INTO TABLE test
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
      first_id,
      second_id,
      third_id,
      language_code,
      display_text    CHAR(2000)
    )From the docu:
    A VARCHAR field is a length-value datatype.
    It consists of a binary length subfield followed by a character string of the specified length.
    http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76955/ch05.htm#20324

  • Need to Skip the fields duaring the data upload by SQL*Loader.

    Hi all,
    I am not able to get how to skip some fileds in the file while uploading it thru SQL*Loader. Let us have a look the below scenario.
    The table has 4 columns. but in the input file came up with 6 fields. Let us assume the four fields came as first in the order. Then, we can populate the data into the 4 columns of the table. At the same time we want to skip the remaining fields. Even those fields/columns are no longer available in the database table.
    For example:
    create table data_temp(sno number,name varchar2(10 char),sex char(1),loc varchar2(20 char));
    Data file
    sno,name,sex,loc,organization,contact
    1,ram,M,India,HP,998976789
    2,Shesha,M,India,IBM,7890808098
    Control_file
    OPTIONS(SKIP=1)
    LOAD DATA
    INFILE *
    APPEND INTO TABLE data_temp
    FIELDS TERMINATED BY ',' optionally enclosed by '"'
    TRAILING NULLCOLS
    sno "trim(:sno)",
    name "SUBSTR(trim(:name),1,20)" ,
    sex "SUBSTR(trim(:sex),1,1)",
    loc "SUBSTR(trim(:loc),1,20)" ,
    Please suggest me how to implement the above scenario in the control file.
    Thanks in Advance!!
    Regards,
    Vissu.....

    Use FILLER. Control file:
    OPTIONS(SKIP=1)
    LOAD DATA
    INFILE *
    APPEND INTO TABLE data_temp
    FIELDS TERMINATED BY ',' optionally enclosed by '"'
    TRAILING NULLCOLS
    sno "trim(:sno)",
    name "SUBSTR(trim(:name),1,20)" ,
    sex "SUBSTR(trim(:sex),1,1)",
    loc "SUBSTR(trim(:loc),1,20)" ,
    organization filler,
    contact filler
    begindata
    sno,name,***,loc,organization,contact
    1,ram,M,India,HP,998976789
    2,Shesha,M,India,IBM,7890808098
    {code}
    Now:
    {code}
    SQL> create table data_temp(sno number,name varchar2(10 char),sex char(1),loc varchar2(20 char));
    Table created.
    SQL> host sqlldr scott/tiger control=c:\temp\vissu.ctl log=c:\temp\vissu.log
    SQL> select * from data_temp
      2  /
           SNO NAME       S LOC
             1 ram        M India
             2 Shesha     M India
    SQL>
    {code}
    SY.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • SQL Loader - Set a field to a CONSTANT and the data is date

    Hi.
    I have a question on SQL Loader.
    I want to load a field(field name is TIME_IN).
    In the Oracle table, this field type is DATE.
    I my csv file, I do not put any value for this field.
    I intend to use CONSTANT variable to this field.
    In my control file, following is the command for above field.
    Hoever, when I run the SQLLoader, it will return me error message which is INVALID MONTH.
    I hope somebody can help and advise me on this matter.
    Thanks.
    INTO TABLE eqreceival_temp
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'     
    EQ_NO,
    SIZE_TYPE,
    CUSTOMER,
    CONSTRUCTION,
    QUALITY,
    CONDITION,
    DATE_IN DATE "DD/MM/YYYY",
    TIME_IN CONSTANT '01/01/1999',
    PARK_LOC CONSTANT 'CP',
    STOCK CONSTANT 'S',
    DISCHARGE_PORT CONSTANT 'MYPEN',
    CTYPE CONSTANT 'P',
    ROAD CONSTANT 'Y',
    GATE CONSTANT 'Y',
    SHIPMENT CONSTANT 'Y'
    )

    use to_data function when u r inserting....
    or
    give simply SYSDATE --- AND FIRST CHECK
    --YOU MAY REMOVE CONSTANT KEY WORD.                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Calling Stored Procedure(takes varray of objects as input) from jdeveloper

    How can i call Stored Procedure which takes varray of objects as input from jdeveloper My object is : TYPE Entry IS Object ( Name VARCHAR2(1024), Value VARCHAR2(1024) & the varray is : TYPE EntryArr IS varray(10) OF Entry ; & the procedure is : PROCE

  • How to use a textArea in another class

    Hi, Well I'm having this problem with a project where I need to print in my main Frame some values however this values need to be in a cycle I made my textArea public and with inheritance I was able to use the textArea variable however it doesn't act

  • Wrong position while the rendering process

    I have a very curions problem with After Effects CS6. I just made a composition with different tracked images which are in a video footage. In the preview everything is shown correctly. But when I want to start to render the grafics are not shown res

  • XPath/XSLT 2.0?

    Is xMII planning to support XPath/XSLT 2.0?  Any idea when? In xMII 12.0, are custom actions provided their own classloader?  Or do they share a classloader with the core actions?  In other words, can we include Saxon 8 (XPath/XSLT 2.0) in our custom

  • Adding multiple images for tiled background?

    Hi, I'm having some trouble trying to add multiple images to the my tiled layer class. I can't figure out a way how to add these images to my current code. My goal is to add at least 4 images onto the screen. Here's my code: private void buildBackgro