如果我们使用colsep,则sql plus输出将不会采用正确的CSV格式, [英] sql plus output is not coming in proper CSV format if we use the colsep ,

查看:102
本文介绍了如果我们使用colsep,则sql plus输出将不会采用正确的CSV格式,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临的问题是,如果CSV文件中的数据包含(逗号)

,那么即使这些数据也将分开

我正在使用shell脚本使用sql plus连接到oracle,并在CSV文件中后台处理数据

在CSV中,colsep (逗号)可以很好地用于分隔列,但是数据也被分隔.

例如,如果公司名称的值是(Southern Textiles,LICO),那么在这种情况下,即使SOuttheren纺织品也位于一列中,而LICO移至另一列中,并且由于逗号值分开而导致剩余数据发生更改./p>

请在下面帮助我我在脚本中使用的代码是

 设置为关闭trimspool的反馈;设置页面大小50000将serveroutput设置为on设置下划线设置终止设置反馈设置colsep,"开启HEADING关闭标签设置修剪设定线条大小2000设置修剪;列company_name格式a10 

解决方案

SQLPlus具有CSV格式.随便

将标记CSV设置为打开

The issue i am facing is that even the data in the CSV file also getting separated if the value consists of , (comma)

I am using shell script connect to oracle using the sql plus and spooling the data in the CSV file

In the CSV the colsep , (comma) is working fine to separate columns but the data also getting separated.

for example if the value of the company name is (Southern textiles,LICO ) In that case even SOuttheren textiles is in one column and LICO is moving to another column and thee remaining data is getting changed since the comma value separated.

Please help me in the below code i have used in my script is

set feedback off trimspool on;
set pagesize 50000
set serveroutput on
set underline off
set termout off
set feedback off
set colsep " , "
set HEADING ON
set tab off
set trimspool on
set linesize 2000
set trimout on;
column company_name format a10

解决方案

SQLPlus has CSV formatting. Just do

Set markup csv on

这篇关于如果我们使用colsep,则sql plus输出将不会采用正确的CSV格式,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆