1
votes

How to do correct conversion of data from Oracle VARCHAR2 type to MySQL TEXT type? I want insert it into mysql table in field with TEXT type through DBLink.

1
job well done. str:='insert into "tabledst"@mysqlhs ("str") values(' || chr(39) || msg || chr(39) || ')'; execute immediate str;lvccgd

1 Answers

0
votes

Something like this might work. I wasn't sure which way you are going but the Oracle package dbms_lob will convert varchar2 to various BLOB, LOB, CLOB formats.

You might need to use a temporary table to pull source data to target side first if there are problems with the database link.

insert into database.target_table@DBLINK(text1, text2)
select 
  dbms_lob.substr(s.text1, 4000, 1),
  dbms_lob.substr(s.text2, 4000, 1)
from 
  source_table s;