ORA-01465: 使用 BLOB 时 oracle 中的十六进制数无效
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33708959/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ORA-01465: invalid hex number in oracle while using BLOB
提问by Nasif Imtiaz Ohi
i am designing a database in oracle 11g. I have designed a table with fields,
我正在 oracle 11g 中设计一个数据库。我设计了一个带有字段的表格,
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?
它给出 [Err] ORA-01465: invalid hex number。如果有人可以帮助我解决错误?
回答by are
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
您将字符串转换为 BLOB,您可以通过包执行此操作utl_raw.cast_to_raw
或通过将 varchar 转换为 clob to_clob('mystring')
,然后DBMS_LOB.convertToBlob
在代码中使用过程
but if you are going to use the fields for string why don`t save them as a CLOB?
但是,如果您打算将字段用于字符串,为什么不将它们保存为 CLOB?
Here are 2 examples below with BLOB and CLOB fields
下面是两个带有 BLOB 和 CLOB 字段的示例
BLOB
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
CLOB
create table ReviewTable2( CUST_ID NUMBER(5)
,Review CLOB
,Dt Date);
insert into ReviewTable2 values ( 3, 'hello, this is the first review',SYSDATE);