Majik has asked for the wisdom of the Perl Monks concerning the following question:
SELECT this FROM that WHERE foo=$findthis
foo is unique.
I quickly wrote this:
<BR>$sth=$dbh->prepare(q{SELECT this FROM that WHERE <BR>foo=?}); <BR>$sth->execute($findthis); <BR>($returnme) = $sth->fetchrow_array();
but that doesn't handle strings that contain spaces. I've tried a number of different ways of doing it to handle spaces... and all fail. I tried qq{}, taking it out of q{} like:
<BR>$findthis = "find me"; <BR>my $query = "SELECT this FROM that WHERE foo='$findthis'"; <BR>$sth=$dbh->prepare{$query); <BR>... <BR>doesn't work. it prints SELECT this FROM that WHERE foo='find me' + <P> I tried using sqlplus to throw queries directly at the db... and doing + just <CODE> SELECT this FROM that WHERE foo='find me';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl/DBI/Oracle and strings with spaces
by turnstep (Parson) on Dec 09, 2000 at 17:48 UTC | |
by runrig (Abbot) on Dec 09, 2000 at 20:40 UTC | |
|
Re: Perl/DBI/Oracle and strings with spaces
by Fastolfe (Vicar) on Dec 10, 2000 at 09:38 UTC | |
|
Re: Perl/DBI/Oracle and strings with spaces
by wardk (Deacon) on Dec 10, 2000 at 08:19 UTC | |
by Fastolfe (Vicar) on Dec 10, 2000 at 09:35 UTC | |
|
Re: Perl/DBI/Oracle and strings with spaces
by boo_radley (Parson) on Dec 10, 2000 at 04:19 UTC | |
by Fastolfe (Vicar) on Dec 10, 2000 at 09:34 UTC |