ParisR has asked for the wisdom of the Perl Monks concerning the following question:
This is working:
$sqlstatement="SELECT Table1.Name, Table1.Address, Table1.City, Table1.State, Table1.ZIP, Table1.Phone FROM Table1 WHERE Table1.BusType = 'ARCHITECTS'"; $sth = $dbh->prepare($sqlstatement);
But attempting on the fly, this is not:
my @lines = <DATA>; my $line; foreach $line ( @lines ) { #prepare and execute SQL statement $sqlstatement="SELECT Table1.Name, Table1.Address, Table1.City, Table1.State, Table1.ZIP, Table1.Phone FROM Table1 WHERE Table1.BusType = '$line'; $sth = $dbh->prepare($sqlstatement);
I've tried variations with the quotes but I'm stuck.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Quoting in DBI sql query for on the fly query
by dragonchild (Archbishop) on Oct 29, 2004 at 01:32 UTC | |
|
Re: Quoting in DBI sql query for on the fly query
by borisz (Canon) on Oct 29, 2004 at 01:29 UTC | |
by ParisR (Acolyte) on Oct 29, 2004 at 02:08 UTC | |
by nedals (Deacon) on Oct 29, 2004 at 05:53 UTC | |
by runrig (Abbot) on Oct 29, 2004 at 05:55 UTC | |
by ryantate (Friar) on Oct 29, 2004 at 19:04 UTC | |
|
Re: Quoting in DBI sql query for on the fly query
by mpeppler (Vicar) on Oct 29, 2004 at 06:17 UTC | |
|
Re: Quoting in DBI sql query for on the fly query
by htoug (Deacon) on Oct 29, 2004 at 12:01 UTC | |
|
Re: Quoting in DBI sql query for on the fly query
by rdfield (Priest) on Oct 29, 2004 at 09:52 UTC |