Re: variable passed into a SQL statement from a shell script
Posted in 1998
Kirt wrote:
>
> I am trying to pass a variable array for my table names following a "from"
> and passing a variable in the middle of a wildcard like or matches statement
> i.e.. where description like "%variable%"
>
> when I try to pass the array $table_array[r] I get an unrecognized character
> message
> as for the where like I get no rows found when I replace the variables with
> constant the statement work fine if anyone can help please do
>
> thanks in advance
I would guess you are trying to make some Informix tool work like the
Unix shell, which treats $VAR as a reference to variable VAR. Informix
does not have this facility. You can emulate it like this:
sed "s/\\$VAR/$VAR/g" myfile.sql | dbaccess mydb
or by using a "here" document in a shell, where substitution occurs.
--
Peter Lancashire
Information Systems Specialist, Bayer plc
Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK
Tel: +44-1635-562258, Fax: +44-1635-562281
---
If all else fails, read the instructions AND the release notes.
All opinions are my own and not those of Bayer plc.
My Internet plumbing does not allow me to mail and post news together.
Sorry.
---
Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/