ORA-01465:使用BLOB时,oracle中的十六进制数字无效 [英] ORA-01465: invalid hex number in oracle while using BLOB
问题描述
我正在Oracle 11g中设计一个数据库.我设计了带有字段的表格,
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)
它给出[Err] ORA-01465:无效的十六进制数. 如果有人可以帮助我解决错误?
it gives [Err] ORA-01465: invalid hex number. If someone can help me with the error?
推荐答案
您将字符串转换为BLOB,可以通过包utl_raw.cast_to_raw
进行此操作,也可以通过to_clob('mystring')
将varchar转换为clob,然后在其中使用过程DBMS_LOB.convertToBlob
您的代码
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
但是如果您要使用字段作为字符串,为什么不将它们另存为CLOB?
but if you are going to use the fields for string why don`t save them as a CLOB?
以下是两个带有BLOB和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);
这篇关于ORA-01465:使用BLOB时,oracle中的十六进制数字无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!