oracle中用spool匯出資料到文字中

2021-06-13 18:40:43 字數 1225 閱讀 8603

spool c:\wwwwww.sql

set feedback off;

set heading off;

set linesize 1000;

set pagesize 1000;

set define off;

set termout off;

select 'insert into t_table(phonenumber,name,***)values(''' ||

phonenumber || ''',''andy'',0);'

from t_table2;

select 'commit;' from dual;

spool off;

set feedback on;

set heading on;

set define on;

set termout on;

就可以生成下面格式的txt

insert into t_table(phonenumber,name,***)values('15000000000','andy',0);

insert into t_table(phonenumber,name,***)values('15000000000','andy',0);

insert into t_table(phonenumber,name,***)values('15000000000','andy',0);

insert into t_table(phonenumber,name,***)values('15000000000','andy',0);

insert into t_table(phonenumber,name,***)values('15000000000','andy',0);

insert into t_table(phonenumber,name,***)values('15000000000','andy',0);

insert into t_table(phonenumber,name,***)values('15000000000','andy',0);

insert into t_table(phonenumber,name,***)values('15000000000','andy',0);

insert into t_table(phonenumber,name,***)values('15000000000','andy',0);

Oracle用spool匯出資料

使用spool匯出資料有時候也是乙個比較好的選擇,7萬條資料匯出需要10s,注意的是需要用 d spool.txt呼叫,set termout off才會生效不顯示到螢幕。sql語句和spool off後面要加分號。sql drop table test purge sql create table...

Oracle使用指令碼匯出資料(spool)

使用spool匯出表內容 out.sql檔案內容 set colsep set trimspool on set linesize 2000 set pagesize 2000 set newpage 1 set heading off set term off set num 18 set fee...

oracle中spool匯出資料小結

對於spool資料的sql,最好要自己定義格式,然後根據自己的需求方便程式直接匯入 如 select record id claim id claim code claim status car mark vehicle type report no create time last modify ...