Hi Ram.

If all you're doing is to create a number of tables then I'd
get Perl to write the whole SQL statement for you and just

$dbh-do($sql)

Even so, what you've written is weird. You're creating a set of thirty
tables, each with two character columns with a maximum length equal
to the table number. Is this just an example?

You are right it is weird. But just a test script to learn DBI. What I really want is how Can I use prepare and execute which I think is better than doing a do every time If my table name keeps changing


Is a prepare statement always specific to a table in a database ?

I mean Cant I do
.........
$sth=$dbh->prepare("insert into ? (word,wkey) values ( ? , ?)")
foreach $word ( @list) {
   my $tablename = "w" . length($word);
   $sth->execute($tablename,$word,foo($word)) || die $dbh->errstr;
             # $tablename gets quoted here and gives error
}
........

I have been using perl with Mysql module and now I want to shift to DBI


Thanks Ram










-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to