http://www.perlmonks.org?node_id=646470


in reply to DBI query where table name is a variable

Did you set $table before you called $dbh->prepare? Are you sure you set it correctly? There's a way to get DBI to tell you exactly what it sent to the SQL processor but I forget what it is. Perhaps another kind monk can enlighten you so you can see what the SQL processor sees.

Replies are listed 'Best First'.
Re^2: DBI query where table name is a variable
by Fletch (Bishop) on Oct 22, 2007 at 16:56 UTC

    Usually if you call $sth->trace( 2 ) (alternately call trace on your $dbh to enable tracing for all statement handles subsequently created) you should get a glimpse at the SQL that's being sent to the backend.