Re: pass parameter in SQL program
Posted in 1995
:
: I am writing SQL program in Informix running on UNIX. The program needs to
: do the report for each city and each day, and need to run everyday. Right now,
: I have every coded in the program. I want to be able to pass a parameter of
: cityname and date so I don't have to hard code city name and date. Could I do
: it in informix... I couldn't find the reference in the book.
: Thanks, I appreciate the help. tina.
:
Assuming your SQL Statement is embedded in an Shell Script
#!/bin/sh
CITY=$1
RDATE=$2
isql dbname << EOF
SELECT * FROM tablename WHERE city_name = "$CITY" AND some_date = "$RDATE"
EOF
# End of Script
Execute From Command Line
$ script CITYNAME DATE
--
Rgds,
__________________________________________________________________________
Chetan Anand DHL INTERNATIONAL (Singapore) Pte Ltd
Systems Analyst Singapore
Internet : anand@sin-co.sin-ro.dhl.com
Voice : 65+ 3805 804
__________________________________________________________________________