> I have a simple query using a LIKE in the statement and I just can get it
> to
> return any data. I know it works because i can do it in sqlplus and get
> data
> returned. I have tried everything to try to quote it correctly, like qq,
> qw,
> dbh->quote and finally placeholders. Code is below, any ideas ?
> 
> Thanks 
> Jim
> ------
> 
> # my $string = $dbh->quote("%7-Aug%");
> my $date = qq(7-Aug);
> 
> my $sth = $dbh->prepare("SELECT * FROM uptime WHERE sdate LIKE ?" )
>     or die "can't prepare: $DBI::errstr\n";
> 
> $sth->execute("%$date%") or die "can't execute $DBI::errstr\n";
> my @row;
> while (@row = $sth->fetchrow_array() ) {
>         print "@row\n";
> }
> 
         
You may want to use concationation on this or escape the % 
                    ("%".$date."%")
        $sth->execute("%$date%") or die "can't execute $DBI::errstr\n";
the double quotes will allow for the %$date to be read a has reference
instead of a "%"$date"%" like you are trying to do.

Reply via email to