【问题标题】:Oracle Spool to CSV Formatting IssueOracle Spool 到 CSV 格式问题
【发布时间】:2015-07-29 22:34:30
【问题描述】:

我希望使用 Oracle Spool 将两列表导出为 CSV。当我执行导出时,第一列格式很好,但是第二列溢出到 XLS 中的第三列。 DB中第二列的内容很长。

以下是我正在尝试的:

column MachineName Format a20;
column OperatorName Format a32000;
set colsep ,
set echo off
set feedback off
set heading on
set linesize 32000
set pagesize 0
set termout off
set trim off
set trimspool on
set array 100
set underline off
set wrap off
set flush off
set verify off
set embedded on

以下是结果。在此示例中,“Lucio Victor”应与“Revolo Borja”在同一列中。 (在数据库中,这都在一列中)

MACHINENAME         ,OPERATORNAME
CM101               ,Revolo Borja, Lucio Victor
CM101               ,Revolo Borja, Lucio Victor
CM101               ,Revolo Borja, Lucio Victor
CM101               ,Revolo Borja, Lucio Victor

结果应该是

MACHINENAME         ,OPERATORNAME
CM101               ,Revolo Borja Lucio Victor
CM101               ,Revolo Borja Lucio Victor
CM101               ,Revolo Borja Lucio Victor
CM101               ,Revolo Borja Lucio Victor

【问题讨论】:

  • 对于它的价值,在 SQLcl(仍处于测试阶段)中,您可以将输出自动格式化为 CSV。 SQLcl 是 SQL Developer 团队开发的新命令行界面

标签: oracle csv oracle11gr2 spool


【解决方案1】:

在您的操作员名称列周围加上“,Excel 将逗号作为字段分隔符读取

【讨论】:

  • 我想我已经弄清楚了原因....但不知道如何解决。当我查看该列的原始数据时,它是这样的:
猜你喜欢
  • 2015-07-30
  • 2018-09-02
  • 1970-01-01
  • 2016-01-25
  • 2015-07-31
  • 1970-01-01
  • 2017-06-04
  • 1970-01-01
相关资源
最近更新 更多