ORA-01465: invalid hex number in oracle while using BLOB

断了今生、忘了曾经 提交于 2020-08-22 11:43:07

问题


i am designing a database in oracle 11g. I have designed a table with fields,

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

now when i'm trying to insert data in the table like-

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

it gives [Err] ORA-01465: invalid hex number. If someone can help me with the error?


回答1:


you cast your string into BLOB, you can do this via package utl_raw.cast_to_raw or convert varchar to clob via to_clob('mystring') and then use procedure DBMS_LOB.convertToBlob in your code

but if you are going to use the fields for string why don`t save them as a CLOB?

Here are 2 examples below with BLOB and CLOB fields

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);


来源:https://stackoverflow.com/questions/33708959/ora-01465-invalid-hex-number-in-oracle-while-using-blob

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!