I am trying to write unix shell script in which i want to connect to db and fetch the query result in tab delimited format. Also required to add query result count at the footer.
Query.sql Select id, empname from employee
Code-
Spool_file=result
Sql=query.sqlsqlplus -s $userid/$password/$sidv@ << EOFSQL
Set head off
Set COLSEP chr(9)
spool $ spool_file
@ $sql
Spool off
EOFSQL
Output should be like this- A filename----( fixed header) 1 abc 2 pqr 3 lmn 4 stv Z 4 ----(footer with query result count)