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

Nas*_*Ohi 7 oracle blob

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

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

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

insert into "ReviewTable" values ( 3, 'hello, this is the first review',SYSDATE)
Run Code Online (Sandbox Code Playgroud)

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

are*_*are 15

你将你的字符串转换为BLOB,你可以通过包utl_raw.cast_to_raw或将varchar转换为clob to_clob('mystring'),然后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);
Run Code Online (Sandbox Code Playgroud)

CLOB

create table ReviewTable2( CUST_ID NUMBER(5)
,Review  CLOB  
,Dt Date);

insert into ReviewTable2 values ( 3, 'hello, this is the first review',SYSDATE);
Run Code Online (Sandbox Code Playgroud)