Search code examples
sqloracleexport-to-csvsqlplusspool

Why sqlplus spoolfile cutting last column?


i have problems with spooling file to .csv. Sqlplus cutting off last column name and I don't know why? I am trying to set bigger linesize but it doesn't work.

Thanks for any tips

set embedded on 
set pagesize 0
set linesize 600
set colsep ';'
set echo off
set feedback off
--set trimspool off
set headsep off
SET HEADING OFF   
SET TRUNCATE OFF
SET WRAP OFF

column_1 AS COLUMN1, column_2 AS COLUMN2, column_3 AS COLUMN3, 'FAKEMESSAGE' as COLUMN4

And COLUMN4 is cut, I see just string "COL"


Solution

  • I already solved the problem - when you want to use to your select some unexisted column, in my case - 'FAKEMESSAGE' as COLUMN4 - in real select i had just 'FAKE' as COLUMN4 - and COLUMN4 was just COLU - i know why - because when the column doesnt really exist in the table/database, the table dont really know how big the column should be, so it copy the size of inputed value and the same size of string put on the name of column, so if you want to have header size of 8 strings char, you have to setup first OR the input value have to be at the same size ...