How to pass arguments to SQL file passed in shell script?

Hi,

I am using SYBASE database. in my script i am connecting to DB via using isql.

  
isql -U${S_USER} -S${S_SERV} -D${S_DB} -P${S_PWD} -b0 -w3000 -h0 -s"|" -i${MYDIR}/ABC.sql -oXYZ.txt << FINSQL

i am taking a ABC.sql file to use the queries written in it and storing the output in the XYZ.txt

i was trying to pass arguments in this sql file but unable to do it.
i was going through the site found the command "read" that can be used.
i want to read a specific variable.

can anyone please tell me how do i use read to pass the parameter??
searching it already but unable to get the desired result.

what kind of parameter do you intend to pass in the SQL script? Is the parameter required in the ABC.sql file or somewhere else?

i am trying to pass a variable named as date. and this variable is being used in the queries in abc.sql.

i want to check if the date is present in 1 table (ASH table) then do something else do something
like this

 if (date exists) 
then execute blah blah
else 
execute duh duh

any ideas?

Assuming that abc.sql is a plain text file, you may want to "sed" it according to the condition given, e.g.

if date exists
    modify sql query
    use modified sql
else
    use original sql
fi