SQL Loader null- BLOB

Hello,
I'm having a lot of problems to load a null value to a BLOB field via SQL Loader.
In my file tehre's a blank in the place corresponding to the BLOB field
, "ACCESS_IMAGE_DATA" CHAR NULLIF ("ACCESS_IMAGE_DATA"=BLANKS)
then I execute succesfully SQL Loader but in the BLOB field, I get something that is not null
select (ACCESS_IMAGE_DATA)from TABLE
ACCESS_IMAGE_DATA
(BLOB)
(BLOB)
(BLOB)
(BLOB)
(BLOB)
(BLOB)
(BLOB)
instead of null, null, null....
Any idea?
thanks in advance
Message was edited by:
user646394

You have not indicated the front-end tool you are using but it is not SQL*Plus and you are not looking at what you assume you are seeing. Front-end tools do not display BLOBs.
Run the following query:
SELECT dbms_lob.getlength(access_image_data)
FROM <table_name>;If it returns zero then you've been chasing the wind.

Similar Messages

  • Sql*loader and blob

    Hi,
    I want to load hex strings with sql loader into a blob/raw fields.
    The problem is that sql functions (e.g. HextoRaw) are not allowed with lob columns, and for the RAW one i get:
    "illegal use of TERMINATED BY for RAW"
    What should i do?

    If each blob is in a separate file, then you should be able to use LOBFILES to load them. Each row in the data file would need to have the name of the file containing the blob for that row. File ulcase9.ctl in the demo directory shows an example of using LOBFILES to load a lob column.
    If you want the blob in the data file, then the data file needs to use types that have include length information in then, such as VARRAW, LONG VARRAW or VARRAWC. Also, the records for the data files cannot be terminated by a character string or newline. That's because the blob data might contain the character string or newline in the middle of its data. Instead, you would need to use the VAR record type.

  • SQL Loader Null Value for Date

    Dear buddies,
    This is how my date column is in my control file.
    dtEdu timestamp(6) with local time zone "YYYY-MM-DD HH24:MI:SS"  "nvl (to_date (:dtEdu, 'YYYY-MM-DD HH24:MI:SS'), to_date ('1982-03-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS'))",  The problem is some of the columns in dtEdu has NULL values and I couldn't load them.
    So, trying to replace it with something else.
    Could someone help me?
    Thanks a lot.
    Nith

    >
    The problem is some of the columns in dtEdu has NULL values and I couldn't load them.
    >
    I don't know how your so called "NULL" values look like, but if the null data is actually made up of blanks, try adding LTRIM() around :dtEdu.

  • SQL Loader: Null value in column

    Have a tab delimited file, in UNIX
    Some of the inbetween columns have null values
    The records are failing to load with null column values.
    I tried:
    col10 nullif col10 ="(null)"
    My control file is:
    load data
    infile 'abc.txt'
    into table XX_data
    fields terminated by X'09' optionally enclosed by '"'
    TRAILING NULLCOLS
    ( col1,
    col2 nullif col2 ="(null)",
    col3)

    Sample data is tab delimited file. For some reason, it has problem reading the second date (+time) column in the same record when there are null values in preceding columns. It says:
    ORA-01841: (full) year must be between -4713 and +9999, and not be 0
    Col1     Col2     Col3     Col4     Col5     Col6     Col7     Col8     Col9     Col10     Col11     Col12
    2000-01-03 10:38:05.733000000          XX AA Change     0     DOG     CAT     R     2000-01-03 10:38:05.733000000     GIRAFFE          MONKEY     COW

  • BLOB data and SQL Loader

    Has any one used SQL Loader for BLOB data? I would think you can only use it for text type data.
    Thanks,
    Vic

    If each blob is in a separate file, then you should be able to use LOBFILES to load them. Each row in the data file would need to have the name of the file containing the blob for that row. File ulcase9.ctl in the demo directory shows an example of using LOBFILES to load a lob column.
    If you want the blob in the data file, then the data file needs to use types that have include length information in then, such as VARRAW, LONG VARRAW or VARRAWC. Also, the records for the data files cannot be terminated by a character string or newline. That's because the blob data might contain the character string or newline in the middle of its data. Instead, you would need to use the VAR record type.

  • ADVANCED SQL*LOADER

    제품 : ORACLE SERVER
    작성날짜 : 2002-04-25
    Advanced SQL*LOADER
    ====================
    PURPOSE
    Q&A를 통한 SQL*LOADER 사용 방법에 대해 알아보도록 한다.
    Explanation
    1) Carriage returns, linefeeds, EOL character를 load 하는 방법
    2) Delimiter 를 사용한 경우 특정 field 를 skip 할수 있나?
    3) "FIELD IN DATA FILE EXCEEDED MAXIMUM SPECIFIED LENGTH" 메세지
    해결 방법
    4) Blob 이나 raw data 는 어떻게 사용하나?
    5) Error LDR-510은 어떻게 처리하나?
    6) EBCDIC Characterset data file 은 어떻게 load 하나?
    7) Control file 에 WE8EBCDIC500 characterset 을 사용하였는데도
    SQL*Loader-266 가 발생하는 경우
    8) Decimal data는 어떻게 load 하는가?
    9) Trailing signs 이 있는 숫자는 어떻게 load 하는가?
    10) Zoned number는 무엇인가?
    11) Packed Decimal Number는 무엇인가?
    12) NULLIF 는 어떻게 사용하나 ?
    13) 한개의 single column을 위해 여러 개의 nullif는 사용가능한가?
    14) SQL*Loader 가 NULL 로 여기는 column 을 blank space 로
    여기도록 만들려면 ?
    15) WHEN 절은 어떻게 사용하나?
    16) WHEN 절에 OR 를 사용할수 있는가?
    17) Delimiter 로 ','를 사용하였는데 data 에 ','가 포함된 경우는?
    18) 어떻게 하면 commit 을 덜 사용할 수 있나?
    1) carriage returns, linefeeds, EOL character를 load 하기
    SQL*Loader 는 이들을 통해 서로 다른 physical record 로 인식한다.
    이들을 load 하기 위해 사용되는 option 은
    - concatenate
    - continueif
    - file processing option: FIX (PRE: 1012555.6 PRS: 2060647.6)
    - file processing option: VAR (PRE: 1011372.6 PRS: 2059405.6)
    예제1) concatenate 사용하기
    Control File: test.ctl
    load data
    infile 'test.dat'
    truncate
    concatenate (2)
    into table test
    (col1 char(2000))
    Data File: 'test.dat'
    This is a test \n
    this is the second Line.
    This is a new record\n
    this is the second line of the second record
    결과:
    SQL> select * from test;
    COL1
    This is a test \nthis is the second Line.
    This is a new record\nthis is the second line of the second record
    예제2) continueif 를 사용하기
    Control File: test.ctl
    load data
    infile test.dat
    truncate
    continueif this (1) = '*'
    into table test
    (col1 char(64000))
    Data File: 'test.dat'
    *11111111111
    *22222222222
    *33333333333
    *44444444444
    *55555555555
    66666666666
    *77777777777
    *88888888888
    999999999999
    *aaaaaaaaaaa
    *bbbbbbbbbbb
    cccccccccccc
    *ddddddddddd
    *eeeeeeeeeee
    *fffffffffff
    *ggggggggggg
    *hhhhhhhhhhh
    결과 :
    SQL> select * from test;
    COL1
    11111111111222222222223333333333344444444444555555555556666666666
    777777777778888888888899999999999
    aaaaaaaaaaabbbbbbbbbbbccccccccccc
    dddddddddddeeeeeeeeeeefffffffffffggggggggggghhhhhhhhhhh
    2) delimiter 를 사용한 경우 특정 field 를 skip 할수 있나 ?
    : 불가능하다 (RTSS Bulletin: 103235.426)
    3): 모든 column 에 해당 column 에 해당하는 length 를 지정하였는데
    다음과 같은 error message 를 접한 경우 :
    "FIELD IN DATA FILE EXCEEDED MAXIMUM SPECIFIED LENGTH"
    :255 자 이상의 char/varchar2/long field 를 load 하려한 경우
    이 경우는 CHAR data type 의 buffer size 를 증가 시켜야 한다.
    이의 default 는 255 이다.
    예제)
    load data
    into table
    (col1 char(64000))
    이 경우 buffer 를 64K 로 증가시켜 col1 에 load 해야 한다.
    <주의> 64K 는 sql*loader 에서 사용 가능한 maximum record length이다.
    이는 1 record 를 여러개의 buffer 를 통해 load 하지 못하는 문제이다.
    최대 buffer 는 64k 이다.
    64 K 이상을 원하는 경우
    a) 여러개의 작은 chunk 로 나누거나,
    b) SQL*Loader 를 사용하지 못한다.
    4) blob 이나 raw data 는 어떻게 사용하나 ?
    : RAW datatype 을 사용하고 length를 부여한다.
    예제)
    LOAD DATA
    INFILE xx.dat "VAR"
    REPLACE
    INtO TABLE test
    (BLOB raw (32767) )
    xx.dat 는 load 하고자 하는 전체 file 이다.
    이는 bit mapped files 이나, 그외 file type 을 DB 에 load 시
    사용 가능한 option 이다.
    5) error LDR-510은 어떻게 처리한가 ?
    : LDR-510은 data file 안의 physical record가 최대값인 64K 를
    넘은 경우이다.
    SQL*Loader 에서는 physical record 가 연속적이어야 하며, 이는
    최대인 64k 를 넘지 못하는 제한이 있기 때문이다.
    (여러 buffers 를 통해 load 불가능)
    이는 위의 1번과 같으므로 physical record 를 여러 logical record 로
    나누어야 한다.
    6) EBCDIC Characterset data file 은 어떻게 load 하나 ?
    : control file 에 characterset 을 명시한다.
    많이 사용되는 EBCDIC character set 은 WE8EBCDIC500 이다.
    예제)
    load data
    characterset we8ebcdic500
    infile *
    replace
    into table for_load
    (x)
    begindata
    B
    Z
    X
    SQL> select * from for_load;
    X
    a
    i
    이는 ASCII 의 경우도 같다.
    7) control file 에 WE8EBCDIC500 characterset 을 사용하였는데도
    SQL*Loader-266 가 발생하는 경우
    환경변수인 ORA_NLS 가 맞게 설정되었는지를 check 한다.
    (PRE: 1012552.6 PRS: 2060644.6)
    8) decimal data 는 어떻게 load 하는가?
    : data 를 조작하는 방법밖에 없다.즉 decimal point 가 들어가게
    data 를 조작한다.
    예제)
    load data
    infile *
    truncate
    into table test
    (col1 integer external(5) ":col1/100")
    begindata
    12345
    10000
    24983
    SQL> select * from test;
    COL1
    123.45
    100
    249.83
    9) trailing signs 이 있는 숫자는 어떻게 load 하는가?
    예제)
    load data
    infile *
    truncate
    into table loadnums
    (col1 position(1:5),
    col2 position(7:16) "to_number(:col2,'99,999.99MI')")
    begindata
    abcde 1,234.99-
    abcde 11,234.34+
    abcde 45.23
    abcde 99,234.38-
    abcde 23,234.23+
    abcde 98,234.23+
    SQL> select * from loadnums;
    COL1 COL2
    abcde -1234.99
    abcde 11234.34
    abcde -99234.38
    abcde 23234.23
    abcde 98234.23
    <주의> 이경우 log file 에 다음의 error message 를 볼수있다.
    Record 3: Rejected - Error on table LOADNUMS, column COL2.
    ORA-01722: invalid number
    이 error message 는 당연한 것이다.
    왜냐면 control file 에 number datatype 에 mask 를 주었기 때문에
    모든 number 는 mask 를 가져야 한다.
    이때 Record 3은 trailing sign 이 없기 때문에 reject 된 것이다.
    10) zoned number는 무엇인가?
    이는 decimal digit 의 string 으로 1byte 에 1 string 이 해당된며,
    부호가 맨 마지막byte 에 포함되는 경우이다.
    예제)
    LOAD DATA
    infile *
    append
    INTO TABLE test
    (col1 position(1:3) zoned(3),
    col2 position(4:6),
    col3 position(7:8))
    begindata
    12J43323
    43023423
    SQL> select * from test;
    COL1 COL2 COL3
    -121 433 23
    430 234 23
    2 rows selected.
    다음은 zoned values의 map 이다:
    {ABCDEFGHI}JKLMNOPQR0123456789
    ++++++++++----------++++++++++
    {ABCDEFGHI}JKLMNOPQR
    01234567890123456789
    11) Packed Decimal Number는 무엇인가 ?
    : packed decimal format은 bytes 로 이루어진 1 string 의 모음인데
    각각은 2 digit (2 nibbles) 을 가진다.
    이중 마지막 byte 는 1 digit 와 sign 으로 이루어진다.
    이 sign 은 보통 0x0a, 0x0b, ..., 0x0f: usually 0x0c/a/e/f for +ve,
    0x0d/b for -ve 로 이루어져 있다.
    예를 들어 +123 의 packed decimal 표현은 다음과 같다.
    [12] [3C] 이고 이때 [12] 는 nibbles 0x01 and 0x02를 포함하는
    byte 이다. [3C]의 경우도 같다.
    The kernel 은 sing nibble 의 여부를 ttcp2n() 을 통해 check한다.
    만일 0x0a, ..., 0x0f 중의 하나가 아니면 ORA-1488 error 를 발생시킨다.
    <주의> BUG:296890:
    이는 bug 는 아니며, SQL*Loader 는 COBOL 에서 발생시키는 UNSIGNED
    packed decimal 을 support 하지 않는다.
    즉 SQL*Loader 는 packed decimal을 load 시 마지막 byte 가 반드시
    1 digit와 ,sign 이 포함되어지는지 check 한다.
    12) NULLIF 는 어떻게 사용하나 ?
    예제)
    load data
    infile *
    truncate
    into table test
    fields terminated by ','
    (col1 date "mm/dd/yy" nullif col1='0', col2)
    begindata
    0,12345
    11/11/95,12345
    0,12345
    11/11/95,12345
    SQL> select * from test;
    COL1 COL2
    12345
    11-NOV-95 12345
    12345
    11-NOV-95 12345
    13) 한개의 single column을 위해 여러 개의 nullif 는 사용가능한가 ?
    : 불가능하다. 그러나 workaround 로는
    예제)
    load data
    infile *
    truncate
    into table test
    fields terminated by ',' optionally enclosed by '"'
    (col1,col2 "decode(:col2,'X',NULL,'Y',NULL,'Z',NULL,:col2)",col3)
    begindata
    12345,"X",12345
    12345,"A",12345
    12345,"Y",12345
    12345,"Z",12345
    12345,"B",12345
    SQLDBA> select * from test;
    COL1 COL2 COL3
    12345 12345
    12345 A 12345
    12345 12345
    12345 12345
    12345 B 12345
    5 rows selected.
    14) SQL*Loader 가 NULL 로 여기는 column 을 blank space 로 여기도록
    만들려면 ?
    : PRESERVE BLANKS를 사용하지 않으면 loader 는 blank 들을 null 로
    인식한다.
    이 경우 workaround 로는
    예제)
    load data
    infile *
    into table test
    fields terminated by ','
    (col1 position(1:5) integer external,
    col2 position(15:20) char "nvl(:col2,' ')",
    col3 position(25:30) integer external)
    begindata
    12345 rec1 12345
    12345 23453
    23333 rec3 29874
    98273 98783
    98723 rec5 234
    SQL> select * from test yields;
    COL1 COL2 COL3
    12345 rec1 12345
    12345 23453
    23333 rec3 29874
    98273 98783
    98723 rec4 234
    5 rows selected.
    15) WHEN 절은 어떻게 사용한가 ?
    예제)
    load data
    infile *
    truncate
    into table t1
    when col1 = '12345'
    (col1 position(1:5) integer external, col2 position(7:12) char)
    into table t2
    when col1 = '54321'
    (col1 position(1:5) integer external, col2 position(7:12) char)
    begindata
    12345 table1
    54321 table2
    99999 no tab
    12345 table2
    54321 table2
    SQL> select * from t1;
    COL1 COL2
    12345 table1
    12345 table2
    SQL> select * from t2;
    COL1 COL2
    54321 table2
    54321 table2
    16) WHEN 절에 OR 를 사용할수 있는가 ?
    : 불가능하다 그러나 workaround 로는
    예제) 만일 where (col1=12345 OR col1=54321) AND col2='rowena'경우에
    data 를 insert 하고자 하면
    load data
    infile *
    truncate
    into table test
    when col1 = '12345' and col2='rowena'
    (col1 position(1:5) integer external, col2 position(7:12) char)
    into table test
    when col1 = '54321' and col2='rowena'
    (col1 position(1:5) integer external, col2 position(7:12) char)
    begindata
    12345 rowena
    43234 rowena
    54321 rowena
    (즉, OR를 갖지 못하나, 같은 table 에 두개의 when 은 가질수있다.)
    SQLDBA> select * from test;
    COL1 COL2
    12345 rowena
    54321 rowena
    2 rows selected.
    17) delimiter 로 ','를 사용하였는데 data 에 ','가 포함된 경우는 ?
    : 두 번 지정한다.
    예제)
    load 할 data 가 col1, rowena, rowena, col3 이고
    datafile 이 다음과 같은 경우
    col1, rowena,, rowena, col3
    select * from table:
    COL1 COL2 COL3
    col1 rowena, rowena col3
    18) 어떻게 하면 commit 을 덜 사용할 수 있나 ?
    : rows 나 bindsize를 사용한다.
    그러나 bindsize 가 적은 경우 bindsize는 rows 를 많이 적재할 수
    있으므로 항상 1 bindsize 에 몇 개의 rows 가 set 되었는지에 관계
    없이 bindsize에 commit 이 수행된다.
    Reference Document
    ------------------

    hi,
    pls take a look at this document
    http://www.petefinnigan.com/weblog/archives/00000020.htm
    regards,

  • SQL*Loaderの制御ファイルでSQL*Loader-350エラー

    Oracle DB 11gR2 Standard Edition One
    Red Hat Enterprise Linux 6.0
    オフライン
    こんにちは。
    SQL*Loaderにて、データをロードしています。
    データファイルに空白のみの項目があった場合にNULLが入るようにしたいのですが、
    制御ファイルの演算の後にNULLIF ・・・をいれると以下のようなエラーがでてしまいます。
    SQL*Loader-350: 行20に構文エラーがあります。
    "、"または")"ではなくキーワードnullifが見つかりました。
    , time "TO_DSINTERVAL('0 00:' || :time) NULLIF time=BLANKS
                          ^
    time列のデータ型は、INTERVAL DAY TO SECOND(1)です。
    制御ファイルでは以下のように記述しています。
    INTO TABLE     test.t_test
    REPLACE
    FIELDS TERMINATED BY ','
    TRAILING NULLCOLS
    ( test_id
    time "TO_DSINTERVAL('0 00:' || :time) NULLIF time=BLANKS )
    NULLIF・・・を"TO_INTERVAL・・・"の前に書くと「間隔が無効です。」というエラーになります。
    このような場合、どのように記述したらよいでしょうか?
    また、この方法以外に空白のみの項目があった場合NULLが入るようにする方法が
    ありましたら、教えていただければと思います。
    よろしくお願い致します。

    ご回答ありがとうございます。
    time "DECODE(:time , ' ' , TO_DSINTERVAL('0 00:' || :time))"
    で、正常にロードすることができました!
    time "NVL2(TRIM(:time),TO_DSINTERVAL('0 00:' || :time),NULL)"
    も試してみたのですが、ORA-01867:間隔が無効です。というエラーがでました。
    間隔とは・・・?
    今回したいことは、おかげさまで解決しましたので、このエラーについては別の機会に調べてみます。
    ありがとうございました。

  • Sql loader: loading external file into blob

    hi,
    i keep being blocked by loading external binary files into a blob columns with sql loader tool.
    Here is the problem:
    I want to load pictures into a table with lob columns. Here is my control file, data file and the error message:
    control file:
    LOAD DATA
    APPEND
    INTO TABLE T_K58_SYMBOLE
    FIELDS TERMINATED BY ';' TRAILING NULLCOLS
    SYMB_ID INTEGER EXTERNAL(8),
    SYMB_LMLABEL CHAR(100),
    imgName FILLER,
    SYMB_GIF_HI BFILE(CONSTANT ".", imgName),
    thumbName FILLER,
    SYMB_GIF_LOW BFILE(CONSTANT ".", thumbName)
    data file:
    1;0800;image1.gif;image1.gif;
    error message:
    SQL*Loader-418: Bad datafile datatype for column SYMB_GIF_HI
    Here is the script of the creation of my table in my database:
    create table T_K58_SYMBOLE (
    SYMB_ID NUMBER(8) not null,
    SYMB_LMLABEL VARCHAR2(100),
    SYMB_GIF_HI BLOB,
    SYMB_GIF_LOW BLOB,
    constraint PK_T_K58_SYMBOLE primary key (SYMB_ID)
    LOB (SYMB_GIF_HI, SYMB_GIF_LOW) STORE AS (tablespace TDK5813)
    tablespace TDK5811
    Please, i need help!!!!

    This is my control file. I'm loading images in database table using sqlldr in Unix:
    LOAD DATA
    INFILE 'sampledata.dat'
    INTO TABLE image_table
    APPEND
    FIELDS TERMINATED BY ',' optionally enclosed by '"'
    IMAGE_ID INTEGER EXTERNAL,
    FILE_NAME CHAR,
    IMAGE_DATA LOBFILE(FILE_NAME) TERMINATED BY EOF
    I'm facing following error:
    SQL*Loader-350: Syntax error at line 9.
    Expecting "," or ")", found "LOBFILE".
    IMAGE_DATA LOBFILE(FILE_NAME) TERMINATED BY EOF
    My data file is:
    1,"IMG_3126.jpg"
    2,"IMG_3127.jpg"
    3,"IMG_3128.jpg"
    and images are in the same server. please help me to get out of this.
    Thanks,
    Surjeet Kaur

  • Sql loader - BLOB

    I have used OMWB "generate Sql Loader script " option. ANd received the sql loader error.
    The previous attempt to use OMWB online loading has generated garbage data. The picture was not matching with the person id.
    Table in Sql Server..................
    CREATE TABLE [nilesh] (
         [LargeObjectID] [int] NOT NULL ,
         [LargeObject] [image] NULL ,
         [ContentType] [varchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
         [LargeObjectName] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
         [LargeObjectExtension] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
         [LargeObjectDescription] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
         [LargeObjectSize] [int] NULL ,
         [VersionControl] [bit] NULL ,
         [WhenLargeObjectLocked] [datetime] NULL ,
         [WhoLargeObjectLocked] [char] (11) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
         [LargeObjectTimeStamp] [timestamp] NOT NULL ,
         [LargeObjectOID] [uniqueidentifier] NOT NULL
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    Table in Oracle..............
    CREATE TABLE LARGEOBJECT
    LARGEOBJECTID NUMBER(10) NOT NULL,
    LARGEOBJECT BLOB,
    CONTENTTYPE VARCHAR2(40 BYTE),
    LARGEOBJECTNAME VARCHAR2(255 BYTE),
    LARGEOBJECTEXTENSION VARCHAR2(10 BYTE),
    LARGEOBJECTDESCRIPTION VARCHAR2(255 BYTE),
    LARGEOBJECTSIZE NUMBER(10),
    VERSIONCONTROL NUMBER(1),
    WHENLARGEOBJECTLOCKED DATE,
    WHOLARGEOBJECTLOCKED CHAR(11 BYTE),
    LARGEOBJECTTIMESTAMP NUMBER(8) NOT NULL,
    LARGEOBJECTOID RAW(16) NOT NULL
    TABLESPACE USERS
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCOMPRESS
    LOB (LARGEOBJECT) STORE AS
    ( TABLESPACE USERS
    ENABLE STORAGE IN ROW
    CHUNK 8192
    PCTVERSION 10
    NOCACHE
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    NOCACHE
    NOPARALLEL
    MONITORING;
    Sql Loader script....
    SET NLS_DATE_FORMAT=Mon dd YYYY HH:mi:ssAM
    REM SET NLS_TIMESTAMP_FORMAT=Mon dd YYYY HH:mi:ss:ffAM
    REM SET NLS_LANGUAGE=AL32UTF8
    sqlldr cecildata/@ceciltst control=LARGEOBJECT.ctl log=LARGEOBJECT.log
    Sql loader control file......
    load data
    infile 'nilesh.dat' "str '<er>'"
    into table LARGEOBJECT
    fields terminated by '<ec>'
    trailing nullcols
    (LARGEOBJECTID,
    LARGEOBJECT CHAR(2000000) "HEXTORAW (:LARGEOBJECT)",
    CONTENTTYPE "DECODE(:CONTENTTYPE, CHR(00), ' ', :CONTENTTYPE)",
    LARGEOBJECTNAME CHAR(255) "DECODE(:LARGEOBJECTNAME, CHR(00), ' ', :LARGEOBJECTNAME)",
    LARGEOBJECTEXTENSION "DECODE(:LARGEOBJECTEXTENSION, CHR(00), ' ', :LARGEOBJECTEXTENSION)",
    LARGEOBJECTDESCRIPTION CHAR(255) "DECODE(:LARGEOBJECTDESCRIPTION, CHR(00), ' ', :LARGEOBJECTDESCRIPTION)",
    LARGEOBJECTSIZE,
    VERSIONCONTROL,
    WHENLARGEOBJECTLOCKED,
    WHOLARGEOBJECTLOCKED,
    LARGEOBJECTTIMESTAMP,
    LARGEOBJECTOID "GUID_MOVER(:LARGEOBJECTOID)")
    Error Received...
    Column Name Position Len Term Encl Datatype
    LARGEOBJECTID FIRST * CHARACTER
    Terminator string : '<ec>'
    LARGEOBJECT NEXT ***** CHARACTER
    Maximum field length is 2000000
    Terminator string : '<ec>'
    SQL string for column : "HEXTORAW (:LARGEOBJECT)"
    CONTENTTYPE NEXT * CHARACTER
    Terminator string : '<ec>'
    SQL string for column : "DECODE(:CONTENTTYPE, CHR(00), ' ', :CONTENTTYPE)"
    LARGEOBJECTNAME NEXT 255 CHARACTER
    Terminator string : '<ec>'
    SQL string for column : "DECODE(:LARGEOBJECTNAME, CHR(00), ' ', :LARGEOBJECTNAME)"
    LARGEOBJECTEXTENSION NEXT * CHARACTER
    Terminator string : '<ec>'
    SQL string for column : "DECODE(:LARGEOBJECTEXTENSION, CHR(00), ' ', :LARGEOBJECTEXTENSION)"
    LARGEOBJECTDESCRIPTION NEXT 255 CHARACTER
    Terminator string : '<ec>'
    SQL string for column : "DECODE(:LARGEOBJECTDESCRIPTION, CHR(00), ' ', :LARGEOBJECTDESCRIPTION)"
    LARGEOBJECTSIZE NEXT * CHARACTER
    Terminator string : '<ec>'
    VERSIONCONTROL NEXT * CHARACTER
    Terminator string : '<ec>'
    WHENLARGEOBJECTLOCKED NEXT * CHARACTER
    Terminator string : '<ec>'
    WHOLARGEOBJECTLOCKED NEXT * CHARACTER
    Terminator string : '<ec>'
    LARGEOBJECTTIMESTAMP NEXT * CHARACTER
    Terminator string : '<ec>'
    LARGEOBJECTOID NEXT * CHARACTER
    Terminator string : '<ec>'
    SQL string for column : "GUID_MOVER(:LARGEOBJECTOID)"
    SQL*Loader-309: No SQL string allowed as part of LARGEOBJECT field specification
    what's the cause ?

    The previous attempt to use OMWB online loading has generated garbage data. The picture was not matching with the person id.This is being worked on (bug4119713) If you have a reproducible testcase please send it in (small testcases seem to work ok).
    I have the following email about BLOBS I could forward to you if I have your email address:
    [The forum may cut the lines in the wrong places]
    Regards,
    Turloch
    Oracle Migration Workbench Team
    Hi,
    This may provide the solution. Without having the customer files here I can only guess at the problem. But this should help.
    This email outlines a BLOB data move.
    There are quiet a few steps to complete the task of moving a large BLOB into the Oracle database.
    Normally this wouldn't be a problem, but as far as we can tell SQL Server's (and possibly Sybase) BCP does not reliably export binary data.
    The only way to export binary data properly via BCP is to export it in a HEX format.
    Once in a HEX format it is difficult to get it back to binary during a data load into Oracle.
    We have come up with the idea of getting the HEX values into Oracle by saving them in a CLOB (holds text) column.
    We then convert the HEX values to binary values and insert them into the BLOB column.
    The problem here is that the HEXTORAW function in Oracle only converts a maximum of 2000 HEX pairs.
    We over came this problem by writing our own procedure that will convert (bit by bit) your HEX data to binary.
    NOTE: YOU MUST MODIFY THE START.SQL AND FINISH.SQL TO SUIT YOUR CUSTOMER
    The task is split into 4 sub tasks
    1) CREATE A TABLESPACE TO HOLD ALL THE LOB DATA
    --log into your system schema and create a tablespace
    --Create a new tablespace for the CLOB and BLOB column (this may take a while to create)
    --You may resize this to fit your data ,
    --but I believe you have in excess of 500MB of data in this table and we are going to save it twice (in a clob then a blob)
    --Note: This script may take some time to execute as it has to create a tablespace of 1000Mb.
    -- Change this to suit your customer.
    -- You can change this if you want depending on the size of your data
    -- Remember that we save the data once as CLOB and then as BLOB
    create tablespace lob_tablespace datafile 'lob_tablespace' SIZE 1000M AUTOEXTEND ON NEXT 50M;
    LOG INTO YOUR TABLE SCHEMA IN ORACLE
    --Modify this script to fit your requirements
    2) START.SQL (this script will do the following tasks)
    a) Modify your current schema so that it can accept HEX data
    b) Modify your current schema so that it can hold that huge amount of data.
    The new tablespace is used; you may want to alter this to your requirements
    c) Disable triggers, indexes & primary keys on tblfiles
    3)DATA MOVE
    The data move now involves moving the HEX data in the .dat files to a CLOB.
    The START.SQL script adds a new column to <tablename> called <blob_column>_CLOB.
    This is where the HEX values will be stored.
    MODIFY YOUR CONTROL FILE TO LOOK LIKE THISload data
    infile '<tablename>.dat' "str '<er>'"
    into table <tablename>
    fields terminated by '<ec>'
    trailing nullcols
    <blob_column>_CLOB CHAR(200000000),
    The important part being "_CLOB" appended to your BLOB column name and the datatype set to CHAR(200000000)
    RUN sql_loader_script.bat
    log into your schema to check if the data was loaded successfully-- now you can see that the hex values were sent to the CLOB column
    SQL> select dbms_lob.getlength(<blob_column>),dbms_lob.getlength(<blob_column>_clob) from <tablename>;
    LOG INTO YOUR SCHEMA
    4)FINISH.SQL (this script will do the following tasks)
    a) Creates the procedure needed to perform the CLOB to BLOB transformation
    b) Executes the procedure (this may take some time a 500Mb has to be converted to BLOB)
    c) Alters the table back to its original form (removes the <blob_column>_clob)
    b) Enables the triggers, indexes and primary keys
    Regards,
    (NAME)
    -- START.SQL
    -- Modify this for your particular customer
    -- This should be executed in the user schema in Oracle that contains the table.
    -- DESCRIPTION:
    -- ALTERS THE OFFENDING TABLE SO THAT THE DATA MOVE CAN BE EXECUTED
    -- DISABLES TRIGGERS, INDEXES AND SEQUENCES ON THE OFFENDING TABLE
    -- 1) Add an extra column to hold the hex string
    alter table <tablename> add (FILEBINARY_CLOB CLOB);
    -- 2) Allow the BLOB column to accpet NULLS
    alter table <tablename> MODIFY FILEBINARY NULL;
    -- 3) Dissable triggers and sequences on tblfiles
    alter trigger <triggername> disable;
    alter table tblfiles drop primary key cascade;
    drop index <indexname>;
    -- 4) Allow the table to use the tablespace
    alter table <tablename> move lob (<blob_column>) store as (tablespace lob_tablespace);
    alter table tblfiles move lob (<blob_column>clob) store as (tablespace lobtablespace);
    COMMIT;
    -- END OF FILE
    -- FINISH.SQL
    -- Modify this for your particular customer
    -- This should be executed in the table schema in Oracle.
    -- DESCRIPTION:
    -- MOVES THE DATA FROM CLOB TO BLOB
    -- MODIFIES THE TABLE BACK TO ITS ORIGIONAL SPEC (without a clob)
    -- THEN ENABLES THE SEQUENCES, TRIGGERS AND INDEXES AGAIN
    -- Currently we have the hex values saved as text in the <columnname>_CLOB column
    -- And we have NULL in all rows for the <columnname> column.
    -- We have to get BLOB locators for each row in the BLOB column
    -- put empty blobs in the blob column
    UPDATE <tablename> SET filebinary=EMPTY_BLOB();
    COMMIT;
    -- create the following procedure in your table schema
    CREATE OR REPLACE PROCEDURE CLOBTOBLOB
    AS
    inputLength NUMBER; -- size of input CLOB
    offSet NUMBER := 1;
    pieceMaxSize NUMBER := 50; -- the max size of each peice
    piece VARCHAR2(50); -- these pieces will make up the entire CLOB
    currentPlace NUMBER := 1; -- this is where were up to in the CLOB
    blobLoc BLOB; -- blob locator in the table
    clobLoc CLOB; -- clob locator pointsthis is the value from the dat file
    -- THIS HAS TO BE CHANGED FOR SPECIFIC CUSTOMER TABLE AND COLUMN NAMES
    CURSOR cur IS SELECT <blob_column>clob clobcolumn , <blob_column> blob_column FROM /*table*/<tablename> FOR UPDATE;
    cur_rec cur%ROWTYPE;
    BEGIN
    OPEN cur;
    FETCH cur INTO cur_rec;
    WHILE cur%FOUND
    LOOP
    --RETRIVE THE clobLoc and blobLoc
    clobLoc := cur_rec.clob_column;
    blobLoc := cur_rec.blob_column;
    currentPlace := 1; -- reset evertime
    -- find the lenght of the clob
    inputLength := DBMS_LOB.getLength(clobLoc);
    -- loop through each peice
    LOOP
    -- get the next piece and add it to the clob
    piece := DBMS_LOB.subStr(clobLoc,pieceMaxSize,currentPlace);
    -- append this peice to the BLOB
    DBMS_LOB.WRITEAPPEND(blobLoc, LENGTH(piece)/2, HEXTORAW(piece));
    currentPlace := currentPlace + pieceMaxSize ;
    EXIT WHEN inputLength < currentplace;
    END LOOP;
    FETCH cur INTO cur_rec;
    END LOOP;
    END CLOBtoBLOB;
    -- now run the procedure
    -- It will update the blob column witht the correct binary represntation of the clob column
    EXEC CLOBtoBLOB;
    -- drop the extra clob cloumn
    alter table <tablename> drop column <blob_column>_clob;
    -- 2) apply the constraint we removed during the data load
    alter table <tablename> MODIFY FILEBINARY NOT NULL;
    -- Now re enable the triggers,indexs and primary keys
    alter trigger <triggername> enable;
    ALTER TABLE TBLFILES ADD ( CONSTRAINT <pkname> PRIMARY KEY ( <column>) ) ;
    CREATE INDEX <index_name> ON TBLFILES ( <column> );
    COMMIT;
    -- END OF FILE

  • How to load XML file to table (non-XML) with SQL*Loader -- issue with nulls

    I have been attempting to use SQL*Loader to load an XML file into a "regular" Oracle table. All fields work fine, unless a null is encountered. The way that nulls are represented is shown below:
    <PAYLOAD>
    <FIELD1>ABCDEF</FIELD1>
    <FIELD2/>
    <FIELD3>123456</FIELD3>
    </PAYLOAD>
    In the above example, FIELD2 is a null field and that is the way it is presented. I have searched everywhere and have not found how I could code for this. The issue is that if FIELD2 is present, it is coded like: <FIELD2>SOMEDATA</FIELD2>, but the null is represented as <FIELD2/>. Here is a sample of the control file I am using to attempt the load -- very simplistic, but works fine when fields are present:
    load data
    infile 'testdata.xml' "str '<PAYLOAD>'"
    TRUNCATE
    into table DATA_FROM_XML
    FIELD1 ENCLOSED BY '<FIELD1>' AND '</FIELD1>',
    FIELD2 ENCLOSED BY '<FIELD2>' AND '</FIELD2>',
    FIELD3 ENCLOSED BY '<FIELD3>' AND '</FIELD3>')
    What do I need to do to account for the way that nulls are presented? I have tried everything I could glean from the web and the documentation and nothing has worked. Any help would be really appreciated.

    I hadn't even got that far. can you direct me to where the docs are to import data that is stored within xml but that you don't need any xml functionality, that just happens to be the format the data is stored in? thx

  • SQL*LOADER how to load blanks when data is null

    I need to load data which contains null values into a table which cannot contains nulls. How can I tell SQL*LOADER to load blanks in a column when the input data is nulls?

    I think something like this in your control file should work:
    col1 char(10) nvl(col1,' ')

  • URGENT: Problems Loading files with SQL Loader into a BLOB column

    Hi friends,
    I read a lot about how to load files into blob columns, but I found errors that I can't solve.
    I've read several notes in these forums, ine of them:
    sql loader: loading external file into blob
    and tried the solutions but without good results.
    Here are some of my tests:
    With this .ctl:
    LOAD DATA
    INFILE *
    INTO TABLE mytable
    REPLACE
    FIELDS TERMINATED BY ','
    number1 INTEGER EXTERNAL,
    cad1 CHAR(250),
    image1 LOBFILE(cad1) TERMINATED BY EOF
    BEGINDATA
    1153,/opt/oracle/appl/myapp/1.0.0/img/1153.JPG,
    the error when I execute sqlldr is:
    SQL*Loader-350: Syntax error at line 9.
    Expecting "," or ")", found "LOBFILE".
    image1 LOBFILE(cad1) TERMINATED BY EOF
    ^
    What problem exists with LOBFILE ??
    (mytable of course has number1 as a NUMBER, cad1 as VARCHAR2(250) and image1 as BLOB
    I tried too with :
    LOAD DATA
    INFILE sample.dat
    INTO TABLE mytable
    FIELDS TERMINATED BY ','
    (cad1 CHAR(3),
    cad2 FILLER CHAR(30),
    image1 BFILE(CONSTANT "/opt/oracle/appl/myapp/1.0.0/img/", cad2))
    sample.dat is:
    1153,1153.JPEG,
    and error is:
    SQL*Loader-350: Syntax error at line 6.
    Expecting "," or ")", found "FILLER".
    cad2 FILLER CHAR(30),
    ^
    I tried too with a procedure, but without results...
    Any idea about this error messages?
    Thanks a lot.
    Jose L.

    > So you think that if one person put an "urgent" in the subject is screwing the problems of
    other people?
    Absolutely. As you are telling them "My posting is more important than yours and deserve faster attention and resolution than yours!".
    So what could a typical response be? Someone telling you that his posting is more important by using the phrase "VERY URGENT!". And the next poster may decide that, no, his problem is evern more import - and use "EXTREMELY URGENT!!" as the subject. And the next one then raises the stakes by claiming his problem is "CODE RED! CRITICAL. DEFCON 4. URGENT!!!!".
    Stupid, isn't it? As stupid as your instance that there is nothing wrong with your pitiful clamoring for attention to your problem by saying it is urgent.
    What does the RFC's say about a meaningful title/subject in a public forum? I trust that you know what a RFC is? After all, you claim to have used public forums on the Internet for some years now..
    The RFC on "public forums" is called The Usenet Article Format. This is what it has to say about the SUBJECT of a public posting:
    =
    The "Subject" line (formerly "Title") tells what the message is about. It should be suggestive enough of the contents of the message to enable a reader to make a decision whether to read the message based on the subject alone. If the message is submitted in response to another message (e.g., is a follow-up) the default subject should begin with the four characters "Re: ", and the "References" line is required. For follow-ups, the use of the "Summary" line is encouraged.
    =
    ([url http://www.cs.tut.fi/~jkorpela/rfc/1036.html]RFC 1036, the Usenet article format)
    Or how about [url http://www.cs.tut.fi/~jkorpela/usenet/dont.html]The seven don'ts of Usenet?
    Point 7 of the Don'ts:
    Don't try to catch attention by typing something foolish like "PLEASE HELP ME!!!! URGENT!!! I NEED YOUR HELP!!!" into the Subject line. Instead, type something informative (using normal mixed case!) that describes the subject matter.
    Please tell me that you are not too thick to understand the basic principles of netiquette, or to argue with the RFCs that governs the very fabric of the Internet.
    As for when I have an "urgent" problem? In my "real" work? I take it up with Oracle Support on Metalink by filing an iTAR/SR. As any non-idiot should do with a real-life Oracle crisis problem.
    I do not barge into a public forum like you do, jump up and down, and demand quick attention by claiming that my problem is more important and more urgent and more deserving of attention that other people's problem in the very same forum.

  • Sql Loader - Decimal numbers showing in null column

    Greetings,
    My apologies if this is in the wrong forum section. It seemed to be the most logical.
    I have added new column to a control file used in a sql loader upload and I am getting unexpected results. Long story short, I copy foxpro tables from a network directory to my local pc. A foxpro exe converts these tables to .dat files. Sql loader then uploads the .dat files to matching oracle tables. I've run this program from my pc for years with no problems.
    Problem now: We added a new column to a foxpro table and to the matching oracle table. This column in FoxPro in null for now - no data at all. I then added the new column to my ctl file for this table. The program runs, sql loader does it's thing with no errors. However, in the new field in Oracle, I'm finding decimal numbers in many of the records, when all records should have null values in this field. I've checked all other columns in the oracle table and the data looks accurate. I'm not sure why I'm getting these decimal values in the new column.
    My log and bad files show no hints of any problems. The bad file is empty for this table.
    At first I thought the positioning of the new column in the fox table, .ctl file and the oracle table were not lining up correctly, but I checked and they are.
    I've double checked the FoxPro table and all records for this new column are null.
    I'm not sure what to check for next or what to test. I am hoping someone in this forum might lend a clue or has maybe seen this problem before. Below is my control file. The new column is the last one: fromweb_id. It is a number field in both FoxPro and Oracle.
    Thanks for any advise.
    JOBS table control file:
    load data
    infile 'convdata\fp_ora\JOBS.dat' "str X'08'"
    into table JOBS
    fields terminated by X'07'
    TRAILING NULLCOLS
    (SID,
    CO_NAME "replace(replace(:CO_NAME,chr(11),chr(10)),chr(15),chr(13))",
    JOB_TITLE "replace(replace(:JOB_TITLE,chr(11),chr(10)),chr(15),chr(13))",
    CREDITS,
    EARN_DATE date "mm/dd/yyyy",
    COMMENTS CHAR(2000) "replace(replace(:COMMENTS,chr(11),chr(10)),chr(15),chr(13))",
    DONT_SHOW,
    PC_SRC "replace(replace(:PC_SRC,chr(11),chr(10)),chr(15),chr(13))",
    PC_SRC_NO,
    SALARY,
    SALFOR,
    ROOM,
    BOARD,
    TIPS,
    UPD_DATE date "mm/dd/yyyy hh12:mi:ss am",
    STUKEY,
    JOBKEY,
    JO_COKEY,
    JO_CNKEY,
    JO_ZUKEY,
    EMPLID,
    CN_NAME "replace(replace(:CN_NAME,chr(11),chr(10)),chr(15),chr(13))",
    JOB_START date "mm/dd/yyyy",
    JOB_END date "mm/dd/yyyy",
    FROMWEB_ID)

    I apologize for not explaining how this was resolved. Sql Loader was working as it should.
    The problem was due to new fields being added to the FoxPro table, along with the fromweb_id column, that I was not informed about. I was asked to add a column named fromweb_id to the oracle jobs table and to the sql-loader program. I was not told that there were other columns added at the same time. In the foxpro table, the fromweb_id column was the last column added.
    The jobs.dat file contained data from all columns in the foxpro table, including all the new columns. I only added the "fromweb_id" to the control file, which is what I was asked to do. When it ran, it was getting values from one of the new columns and the values were being uploaded into the fromweb_id column in Oracle. It is that simple.
    When I had checked the FoxPro table earlier, I did not pickup on the other new columns. I was focussing in on looking for values in the fromweb_id column. When back-tracing data in the jobs.dat file, I found a value in the fromweb_id column that matched a value in a differnt column (new column) in FoxPro. That is when I realized the other new columns. I instantly knew what the problem was.
    Thanks for all the feedback. I'm sorry if this was an inconvenience to anyone. I'll try to dig a little deeper next time. Lessons learned...
    regards,

  • Importing oracle.sql.BLOB through SQL Loader

    Hello,
    Currently the system we have creates .sql files and executes them. This takes a long time, so we're attempting to change to using SQL Loader. The one problem I'm having that I can't seem to fix is finding out how to imitate the behavior of this SQL statement through SQL Loader:
    INSERT INTO KRSB_QRTZ_BLOB_TRIGGERS (BLOB_DATA,TRIGGER_GROUP,TRIGGER_NAME)
    VALUES (oracle.sql.BLOB@515263,'KCB-Delivery','PeriodicMessageProcessingTrigger')
    I tried creating a lobfile and placing the text oracle.sql.BLOB@515263 within it this way
    INTO TABLE KRSB_QRTZ_BLOB_TRIGGERS
    WHEN tablename = 'KRSB_QRTZ_BLOB_TRIGGERS'
    FIELDS TERMINATED BY ',' ENCLOSED BY '##'
    TRAILING NULLCOLS
    tablename FILLER POSITION(1),
    TRIGGER_NAME CHAR(80),
    TRIGGER_GROUP CHAR(80),
    ext_fname FILLER,
    BLOB_DATA LOBFILE(ext_fname) TERMINATED BY EOF
    However, as expected, it merely loaded the text "oracle.sql.BLOB@515263" into the database. So does anyone have any ideas of how to imitate that insert statement through SQL Loader? The only information I have available is the string "oracle.sql.BLOB@515263", no other files or anything to aid with actually getting the binary data.
    When the .sql file is run with that insert statement in it, a 1.2kb BLOB is inserted into the database versus a 22 byte BLOB that contains nothing useful when done through SQL Loader.
    Alex

    My preference is DBMS_LOB.LOADFROMFILE
    http://www.morganslibrary.org/reference/dbms_lob.html
    did you try it?

  • ORA-01841 Error when value for date col is NULL in .dat (using SQL Loader)

    Hello Gurus,
    I have some data in .dat file which needs to be loaded into oracle table. I am using SQL * Loader to do the job. Although "NULLIF col_name =BLANKS" works for character datatype, but when value for date col is NULL then I get ORA-01841 error. I have to make NULL for all rows withour value for date column
    Early reply will be highly appreciated
    Farooq

    Hi,
    May be this problem is not with the NULLIF. The value for the date column is not in proper date format.
    create table:
    create table kk (empno number, ename varchar2(20), deptno number, hiredate date)
    Control file:
    LOAD DATA
    INFILE 'd:\kk\empdata.dat'
    insert into TABLE kk ( empno position (1:2) integer external,
    ename position(4:5) char NULLIF ename=BLANKS,
    deptno position (7:8) integer external NULLIF deptno=BLANKS,
    hiredate position (10:20) date NULLIF hiredate=BLANKS)
    data file:
    10 KK 01-jan-2005
    20 10
    SELECT * FROM KK;
    EMPNO ENAME DEPTNO HIREDATE
    10 KK 01-JAN-05
    20 10
    Verify the data file.
    Hope it will help

Maybe you are looking for