欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

oracle 快速倒入导出csv、txt

程序员文章站 2024-03-20 21:31:46
...

数据导出

@aa.sql
set echo off
set term off
set line 1000 pages 0
set feedback off
set heading off
set trimspool on
spool 成本分摊结果.csv
--获取文件表头
select '"关联分摊单据号","项目编号","项目简称","分项编码","分项名称","费用类型","分摊金额","分摊比例"' from dual;
--获取文件内容
select '"' || CBFT_FTJGSJ_1 || '","' || CBFT_FTJGSJ_2 || '","' || CBFT_FTJGSJ_3 || '","' || CBFT_FTJGSJ_4 || '","' || CBFT_FTJGSJ_5 || '","' || CBFT_FTJGSJ_6 || '","' || CBFT_FTJGSJ_7 || '","' || CBFT_FTJGSJ_8 ||'"'from CBFT_FTJGSJ_73 where company='xxxx业有限公司';
spool off
exit

数据导入

export NLS_LANG=AMERICAN_AMERICA.UTF8
export LANG=en_US.UTF-8
sqlplus zjxyywsj/zjxyywsj  @cbftjg.sql

数据字符集处理

#utf-8 字符集转gbk
iconv -f utf-8 -t gbk 成本分摊结果.csv>csv/成本分摊结果.csv
相关标签: oracle linux