Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2004
    Posts
    16

    Question Unanswered: inseting lobs from cli

    We have db2 7.2 for OS/390 with the connect clinet. All the latest fixpacks installed etc.

    Someone asked if a lob could be inserted into a table from the command line. (Using the connect client on a linux or windows machine)

    I never tried to insert lobs that way. Can it be done?

    Any input would be helpful
    Thanks
    Bob.

  2. #2
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    Quote Originally Posted by winterb
    We have db2 7.2 for OS/390 with the connect clinet. All the latest fixpacks installed etc.

    Someone asked if a lob could be inserted into a table from the command line. (Using the connect client on a linux or windows machine)

    I never tried to insert lobs that way. Can it be done?

    Any input would be helpful
    Thanks
    Bob.
    CLP, not CLI.

    Yes, you can. Here's a clob:

    db2 "create table blah4 (a clob(100))"
    DB20000I The SQL command completed successfully.

    db2 "insert into blah4 values ('asdf')"
    DB20000I The SQL command completed successfully.
    --
    Jonathan Petruk
    DB2 Database Consultant

  3. #3
    Join Date
    Jun 2004
    Posts
    16

    I ment CLP sorry

    I ment CLP not CLI sorry,

    Thanks for the info. I knew some text could be inserted into a clob what we are looking for is a way ot insert a file (like a pdf file) into a blob.

    Sorry I should hav e been more specific in my first thread.

  4. #4
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    Quote Originally Posted by winterb
    I ment CLP not CLI sorry,

    Thanks for the info. I knew some text could be inserted into a clob what we are looking for is a way ot insert a file (like a pdf file) into a blob.

    Sorry I should hav e been more specific in my first thread.
    Sort of, you can use HEX:
    db2 "insert into blah6 values (BLOB(X'000000'))"

    What it sounds like you want is something sort of like the XMLClobFromFile() function... but unfortunately I don't think such a beast exists, you'd have to write it yourself, and it needs the file to be on the server.

    Sounds like you'll probably need to write an app to do what you want.
    --
    Jonathan Petruk
    DB2 Database Consultant

Posting Permissions

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