bind_columns binds columns to a list of variables. You're selecting one "column", and binding it to two "variables" (the first one is undef).my $sqlstmt = "select to_date('$tdate','mm/dd/yyyy') from dual"; my $sth = $dbh->prepare($sqlstmt); $sth->execute() or die $dbh->errstr; my $tmp; $sth->bind_columns(undef, \$tmp); while($sth->fetch()) {$tdate = $tmp;}
undef is probably getting translated to placeholder number zero(oops, I'm confusing myself w/bind_col vs bind_columns...but the following still holds), you want:
Read the docs, bind_col and bind_columns are slightly different, and bind_col values start at 1, not 0.$sth->bind_col(1, \$tmp);
In reply to Re: Placeholder Error (Placeholder :0 invalid, placeholders must be >= 1)
by runrig
in thread Placeholder Error (Placeholder :0 invalid, placeholders must be >= 1)
by alex.TT2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |