I'm getting one extra line(not sure how)in the output of the sql query when run through shell script. When checking the count in sql developer the count is correct.
Below is the query which I've run through script:
sqlplus -s user/passwd@DB << EOF > /dev/null 2>&1
set heading off
set feedback off
set verify off
set pagesize 50000
set trimspool on
set wrap off
set linesize 2000
spool /home/sql_test.txt;
select /*+parallel(a,4)*/ substr(dati, 1, 11), substr(dati, 13, 500)
from ferdquatadm.tmp_fq_migration a, account b, customer_node_history c
where substr(dati, 1, 11) = account_name
and b.customer_node_id = c.customer_node_id
and sysdate between effective_start_date and effective_end_date
and schedule_id = 1234;
spool off;
exit
EOF
sed '1d' sql_test.txt > sqltest_1
mv sqltest_1 mig_code_1234.txt
rm -rf sql_test.txt
In sql developer, the count of rows is 53754, whereas in unix the count is 53755:
$ wc -l mig_code_1234.txt
53755 mig_code_1234.txt
Any help is most welcome.