首页 文章

ORA-01465:使用BLOB时oracle中的十六进制数无效

提问于
浏览
2

我正在oracle 11g中设计一个数据库 . 我设计了一个带有田地的 table ,

CUST_ID, NUMBER(5) //this is a foreign key
Review, BLOB //to store big strings 
Date, SYSDATE

现在,当我试图在表格中插入数据时 -

insert into "ReviewTable" values ( 3, 'hello, this is the first review',SYSDATE)

它给[Err] ORA-01465:无效的十六进制数 . 如果有人可以帮我解决错误?

1 回答

  • 11

    你把你的字符串转换成BLOB,你可以通过包 utl_raw.cast_to_raw 或通过 to_clob('mystring') 将varchar转换为clob然后在你的代码中使用过程 DBMS_LOB.convertToBlob

    但是如果你打算将字段用于字符串,为什么不把它们保存为CLOB呢?

    以下是BLOB和CLOB字段的2个示例

    BLOB

    create table ReviewTable( CUST_ID NUMBER(5)
    ,Review  BLOB  
    ,Dt Date);
    
    insert into ReviewTable values ( 3, utl_raw.cast_to_raw('hello, this is the first review'),SYSDATE);
    

    CLOB

    create table ReviewTable2( CUST_ID NUMBER(5)
    ,Review  CLOB  
    ,Dt Date);
    
    insert into ReviewTable2 values ( 3, 'hello, this is the first review',SYSDATE);
    

相关问题