Hi,
I am selecting few columns from a table using select query in UNIX shell script ans sending the results as E-mail. But the column headings are not displayed fully. Instead it displays only a part of the heading. Please help as how to display it fully.
There are lots of database systems out there and even more database clients to query them. The language to query relational databases is standardised but the commands to instruct the database client how to format the results is not.
So without at least the information what database client you use we are left to guess which could fit you.
For mysql the pager command can be used to format the output, but the example you give does not look like unmodified output from this client.
Oracles sqlplus provides the column command. If this is the client you use you can follow this link to the documentation.
I never worked with db2 or other database products on unix, so can't say how they handle this issue.
${ORACLE_HOME}/bin/sqlplus -s ${DB_LOGIN}/${DB_PASSWD} <<EOF
SET FEEDBACK OFF
SET HEADING ON
spool /tmp/file1.TMP
SELECT column1,column2,column3 FROM table1;
quit
o/p of this doesn't shows the column headings fully. Even tried COLUMN column1 HEADING COLUMN1.. But no hope