I have a task to export the data of a table to flat files.I have written a shell script to do the same. The problem here is after the first column value, i.e., 310, the cursor won't move space by space, it takes a "tab" I think. It jumps certain position. I am not able to understand this. Could you please help me solve this by removing tab and taking that as spaces.
Is trimspool ON or Linesize causing the problem?
310 LIFRZONAAC 0000000 0000003
310 LIIPACCCLA 0000000 0000000
310 LIIPACREPL 0000000 0000000
310 LIIPANRDSI 0000000 0000000
310 LIIPAXNAD 0000000 0000000
310 LIIPBNRDSI 0000000 0000000
310 LIIPCAUDIP 0000000 0000000
310 LIIPCAUDMU 0000000 0000000
====================================================================================
My control file and shell script is as below.
Control file::
LOAD DATA CHARACTERSET WE8ISO8859P1
APPEND
PRESERVE BLANKS
INTO TABLE "MNCABEA1"
APPEND
(
SERVICIO CHAR(9),
FAMILIA_COMPONENTE CHAR(4),
PARAMETRO CHAR(7),
CO_CABECERA_SC CHAR(8),
CO_CABECERA_CARACT CHAR(7)
)
==================================================================================== Shell script::
cat<<ENDMNCABEA1 >MNCABEA1.sql
set head off
set feed off
set pagesize 0
set trimspool on
set linesize 500
SELECT SERVICIO||FAMILIA_COMPONENTE||PARAMETRO||DECODE(CO_CABECERA_SC,' ',REPLACE(CO_CABECERA_SC,' ','0'),LPAD(LTRIM(CO_CABECERA_SC),8,'0'))||DECODE(CO_CABECERA_CARACT,' ',REPLACE(CO_CABECERA_CARACT,' ','0'),LPAD(LTRIM(CO_CABECERA_CARACT),7,'0')) FROM MNCABEA1;
exit
ENDMNCABEA1
sqlplus -s $USUADM@$ORACLE_SID @MNCABEA1.sql > /var/opt/aat/shr/mn/par/ext/salida/MNCABEA1_TEST