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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

avoiding sql query in output file

Status
Not open for further replies.

schintapalli

Programmer
Nov 18, 2003
9
AU
Hi
Thanks Shriyan for your reply to my previous posting.
I have a problem in capturing the sql out put. I am using a small shell script which is intended to capture the output after executing a sql. But the output is containing actual sql query also. How can I avoid the sql query but capture the result set alone. Calling shell script looks like

echo 'Execution starts' > test1
sh a1.sh >> test1 2>&1

The called shell script a1.sh looks like
DBNAME=db1@srvr1
INTERFACE_CMD="dbaccess"; export INTERFACE_CMD
DBCOMMAND="$INTERFACE_CMD -e $DBNAME"; export DBCOMMAND

for i in `cat tbllist`
do
echo executing script $i
$DBCOMMAND $i 2>&1 >> test1
done

Here the tbllist has a sql file name (mysql.sql)listed in it.
The sql in mysql.sql is "select * from customer ;"
The output file test1 looks like
----------------------
Execution starts
executing script mysql.sql
select * from customer
1 row(s) retrieved.
Database closed.
1 2003-11-11 12:32:00.000
----------------------------------------
IN the above output I do not want 'select * ...'

Regards
 
Hi,

You have to remove the -e switch or flag that has been passed to the dbaccess utility. -e stands for echo of SQL statements that gets processed.

DBCOMMAND="$INTERFACE_CMD -e $DBNAME"; export DBCOMMAND

Modified statement looks like:
DBCOMMAND="$INTERFACE_CMD $DBNAME"; export DBCOMMAND

Regards,
Shriyan
It is better to desire the thing we desire than to have the thing we desire.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top