MYSQL 转 ORACLE CLOB类型

现在有一个MySQL的表,其中一个字段类型是longtext。
在Oracle 中有一个相同的表,对应这个字段的类型是CLOB。
两种数据库之之间建立了一个dblink,oracle可以通过dblink访问mysql对应表的数据。
现在要在存储过程使用dblink把数据导入到Oracle中,求大神帮忙。

下面是基本的存储过程,请帮忙改造下面的存储过程。可以导CLOB的(mysql中,CODE字段是longtext类型)

--t_businessarea_enterprise
declare
type ty_data is table of t_businessarea_enterprise%rowtype;
ty_1 ty_data;
begin
execute immediate 'select * from "t_businessarea_enterprise"@gjswebln ' bulk collect into ty_1;
-- 整体执行
forall i in 1.. ty_1.count
insert into t_businessarea_enterprise (enterprise_id,code)
values (ty_1(i).enterprise_id,ty_1(i).code);
commit;
exception
when others then
dbms_output.put_line(sqlerrm); -- 打印错误
end;
/

报错信息:
ORA-22992: 无法使用从远程表选择的 LOB 定位符
简单来说就是 怎么使用dblink方式把mysql中的longtext类型字段内容导入到oracle的clob中。dblink已经建好的前提下

最后追加到100分还没解决 我就不用存储过程了。自己写个程序搞定这个问题

毫无节操跳楼大甩卖120分辣~!!!

MYSQL中用LOGTEXT表示oracle中的CLOB类型。
Oracle
CLOB
Oracle 9i 及以前,最大4G字符数据 Oracle10g 最大4G*数据库块大小的字符数据

MySQL
LONGTEXT
最大长度为4,294,967,295或4GB(232–1)字符的TEXT列。LONGTEXT列的最大有效(允许的)长度取决于客户端/服务器协议中配置最大包大小和可用的内存。

LONGBLOB
最大长度为4,294,967,295或4GB(232–1)字节的BLOB列。LONGBLOB列的最大有效(允许的)长度取决于客户端/服务器协议中配置最大包大小和可用的内存。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-06-10
在oracle端创建一个同样schema的临时表,使用dblink将数据插入临时表(insert into xxx value select,然后再从临时表查询出来插入你的目标表追问

可否补充一下那个存储过程 谢谢

第2个回答  推荐于2016-04-18
declare
type ty_data is table of t_businessarea_enterprise%rowtype;
ty_1 ty_data;
begin
execute immediate 'select * from "t_businessarea_enterprise"@gjswebln ' bulk collect into ty_1;
-- 整体执行
forall i in 1.. ty_1.count
insert into t_businessarea_enterprise (enterprise_id,code)
values (ty_1(i).enterprise_id,ty_1(i).code);
commit;
exception
when others then
dbms_output.put_line(sqlerrm); -- 打印错误
end;
/本回答被提问者采纳
第3个回答  2020-06-19
请问问题解决了吗?
相似回答