首批通过分布式安全可靠测评,为关键业务系统打造
Oracle 模式报错 -4007 blob cast to other type not supported
更新时间:2026-05-18 09:11
问题描述
有如下两个对 BLOB 转换的场景会报这个错误。
BLOB 类型不支持与其他类型的隐式转换
创建测试表。
obclient [SYS]> create table t2(c1 varchar(10)); Query OK, 0 rows affected (0.309 sec)插入 BLOB 类型参与函数。
obclient [SYS]>insert into t2 values (empty_blob()); ORA-00600: internal error code, arguments: -4007, blob cast to other type not supported
BLOB 类型参与函数的入参涉及到隐式类型转换也会报错
创建测试表。
obclient [SYS]> alter table t2 add c2 blob; Query OK, 0 rows affected (0.095 sec)插入空字符串。
obclient [SYS]> insert into t2 values ('test',''); Query OK, 1 row affected (0.003 sec)插入 BLOB 类型参与函数。
obclient [SYS]> insert into t2 values ('test 2',empty_blob()); Query OK, 1 row affected (0.011 sec)查询测试表内容。
obclient [SYS]>select * from t2;输出结果如下:
+--------+----------+ | C1 | C2 | +--------+----------+ | test | | | test 2 | | +--------+----------+ 2 rows in set (0.015 sec)查询测试表 BLOB 字段长度。
obclient [SYS]> select length(lower(c2)) from t2; ORA-00600: internal error code, arguments: -4007, blob cast to other type not supported
问题原因
OceanBase 数据库目前不支持 Oracle 模式下的 BLOB 类型隐式转换。
适用版本
OceanBase 数据库 V2.x 和 V3.x 版本。
解决方法
通过业务逻辑的修改来规避 BLOB 类型转换。
修改字段 c1 为 BLOB 类型,或者字段类型不用修改,应用端负责源数据转换,与字段 c1 数据类型兼容即可。
修改字段 c2 为非 BLOB 类型,应用端负责源数据转换,与字段 c2 数据类型兼容即可。