Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003

    Unanswered: MSWord .DOC to BLOB


    I'm looking for the correct syntax to insert/retrieve a Blob from an Oracle table.

    Any help would be gr8ly appreciated.
    Program, that's what I do.

  2. #2
    Join Date
    Nov 2003
    Bangalore, INDIA

    Thumbs up


    create table test_lobs (
    c1 number,
    c2 clob,
    c3 bfile,
    C4 blob )

    Insert some rows.

    The empty_<lob>() function acts as a constructor to generate a LOB locator for that column. Without a locator that LOB cannot be accessed through PL/SQL etc.

    First row - no locators.
    insert into test_lobs values (1,null,null,null)

    Second row - "null" locators - ie locators created but point to nothing. Note there is not an empty locator as such for the BFILE though we could also initialise the BFILE using BFILENAME with a null directory and file, ie BFILENAME(null,null).

    insert into test_lobs values (2,EMPTY_CLOB(),null,EMPTY_BLOB())

    Third row - it is possible to insert data directly up to 4K. Even though you are only really accessing the locator, the data is stored as appropriate behind the scenes. When inserting directly into a BLOB either the string must be hex as an implicit HEXTORAW will be done or you can call UTL_RAW.CAST_TO_RAW('the string') to convert it for you. Note '48656C6C6F' = 'Hello'.

    insert into test_lobs values (3,'Some data for record 3.',BFILENAME(null,null),'48656C6C6F'||UTL_RAW.CAS T_TO_RAW(' there!'))

Posting Permissions

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