Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2003
    Posts
    3

    Unanswered: Why can't write a string to blob

    pls, I know that blob is use to store binary data,
    Is there anyway to directly write a string to a blob column?

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Why can't write a string to blob

    Originally posted by VietnameseBoy
    pls, I know that blob is use to store binary data,
    Is there anyway to directly write a string to a blob column?
    Why not use CLOB?

    But you can write a string to a BLOB column like this:

    SQL> create table t (b blob);

    Table created.

    SQL> insert into t values (utl_raw.cast_to_raw('hello'));

    1 row created.

    SQL> select utl_raw.cast_to_varchar2( dbms_lob.substr( b, 32767, 1 ))
    2* from t;

    UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(B,32767,1 ))
    --------------------------------------------------------------------------------
    hello

  3. #3
    Join Date
    Feb 2003
    Posts
    3

    your post really help

    Thanks Tony Andrews,
    I really don't know this way!

Posting Permissions

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