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

Similar Messages

  • SQL*LOADER(8I) VARIABLE SIZE FIELD를 여러 TABLE에 LOAD하기 (FILLER)

    제품 : ORACLE SERVER
    작성날짜 : 2004-10-29
    ==================================================================
    SQL*LOADER(8I) VARIABLE SIZE FIELD를 여러 TABLE에 LOAD하기 (FILLER)
    ==================================================================
    PURPOSE
    SQL*LOADER 에서 variable length record와 variable size field를 가진 data
    file 을 여러 table에 load하는 방법을 소개하고자 한다.
    ( 8i new feature인 FILLER 절 사용)
    Explanation
    SQL*LOADER SYNTAX
    여러 table에 load하고자 할때에는 control file에 아래와 같이 하면 된다.
    INTO TABLE emp
    INTO TABLE emp1
    fixed length field을 가진 data file을 여러 table에 같은 data을 load하고자
    한다면 아래와 같다.
    INTO TABLE emp
    (empno POSITION(1:4) INTEGER EXTERNAL,
    INTO TABLE emp1
    (empno POSITION(1:4) INTEGER EXTERNAL,
    위와 같이 양쪽 table의 empno field에 각각의 load할 data로부터 1-4까지를
    load 할수 있다. 그러나 field의 길이가 가변적이라면 위와 같이 POSITION 절을
    각 field에 사용할 수 없다.
    Example
    예제 1>
    create table one (
    field_1 varchar2(20),
    field_2 varchar2(20),
    empno varchar(10) );
    create table two (
    field_3 varchar2(20),
    empno varchar(10) );
    load할 record가 comma로 나누어지며 길이가 가변적이라고 가정하자.
    << data.txt >> - load할 data file
    "this is field 1","this is field 2",12345678,"this is field 4"
    << test.ctl >> - control file
    load data infile 'data.txt'
    discardfile 'discard.txt'
    into table one
    replace
    fields terminated by ","
    optionally enclosed by '"' (
    field_1,
    field_2,
    empno )
    into table two
    replace
    fields terminated by ","
    optionally enclosed by '"' (
    field_3,
    dummy1 filler position(1),
    dummy2 filler,
    empno )
    dummy1 field는 filler로 선언되었다. filler로 선언하면 table에 load하지 않는다.
    two라는 table에는 dummy1이라는 field는 없으며 position(1)은 current record의
    처음부터 시작해서 첫번째 field을 dummy1 filler item에 load한다는 것을 말한다.
    그리고 두번째 field을 dummy2 filler item에 load한다. 세번째 field인, one이라는
    table에 load되었던 employee number는 two라는 table에도 load되는 것이다,
    << 실행 >>
    $sqlldr scott/tiger control=test.ctl data=data.txt log=test.log bindsize=300000
    $sqlplus scott/tiger
    SQL> select * from one;
    FIELD_1 FIELD_2 EMPNO
    this is field 1 this is field 2 12345678
    SQL> select * from two;
    FIELD_3 EMPNO
    this is field 4 12345678
    예제 2>
    create table testA (c1 number, c2 varchar2(10), c3 varchar2(10));
    << data1.txt >> - load할 data file
    7782,SALES,CLARK
    7839,MKTG,MILLER
    7934,DEV,JONES
    << test1.ctl >>
    LOAD DATA
    INFILE 'data1.txt'
    INTO TABLE testA
    REPLACE
    FIELDS TERMINATED BY ","
    c1 INTEGER EXTERNAL,
    c2 FILLER CHAR,
    c3 CHAR
    << 실행 >>
    $ sqlldr scott/tiger control=test1.ctl data=data1.txt log=test1.log
    $ sqlplus scott/tiger
    SQL> select * from testA;
    C1 C2 C3
    7782 CLARK
    7839 MILLER
    7934 JONES
    Reference Documents
    <Note:74719.1>

  • Issue with SQL Loader and tha last field

    Hi
    I have a data file to load . The Load is running fine. But the last record comes with a a junk character. when loaded into the table.
    when we open the file it shows nothing.
    I tried replacing ^M and chr(10) but of no use.
    can you please asssit men in this.. We have a go live soon

    You need to provide us more details...
    SQL and PL/SQL FAQ
    By the way:
    Have you considered using external tables?
    They have more benefits than SQL*Loader...
    http://www.oracle-developer.net/display.php?id=204
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:6611962171229
    http://www.oracle-base.com/articles/9i/ExternalTables9i.php

  • Bank statement: problem to load variable length field

    we have many bank accounts with different banks, and we would like to use the bank reconciliation module to do bank reconciliation.
    we have problem in load the MT940 bank statement. All these banks are providing so called standard SWIFT940 format, which not able to give fixed length field.
    we have problem on line 61 which have a lot of variable length fields.
    line 61 comprise of 7 fields, which are:
    A) Value date - fixed 6 chars.
    B) Entry date - fixed 4 chars.
    C) Credit/debit - variable 1-2 chars.
    D) Fund Code - fixed 1 char
    E) Transaction amount - variable 15 chars
    F) Transaction code/type - fixed 4 chars
    G) MID, cheque#, BIS - variable 16 chars
    How can we write the SQL Loader script if there is no delimiter, and the start position of the fields are not fixed?
    we can load A and B easily, but C onwards we will have problems.
    please help.
    INTO TABLE ce_stmt_int_tmp
    WHEN rec_id_no = '61'
    TRAILING NULLCOLS
    (rec_no RECNUM,
    rec_id_no POSITION(1:2) CHAR,
    column1 POSITION(4:9) CHAR,
    column2 POSITION(10:13) CHAR,
    column3 ??
    column4 ??
    column5 ??
    column6 ??
    column7 ??
    ------

    Hi Linda,
    As said by gupta, please check, whether the bank statement has the statement 62F:
    If not, please get the statement again from bank and ensure that the end statement 62F exists in the statement..
    This will help you to overcome your problem..
    Regards,
    Praisty

  • The error is like : Variable length field exceeds maximum length

    Hi All,
    I am trying to load some signature ascii data from load file. so i wrote the code like below in my controal file to load that to database. For SIGN_IMAGE in oracle db it was mentioned as RAW(2000). The below is worked fine when i tried in window and oracle 8i environment.
    SIG_TYPE POSITION(23:23) CHAR,
    SIGN_IMAGE POSITION(24:1977) VARRAW(2000)
    NULLIF SIGN_IMAGE=BLANKS,
    SIGN_IMAGE1 POSITION(1978:3930) VARRAW(2000)
         NULLIF SIGN_IMAGE1=BLANKS
    But when i ported the same thing to solaris and oracle 10g environment. The below code is giving error when SQL Loder loading.
    The error is like for column SIGN_IMAGE : Variable length field exceeds maximum length.
    But here i am giving a lenght of 1954 only with including 2 bytes length of the string.
    Could any one tell me what is exactly the problem? i am not able sort out the issue.
    Thanks,
    Shashi

    Maybe:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_field_list.htm#i1011032

  • Variable length field exceeds maximum length

    Hi All,
    I am trying to load some signature ascii data from load file. so i wrote the code like below in my controal file to load that to database. For SIGN_IMAGE in oracle db it was mentioned as RAW(2000). The below is worked fine when i tried in window and oracle 8i environment.
    SIG_TYPE POSITION(23:23) CHAR,
    SIGN_IMAGE POSITION(24:1977) VARRAW(2000)
    NULLIF SIGN_IMAGE=BLANKS,
    SIGN_IMAGE1 POSITION(1978:3930) VARRAW(2000)
         NULLIF SIGN_IMAGE1=BLANKS
    But when i ported the same thing to solaris and oracle 10g environment. The below code is giving error when SQL Loder loading.
    The error is like : Variable length field exceeds maximum length.
    But here i am giving a lenght of 1954 only with including 2 bytes length of the string.
    Could any one tell me what is exactly the problem? i am not able sort out the issue.
    Thanks,
    Shashi

    Hi,
    I am getting the error in environment Oracle 10.2.0 and SunOS 5.10. This case was executed fine in Oracle 8.1 and windows xp professional. Please find the details below.
    LOG file :
    Column Name Position Len Term Encl Datatype
    TRANS_NO 1:15 15 CHARACTER
    TDR_ID 16:18 3 CHARACTER
    DVCE_TYPE 19:20 2 CHARACTER
    CAP_CD 21:22 2 CHARACTER
    SIG_TYPE 23:23 1 CHARACTER
    SIGN_IMAGE 24:1977 2002 VARRAW
    NULL if SIGN_IMAGE = BLANKS
    SIGN_IMAGE1 1978:3930 2002 VARRAW
    NULL if SIGN_IMAGE1 = BLANKS
    SIGN_IMAGE2 3931:5883 2002 VARRAW
    NULL if SIGN_IMAGE2 = BLANKS
    SIGN_IMAGE3 5884 2002 VARRAW
    NULL if SIGN_IMAGE3 = BLANKS
    value used for ROWS parameter changed from 64 to 31
    Record 1: Rejected - Error on table SIGSCH.SIGNATURE, column SIGN_IMAGE.
    Variable length field exceeds maximum length.
    Record 2: Rejected - Error on table SIGSCH.SIGNATURE, column SIGN_IMAGE.
    Variable length field exceeds maximum length.
    Record 3: Rejected - Error on table SIGSCH.SIGNATURE, column SIGN_IMAGE.
    Variable length field exceeds maximum length.
    Record 4: Rejected - Error on table SIGSCH.SIGNATURE, column SIGN_IMAGE.
    Variable length field exceeds maximum length.
    Controal file :
    LOAD DATA
    INFILE 'sigc.sig'
    BADFILE 'load_7.bad'
    DISCARDFILE 'load_7.dis'
    APPEND
    INTO TABLE sigsch.signature
    TRANS_NO POSITION(1:15) CHAR,
    TDR_ID POSITION(16:18) INTEGER EXTERNAL,
    DVCE_TYPE POSITION(19:20) CHAR,
    CAP_CD POSITION(21:22) CHAR,
    SIG_TYPE POSITION(23:23) CHAR,
    SIGN_IMAGE POSITION(24:1977) VARRAW(2000)
    NULLIF SIGN_IMAGE=BLANKS,
    SIGN_IMAGE1 POSITION(1978:3930) VARRAW(2000)
    NULLIF SIGN_IMAGE1=BLANKS,
    SIGN_IMAGE2 POSITION(3931:5883) VARRAW(2000)
    NULLIF SIGN_IMAGE2=BLANKS,
    SIGN_IMAGE3 POSITION(5884) VARRAW(2000)
    NULLIF SIGN_IMAGE3=BLANKS
    DATA line
    0001200000002480050600?ža4GW ' & ' & _" _! _" ^# ^# _" ^# _" ^# _! _" & ' & ' & !%_!5 & !% & !U & !% ' V X _R _! _Z _Q _" _"__1 _"_ ( _!__2_ (_ 0 & 'pa@NS _! _"_^3 _" ^# _! ^$ ^# _! ^$ _! _" _!paDC' ' P V _ P ^ & '_ ._ 0__*_ 0 ^# _" _! _" _! ^T X _Q! H PpaTI$_ (_ 0_ (_ 0__2_ (^_9 _"_^3 _" _! _R _Z P! H P! H & ^ W !% & & ' _! _" ^# _" _! _" _" _Q _" X P &pa]KA_ 0^ 8_ 0_ (__2_ 0_ ( X _! P P Z! H Q P Z R _!__2 _!^ 8__2_ (^ 8_ 6_ 0 ' Ppe"F; P ^ P & P ' & '_ 0_ 0__)_ 0 _"__) Z " ^S _Y! @!_Jpe3K/ _" _" _! _"__1 ^$ _! _" P _! ' ^ ' & & !% ' & & ' &_ ( _" X P P Y!J R!I!_J ^S R Y _"_ (__1^ 8_ 0^ 8_ 7^ 8_ ( & _" X PpeDF# & & _" _" _! _" ^# _" PpeDKW '_ 0 V P X R X P Q _"_ 0_ 0_ ( _" _! Z P Q Z!J Q R _! _" _"_ 0^ 8__1_ /_ 0_ 6_ ( & ' X V! H W! H! N! H! @ X P Z ! _" _! ^$ _! ^# _" ^# R ! ' & ' !$ !% !% !%_!5 !$ ' & W & & P X _" _R _! _Z _! _" _"__)_ 0__*_ 0 Ppi#J+ X_ (_ 0_ (^ @_ (__1__*__1 _R _Z _Q X P P! H X ' & V_ 7 &_ ( '_ 6 _" Ppi-KG_ 0_ 7__)_ 0_ /__1^ 8_ 0 R Z P Q Z Q Z _" _Q__2__) _"__2_ (^ @_ (_ 6 V ' ^ P P ' X V X P P X P! H P ^ P X W & '_ 6_ (__2_ (__1__2 _! _" _R _Q! H _Z P Ppi@H& _Q P X _" V X ' P_ 6_ (__2__)_ 0__2 _" _! _R _Q X P! H P _ & ' &_ . '_ 6 P XpiTN# &_ (^ 8__2^ 8_ 0__)__2_^3 _" _! ^# R " _! _R _!__2 _"_ 0_ (_ 6_ ._ 7_ 6_ / & & ' X P Q! H!J Ppi\KW _" _R X _Q _Z _Q _R _Zpm&O9_ . _"__2 _!_^3_^, ^#_^3 ^# ^# ^$ Qpm(JS 0_ ( _!_ 0 _"__) _" _" _! _Z P X P V _ &_ ._ 7_ 0 P Ppm1ID_ 0_ 0__* _!__2 _" Q " X _! P P X W X !% P & & W & _" _! _" _" _! ^# _" X V ' !] & V ' & _" _!__2 _" _! _" P & ' & V _ V _! @ ^! H!_B Xpa44V &_ 0____1____2 ^# ^# ^# R !!_J X P V _ !% & !% & '_ . &_ 7_ 6 Ppa<7Q_ 0_ ._ 0 _"__* _! _" ^# _" ]\ ^$ ^S ^# _Z _! W &paE3A _"_ 0 &_ 0_ ( _"_ 0__) _"_^3 _" ^S ^# _Z P!_I W !\ ' "S !%\!% !$ !%_!5 & '_ ( ^# _" ^# _! ^$ ^[ _! ^T ^# _YpaW7)_ 0_ ( _"__1 _" ^# _" ^# _! ^T X _Q! H P! H Xpe 7Q_ 0_ ( X _" _Q ^# _R ^# ^# ^\ ^# ^S _" _! _Z V !% !U !] !T !% !% !% &_ 0 _"__) ^$ _! _" ^# _" ^[ P _Y! @ X W ^ ' &_ ._ 7_ . '_ 6_ 0 & W P ^pe37/ ' _! _" _" _! ^# ^$ _! ^[ ^$ ^# _! ^$ _!pe-3A _" X _Q X! @ X P! H P ' X & V ' & ' !$ ' & _" _! ^$ _! ^# ^$ ^[ ^# ^# ^S _" _" V !% ^ W !\ W P ^ P X P _R _! _Z ^# _R ^# ^# _Z _! _RpeE/G X P X P W X P &_ 7_ (__1_ 0__*__1_^, _! ^# ^\ _Q _Z!_A!_J! H P! HpeU3A &_ 0_ 0__* _" _! _Z _Q _" ^S _" ^# _" _! _"__1 _"__2_ (_ 0pe]5D _" _! _" _" _! ^# ^\ ^# ^S _" ^# X & W & !% !%_"3_!-_ 6_!- &_ 7_ 0 & P V _ P X! @ X P X _Q ^$ _! _" _!__2_ ( _"_ 0_ (_ 0 Vpi&0> _! ^$ _Q _" _! ^$ _! _" & _ !$ ' !% !$ ' !U V ^ P! H P!_J X!_B Xpi65<_ ( _"_ 0 _! _"__2 _!__* _! ^$ ^# _Y _R _R X V ^ !U ' & &_ 7_ . '_ 0_ ( X VpiA1D_ 0^ 8 _"_ 0 _! ^$ _!_^+ ^$ ^[ ^S ^# ^[ _R _R_ 6 &_!5_!- !%_!5 !$ !% !U !% ^ W P X P _Y P _" _! _" ^#__2_ (__1_ (_ 0 ' &piF0> P X P! H P! H! H V __ . &_ 0_ (^ @_ (__2__*__1 _" _Q _Z _R! H!_I! H PpiT3! P &__2 _" _! _R _! _" _" ^# _! ' & ' !$ W & ' ^ V! H P! H Xpm$;! & _" _" _! ^# ^$ _! ^# _" _" ^#pm'3/ _"_ 0 _" _! _R _! _Z P _R! H! H P! N X V W & _Z _! ^$ ^S ^# ]] ^# ]% ]U_^3 _!__*^_:^_A^ 8^ 8^ ?^ 8^ @p

  • Variable length field exceeds maximum length for VARRAW in SQLLOADER

    Hi All,
    I am trying to load some signature ascii data from load file. so i wrote the code like below in my controal file to load that to database. For SIGN_IMAGE in oracle db it was mentioned as RAW(2000). The below is worked fine when i tried in window and oracle 8i environment.
    SIG_TYPE POSITION(23:23) CHAR,
    SIGN_IMAGE POSITION(24:1977) VARRAW(2000)
    NULLIF SIGN_IMAGE=BLANKS,
    SIGN_IMAGE1 POSITION(1978:3930) VARRAW(2000)
         NULLIF SIGN_IMAGE1=BLANKS
    But when i ported the same thing to solaris and oracle 10g environment. The below code is giving error when SQL Loder loading.
    The error is like : Variable length field exceeds maximum length.
    But here i am giving a lenght of 1954 only with including 2 bytes length of the string.
    Could any one tell me what is exactly the problem? i am not able sort out the issue.
    Thanks,
    Shashi

    Please only post in a single forum. Thank you.

  • Variable length field exceeds maximum length for VARRAW

    Hi All,
    I am trying to load some signature ascii data from load file. so i wrote the code like below in my controal file to load that to database. For SIGN_IMAGE in oracle db it was mentioned as RAW(2000). The below is worked fine when i tried in window and oracle 8i environment.
    SIG_TYPE POSITION(23:23) CHAR,
    SIGN_IMAGE POSITION(24:1977) VARRAW(2000)
    NULLIF SIGN_IMAGE=BLANKS,
    SIGN_IMAGE1 POSITION(1978:3930) VARRAW(2000)
         NULLIF SIGN_IMAGE1=BLANKS
    But when i ported the same thing to solaris and oracle 10g environment. The below code is giving error when SQL Loder loading.
    The error is like : Variable length field exceeds maximum length.
    But here i am giving a lenght of 1954 only with including 2 bytes length of the string.
    Could any one tell me what is exactly the problem? i am not able sort out the issue.
    Thanks,
    Shashi

    You should probably move this question to the General Database Discussions. This forum is for Oracle Forms not SQL:*Loader.

  • SQL*Loader and binary

    i am trying to load binary data using SQL*Loader. given a table created a la:
    create table oofa ( data raw(500) );
    and a control file (running on x86 linux):
    LOAD DATA
    INFILE *
    APPEND INTO TABLE OOFA
    ( DATA VARRAW(500) )
    BEGINDATA
    X'05003132333435'
    i get an error "variable length field exceeds maximum length" and no record loaded. i tried using X'00053132333435' just in case i'd muffed the big- little-endian stuff, but the same thing happens.
    anyone successfully loaded binary data as above? if so, how'd you do it?
    also, is there a way to make SQL*Loader more verbose?
    thanks.

    i am trying to load binary data using SQL*Loader. given a table created a la:
    create table oofa ( data raw(500) );
    and a control file (running on x86 linux):
    LOAD DATA
    INFILE *
    APPEND INTO TABLE OOFA
    ( DATA VARRAW(500) )
    BEGINDATA
    X'05003132333435'
    i get an error "variable length field exceeds maximum length" and no record loaded. i tried using X'00053132333435' just in case i'd muffed the big- little-endian stuff, but the same thing happens.
    anyone successfully loaded binary data as above? if so, how'd you do it?
    also, is there a way to make SQL*Loader more verbose?
    thanks.

  • HELP: SQL*LOADER AND Ref Column

    Hallo,
    I have already posted and I really need help and don't come further with this
    I have the following problem. I have 2 tables which I created the following way:
    CREATE TYPE gemark_schluessel_t AS OBJECT(
    gemark_id NUMBER(8),
    gemark_schl NUMBER(4),
    gemark_name VARCHAR2(45)
    CREATE TABLE gemark_schluessel_tab OF gemark_schluessel_t(
    constraint pk_gemark PRIMARY KEY(gemark_id)
    CREATE TYPE flurstueck_t AS OBJECT(
    flst_id NUMBER(8),
    flst_nr_zaehler NUMBER(4),
    flst_nr_nenner NUMBER(4),
    zusatz VARCHAR2(2),
    flur_nr NUMBER(2),
    gemark_schluessel REF gemark_schluessel_t,
    flaeche SDO_GEOMETRY
    CREATE TABLE flurstuecke_tab OF flurstueck_t(
    constraint pk_flst PRIMARY KEY(flst_id),
    constraint uq_flst UNIQUE(flst_nr_zaehler,flst_nr_nenner,zusatz,flur_nr),
    flst_nr_zaehler NOT NULL,
    flur_nr NOT NULL,
    gemark_schluessel REFERENCES gemark_schluessel_tab
    Now I have data in the gemark_schluessel_tab which looks like this (a sample):
    1 101 Borna
    2 102 Draisdorf
    Now I wanna load data in my flurstuecke_tab with SQL*Loader and there I have problems with my ref column gemark_schluessel.
    One data record looks like this in my file (it is without geometry)
    1|97|7||1|1|
    If I wanna load my data record, it does not work. The reference (the system generated OID) should be taken from gemark_schluessel_tab.
    LOAD DATA
    INFILE *
    TRUNCATE
    CONTINUEIF NEXT(1:1) = '#'
    INTO TABLE FLURSTUECKE_TAB
    FIELDS TERMINATED BY '|'
    TRAILING NULLCOLS (
    flst_id,
    flst_nr_zaehler,
    flst_nr_nenner,
    zusatz,
    flur_nr,
    gemark_schluessel REF(CONSTANT 'GEMARK_SCHLUESSEL_TAB',GEMARK_ID),
    gemark_id FILLER
    BEGINDATA
    1|97|7||1|1|
    Is there a error I made?
    Thanks in advance
    Tig

    multiple duplicate threads:
    to call an oracle procedure and sql loader in an unix script
    Re: Can some one help he sql loader issue.

  • Using SQL*Loader and UTL_FILE to load and unload large files(i.e PDF,DOCs)

    Problem : Load PDF or similiar files( stored at operating system) into an oracle table using SQl*Loader .
    and than Unload the files back from oracle tables to prevoius format.
    I 've used SQL*LOADER .... " sqlldr " command as :
    " sqlldr scott/[email protected] control=c:\sqlldr\control.ctl log=c:\any.txt "
    Control file is written as :
    LOAD DATA
    INFILE 'c:\sqlldr\r_sqlldr.txt'
    REPLACE
    INTO table r_sqlldr
    Fields terminated by ','
    id sequence (max,1) ,
    fname char(20),
    data LOBFILE(fname) terminated by EOF )
    It loads files ( Pdf, Image and more...) that are mentioned in file r_sqlldr.txt into oracle table r_sqlldr
    Text file ( used as source ) is written as :
    c:\kalam.pdf,
    c:\CTSlogo1.bmp
    c:\any1.txt
    after this load ....i used UTL_FILE to unload data and write procedure like ...
    CREATE OR REPLACE PROCEDURE R_UTL AS
    l_file UTL_FILE.FILE_TYPE;
    l_buffer RAW(32767);
    l_amount BINARY_INTEGER ;
    l_pos INTEGER := 1;
    l_blob BLOB;
    l_blob_len INTEGER;
    BEGIN
    SELECT data
    INTO l_blob
    FROM r_sqlldr
    where id= 1;
    l_blob_len := DBMS_LOB.GETLENGTH(l_blob);
    DBMS_OUTPUT.PUT_LINE('blob length : ' || l_blob_len);
    IF (l_blob_len < 32767) THEN
    l_amount :=l_blob_len;
    ELSE
    l_amount := 32767;
    END IF;
    DBMS_LOB.OPEN(l_blob, DBMS_LOB.LOB_READONLY);
    l_file := UTL_FILE.FOPEN('DBDIR1','Kalam_out.pdf','w', 32767);
    DBMS_OUTPUT.PUT_LINE('File opened');
    WHILE l_pos < l_blob_len LOOP
    DBMS_LOB.READ (l_blob, l_amount, l_pos, l_buffer);
    DBMS_OUTPUT.PUT_LINE('Blob read');
    l_pos := l_pos + l_amount;
    UTL_FILE.PUT_RAW(l_file, l_buffer, TRUE);
    DBMS_OUTPUT.PUT_LINE('writing to file');
    UTL_FILE.FFLUSH(l_file);
    UTL_FILE.NEW_LINE(l_file);
    END LOOP;
    UTL_FILE.FFLUSH(l_file);
    UTL_FILE.FCLOSE(l_file);
    DBMS_OUTPUT.PUT_LINE('File closed');
    DBMS_LOB.CLOSE(l_blob);
    EXCEPTION
    WHEN OTHERS THEN
    IF UTL_FILE.IS_OPEN(l_file) THEN
    UTL_FILE.FCLOSE(l_file);
    END IF;
    DBMS_OUTPUT.PUT_LINE('Its working at last');
    END R_UTL;
    This loads data from r_sqlldr table (BOLBS) to files on operating system ,,,
    -> Same procedure with minor changes is used to unload other similar files like Images and text files.
    In above example : Loading : 3 files 1) Kalam.pdf 2) CTSlogo1.bmp 3) any1.txt are loaded into oracle table r_sqlldr 's 3 rows respectively.
    file names into fname column and corresponding data into data ( BLOB) column.
    Unload : And than these files are loaded back into their previous format to operating system using UTL_FILE feature of oracle.
    so PROBLEM IS : Actual capacity (size ) of these files is getting unloaded back but with quality decreased. And PDF file doesnt even view its data. means size is almot equal to source file but data are lost when i open it.....
    and for images .... imgaes are getting loaded an unloaded but with colors changed ....
    Also features ( like FFLUSH ) of Oracle 've been used but it never worked
    ANY SUGGESTIONS OR aLTERNATE SOLUTION TO LOAD AND UNLOAD PDFs through Oracle ARE REQUESTED.
    ------------------------------------------------------------------------------------------------------------------------

    Thanks Justin ...for a quick response ...
    well ... i am loading data into BLOB only and using SQL*Loader ...
    I've never used dbms_lob.loadFromFile to do the loads ...
    i 've opend a file on network and than used dbms_lob.read and
    UTL_FILE.PUT_RAW to read and write data into target file.
    actually ...my process is working fine with text files but not with PDF and IMAGES ...
    and your doubt of ..."Is the data the proper length after reading it in?" ..m not getting wat r you asking ...but ... i think regarding data length ..there is no problem... except ... source PDF length is 90.4 kb ..and Target is 90.8 kb..
    thats it...
    So Request u to add some more help ......or should i provide some more details ??

  • SQL Loader and Insert Into Performance Difference

    Hello All,
    Im in a situation to measure performance difference between SQL Loader and Insert into. Say there 10000 records in a flat file and I want to load it into a staging table.
    I know that if I use PL/SQL UTL_FILE to do this job performance will degrade(dont ask me why im going for UTL_FILE instead of SQL Loader). But I dont know how much. Can anybody tell me the performance difference in % (like 20% will decrease) in case of 10000 records.
    Thanks,
    Kannan.

    Kannan B wrote:
    Do not confuse the topic, as I told im not going to use External tables. This post is to speak the performance difference between SQL Loader and Simple Insert Statement.I don't think people are confusing the topic.
    External tables are a superior means of reading a file as it doesn't require any command line calls or external control files to be set up. All that is needed is a single external table definition created in a similar way to creating any other table (just with the additional external table information obviously). It also eliminates the need to have a 'staging' table on the database to load the data into as the data can just be queried as needed directly from the file, and if the file changes, so does the data seen through the external table automatically without the need to re-run any SQL*Loader process again.
    Who told you not to use External Tables? Do they know what they are talking about? Can they give a valid reason why external tables are not to be used?
    IMO, if you're considering SQL*Loader, you should be considering External tables as a better alternative.

  • SQL *Loader and External Table

    Hi,
    Can anyone tell me the difference between SQL* Loader and External table?
    What are the conditions under we can use SQL * Loader and External Table.
    Thanx

    External tables are accessible from SQL, which generally simplifies life if the data files are physically located on the database server since you don't have to coordinate a call to an external SQL*Loader script with other PL/SQL processing. Under the covers, external tables are normally just invoking SQL*Loader.
    SQL*Loader is more appropriate if the data files are on a different server or if it is easier to call an executable rather than calling PL/SQL (i.e. if you have a batch file that runs on a server other than the database server that wants to FTP a data file from a FTP server and then load the data into Oracle).
    Justin

  • Help in calling sql loader and an oracle procedure in a script

    Hi Guru's
    please help me in writing an unix script which will call sql loader and also an oracle procedure..
    i wrote an script which is as follows.
    !/bin/sh
    clear
    #export ORACLE_SID='HOBS2'
    sqlldr USERID=load/ps94mfo16 CONTROL=test_nica.ctl LOG=test_nica.log
    retcode=`echo $?`
    case "$retcode" in
    0) echo "SQL*Loader execution successful" ;;
    1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
    2) echo "SQL*Loader execution exited with EX_WARN, see logfile" ;;
    3) echo "SQL*Loader execution encountered a fatal error" ;;
    *) echo "unknown return code";;
    esac
    sqlplus USERID=load/ps94mfo16 << EOF
    EXEC DO_TEST_SHELL_SCRIPT
    it is loading the data in to an oracle table
    but the procedure is not executed..
    any valuable suggestion is highly appriciated..
    Cheers

    multiple duplicate threads:
    to call an oracle procedure and sql loader in an unix script
    Re: Can some one help he sql loader issue.

  • Is there any difference in Oracle 9i SQL Loader and Oracle 10g SQL Loader

    Hi
    Can anyone tell me whether is there any difference in Oracle 9i SQL Loader and Oracle 10g SQL Loader?
    I am upgrading the 9i db to 10g and wanted to run the 9i SQL Loader control files on upgraded 10g db. So please let me know is there any difference which I need to consider any modifications in the control files..
    Thank you in advance
    Adi

    answered

Maybe you are looking for