Question: I am trying to generate a datafile as downlaod of a table, which is possiby in fixed format.
I already have the SQL ready.

**Example:** 

```
SELECT RPAD(ORGANIZATION_ID,10)||RPAD(ORGANIZATION_NAME,100)||RPAD(EMPLOYEE_COUNT,100)
FROM MY_ORGANIZATION_STATE;

```

I run it in a SQL Developer, and export into Excel. for sample of 50 records.
Am able to fetch is correctly, and the format looks OK.

But I need to automate it, and hence we use SQL\*Plus's spool command.
A snippet is below.

```
set pagesize 100;
set linesize 10000;
set heading off;
spool orgn_output.dat;
@my_script # this has my SQL inside
spool off;

```

This runs without any error.

But when i tried to open the file, I could see, extra spaces are inside the file, and the layout is not as i expected!

When i run the SQL manually, and spool using PUTTY, it look file. Why does my script generates a wrong one. I have no clue, why it happens.

ANy help is greatly appreciated!

**EDIT:** Output:

```
100         Deva@Company@Sales          469
101         Deva@School                 234
102         Deva@Hospitals              245
103         Deva@Company@Finance        469

```

Thanks

Answer: 
Actually, I am able to recreate your issue easily. It happens when the column text is lesser. when i issue exact text size, the layout is size, and I am seeing the text inside the spooled text has tab characters instead if spaces. The pattern is not consistent too. I just researched with available command, and I found. `SET TAB OFF`; in sqlplus solves this.

I hope, `sqlplus` itself is changing multiple spaces inside into TAB. Setting TAB solved it.!

Please try that option. and let me know. Good luck!

**P.S**. Editting your question, revealed the bug, possibly SO, converts TAB effectively while formatting :)
Actually i have this kind of problem with sqlplus. After i have fixed it i would like to recommend you to try with this format of sqlplus.

1. SET TRIMSPOOL ON;
2. SET TAB OFF;

Due to the error , Because it is about the spool issue. So we just take the format of the trimspool on.