在连接到ORA DB的PHP中,我最近解决了插入CLOB
的问题,它应该以相同的方式处理。
在我的情况下,它足以将数据作为字符插入,而在绑定时,我将字符的长度设置为绑定的长度。但你可以尝试使用功能TO_BLOB()
,需要浇铸为RAW
输入:
INSERT INTO my_blob_table (my_blob_column) VALUES (TO_BLOB(UTL_RAW.CAST_TO_RAW('some binary data as string')))
或者也可以是通用的TO_LOB()
应该工作(转换为CLOB
或BLOB
根据源/目标列):
INSERT INTO my_blob_table (my_blob_column) VALUES (TO_LOB('some binary data as string'))
编辑:使用谷歌,我发现这应该工作:
- 如果我们有,我们要转换为
clob/blob
一个long
柱:
create table t1 (id int, my_blob blob);
create table t2 (id int, my_long long);
insert into t2 values (1, rpad('*',4000,'*'));
insert into t1 select id, to_lob(my_long) from t2;
- 如果我们有,我们要转换为
blob
一个long raw
柱:
create table t1 (id int, my_blob blob);
create table t2 (id int, my_long_raw long raw);
insert into t2 values (1, rpad('*',4000,'*'));
insert into t1 select id, to_blob(my_long_raw) from t2;
那应该工作...见here和here。
你试过插入基础表吗? – tbone