问题背景:
使用SQL语句在SQLDeveloper中更新Blob字段,弹出该提示
ORA-01465: invalid hex number
解决办法:
参考StackOverflow:https://stackoverflow.com/a/21438975/1280694
当需要将VARCHAR2 类型数据插入到BLOB时,可以使用
utl_raw.cast_to_raw
函数,该函数可以将你输入的VARCHAR2数据转换为RAW数据类型而且不会更改你输入的数据内容,然后再插入到BLOB列中。
To insert a
VARCHAR2
into a
BLOB
column you can rely on the function
utl_raw.cast_to_raw
as next:
insert into mytable(id, myblob) values (1, utl_raw.cast_to_raw('some magic here'));
It will cast your input
VARCHAR2
into
RAW
datatype without modifying its content, then it will insert the result into your
BLOB
column.
More details about the function
utl_raw.cast_to_raw