On Wednesday, February 23, 2005 12:30, Nupur Jain wrote: > I am executing a mysql query through shell and expecting to see a > return of SQL execution. > > mysql -D $dbName --vertical -u $DBUSER -p$DBPASS < $queryFile > > $opFile > rc=$? > > Here rc is always 0 and so are $opFile entries. $queryFile contains > exactly the same query as listed below. > > If the same query is run in mysql client, I see the result as "Empty > set (0.00 sec)". Why don't I get a return in shell. > > mysql> select * from usrtbl where username='vou_0004016'; > Empty set (0.00 sec)
It makes sense the the return code from mysql is zero, since it sucessfully executed. If it is an empty set, your output file will be empty. If you want the file to show you the query and "empty set", change your command to the following: mysql -vv -D $dbName --vertical -u $DBUSER -p$DBPASS < $queryFile > $opFile The -vv controls sets the verbosity of the output from the client. > Thanks, > > Nupur -- Tom Crimmins Interface Specialist Pottawattamie County, Iowa -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]