Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress Headers in SELECT statements

Status
Not open for further replies.

roylec

MIS
Sep 16, 2002
31
GB

I've tried to find this in the MySQL reference, and done some online searches, but I cant find any reference to this issue:

select NAME from DPLENV;
+------+
| NAME |
+------+
| BAR |
| FOO |
+------+
2 rows in set (0.00 sec)

I want the output formatted so that the header line (with the column name in) and the feedback, (2 rows...) are removed, and I am left _only_ with the values selected from the table.

In Oracle, for example, I would use 'set header OFF' and 'set feedback OFF' to achieve the same. Is there an equivalent in mySQL?

Any ideas?

Christian
 

I am running the select statement from a unix script, and want the unix script to manage only the valid values, not the table name.

For example, the following statement:

cat <<-EOT | mysql --user=user --password=pass mydb
select * from ENV where NAME=&quot;$1&quot;)
EOT

Will return the following:

NAME
BAR
FOO

I could strip out the first line using shell tools, but thats not an attractive option in a script with over 50 SQL selects. It adds a bulk of unnecessary code.

If you're interested, the database is manipulated using PHP, and I'm writing a number of reports in korn shell to provide raw data to a framework of scripts that already exist. Its a proof of concept that depends on not having to provide an intermediary between the database and unix shell.

Your help kindly welcomed.
 
Just so we dont get lost on unnecessary details, the code I gave should have read:

cat <<-EOT | mysql --user=user --password=pass mydb
select NAME from ENV)
EOT
 
Sorry, but if you're going to access the data via insertion of commands to mysql, there is no way that I know of to supress the return header.

Well, I take that back. I suppose you could always edit the source code and recompile.

You could also write a perl DBI script that your korn and other scripts use to access the data.

Do you have PHP available in a standalone mode? You could have it provide the data to the other scripts, too.



Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top