Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2004
    Posts
    7

    Question Unanswered: How to insert a DBCLOB data?

    Hi,

    I am inserted a record into a table that contains a DBCLOB field, the record is successfully added after executing the statement except that the DBCLOB field has inserted nothing. I have tried all the followings for the DBCLOB field:

    'sample'
    n'sample'
    g'sample'

    all of them returned nothing for the field of the new record. Could anyone please give me some idea on it?

    The version of DB2 I am using is ESE UDB 8.1.5, thanks!

    Chunglun

  2. #2
    Join Date
    Mar 2004
    Posts
    448
    I don't know what exactly you are doing, but I simply use 'sample' to insert into the field.Infact,I created a table containing dbclob(1m),insert a record into that field and select it using substr(text,1,20)

    regards,

    mujeeb

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    I have not done DBCLOB, but here is how I have done CLOB

    HTH

    Sathyaram

    1. Created the files to be loaded into clob column txt1.001 and
    txt2.002 using notepad.
    2. Created a DEL ASCII file import.del with contents as below

    1,"txt1.001.0.25/"
    2,"txt1.002.0.25/"
    3,"txt1.003.0.15/"

    The string in the first line "txt1.001.0.25/" is called a LOB Locator
    Specifier.
    An LLS is a string indicating where LOB data can be found within a file.
    The format of the LLS is filename.ext.nnn.mmm/, where filename.ext is
    the name of the file that contains the LOB, nnn is the offset of the LOB
    within the file (measured in bytes), and mmm is the length of the LOB
    (in bytes). For example, an LLS of db2exp.001.123.456/ indicates that
    the LOB is located in the file db2exp.001, begins at an offset of 123
    bytes into the file, and is 456 bytes long. If the indicated size in the
    LLS is 0, the LOB is considered to have a length of 0. If the length is
    -1, the LOB is considered to be NULL and the offset and file name are
    ignored

    3. Created a table test_clob
    create table test_clob(a int not null primary key, b clob(10k))

    I have defined the table with a primary key so that I could use the
    insert_update option.

    4. Imported the data into test_clob

    E:\exports>db2 import from import.del of del lobs from e:\exports\
    modified by lobsinfile insert_update into test_clob

    SQL3109N The utility is beginning to load data from file "import.del".

    SQL3110N The utility has completed processing. "3" rows were read from the input file.

    SQL3221W ...Begin COMMIT WORK. Input Record Count = "3".

    SQL3222W ...COMMIT of any database changes was successful.

    SQL3149N "3" rows were processed from the input file. "3" rows were successfully inserted into the table. "0" rows were rejected.


    Number of rows read = 3
    Number of rows skipped = 0
    Number of rows inserted = 3
    Number of rows updated = 0
    Number of rows rejected = 0
    Number of rows committed = 3
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  4. #4
    Join Date
    Apr 2004
    Posts
    7
    Thanks!

    in fact, the case is originally using SQL server then transfer the database schema to DB2. It automatically alter the ntext datatype to dbclob datatype, it will insert data directly to the database, is there any other way that I can do that in stead of using text files?

    Chunglun

  5. #5
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    A program written, may be in C/C++, Java etc

    HTH

    sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  6. #6
    Join Date
    Apr 2004
    Posts
    7
    The case is that, I am using C# to do the insertion, when I select the data, it returned an empty record of the field only...

    The codeset of database and the code pages both are in utf-8, may anyone kindly give me some suggestion on it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •