database objects/schema names/ column names etc. Table names, column names etc
should be mentioned in $sql. Place holders take only values.
. . . .
my $sql = "Select count(*) from $schema_name.$table_name where $column_name = ?";
. . . . .
regs, Ravi
David N Murray wrote:
You can't use a parameter for the table name. You have to use dynamic sql (i.e. put it in the $sql var before the prepare). There's no point in the prepare if the DB can't even figure out what table is going to be hit.
This should be a FAQ, but I didn't see it in there.
hth, dave
On Jul 16, [EMAIL PROTECTED] scribed:
Hi all,
Hoping someone can help me out here.
I'm trying to do the following using Oracle 9i and DBI:
$table_name = "USERS";
$sql = "SELECT COUNT(*) FROM ?";
$sth = $dbh->prepare($sql);
$sth->bind_param(1,$table_name);
$sth->execute; . . . However, I'm getting an error about an invalid table name (I have verified that the table is valid and that I spelled it correctly).
Is this even possible with Oracle and DBI?
Please let me know.
Thanks.
Aaron Salvo
