有时候服务器无法连接PLSQL等工具生成这些SQL
1、查表结构
主要看数据类型
DESC testdb.mytable;
2、生成insert INTO SQL
SET head off;
set feedback off;
set term off;
set line 500;
set pagesize 10000;
spool mytable.sql;
SELECT 'INSERT INTO newtestdb.mytable(TR_TYPE,CH_TYPE,CH_VALUE,MIN_CH,MAX_CH,MIN_MONEY,MAX_MONEY,DAY_MAX_COUNT,DAY_MAX_MONEY,MON_MAX_COUNT,MON_MAX_MONEY,CH_VALUE_PERCENT)
values(' || '''' || TR_TYPE || '''' || ',' || '''' || CH_TYPE || '''' || ',' || '''' || CH_VALUE || '''' || ',' || '''' || MIN_CH || '''' || ',' || '''' || MAX_CH || '''' || ',' || '''' || MIN_MONEY || '''' || ',' || '''' || MAX_MONEY || '''' || ',' || '''' || DAY_MAX_COUNT || '''' || ',' || '''' || DAY_MAX_MONEY || '''' || ',' || '''' || MON_MAX_COUNT || '''' || ',' || '''' || MON_MAX_MONEY || '''' || ',' || '''' || CH_VALUE_PERCENT || '''' || ');'
FROM testdb.mytable;
spool off;
3、到目标库执行和验证
SELECT COUNT(1) FROM newtestdb.mytable;
SELECT * FROM newtestdb.mytable;
查看如果导入正确就commit