ArmandoG has asked for the wisdom of the Perl Monks concerning the following question:
the last part is like that because I am programming in perl, when run it creates these table with zero rows, how can I avoid them?CREATE TABLE $tableNameexpt SELECT * FROM final_exp WHERE pat = $row[0 +]
I just wants to see create it the one with one or more rows, can someone help me?my $sthexpt = $dbhexpt->prepare("SELECT DISTINCT PAT FROM xpatentes"); $sthexpt->execute(); # Just print the values of 'pat' from the patentes table. while ( (my @row) = $sthexpt->fetchrow_array() ) { print "El nombre del proximo archivo ... E$row[0]\n"; } $sthexpt->execute(); # we've looped through all of the query results + above so #-- # Create the new tables. # while ( (my @row) = $sthexpt->fetchrow_array() ) { my $tableNameexpt = "E" . $row[0]; # table names can not begin w +ith a digit print "Creando tabla " . $tableNameexpt . "\n"; my $a_sthexpt = $dbhexpt->prepare("CREATE TABLE TableNameexpt SEL +ECT * FROM final_exp WHERE pat = $row[0]"); $a_sthexpt->execute(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: skip empty mysql table
by pc88mxer (Vicar) on Feb 06, 2008 at 18:00 UTC | |
|
Re: skip empty mysql table
by dwm042 (Priest) on Feb 06, 2008 at 18:47 UTC |