Win has asked for the wisdom of the Perl Monks concerning the following question:
There are a number of ways that I could do this. I would like to do it on the fly without printing to file. Am I on the right lines?
my $sthH= $dbh->prepare("SELECT code from Disease_Types") or die " +Couldn't prepare query: ".$dbh->errstr; $sthH->execute or die "Couldn't execute query: ".$sthG->errstr;; my @names =(); while (my ($name) = $sthH->fetchrow_array) { push @names, $name; } my @new_name = (); foreach (@names){ my $name = $_; my $cat_name = "A"."$name"; push @new_name, $cat_name; } #print @new_name; foreach (@new_name){ my $sthI = $dbh->prepare('INSERT into Disease_Types (Adapted_cod +e) Values ("$_")'); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Inserting values in to table with DBI
by merlyn (Sage) on Dec 08, 2003 at 12:34 UTC | |
by Win (Novice) on Dec 08, 2003 at 13:59 UTC | |
|
Re: Inserting values in to table with DBI
by cchampion (Curate) on Dec 08, 2003 at 13:00 UTC | |
|
Re: Inserting values in to table with DBI
by Roger (Parson) on Dec 08, 2003 at 13:04 UTC | |
| |
|
Re: Inserting values in to table with DBI
by mpeppler (Vicar) on Dec 08, 2003 at 15:58 UTC | |
|
Re: Inserting values in to table with DBI
by dws (Chancellor) on Dec 08, 2003 at 17:43 UTC | |
|
Re: Inserting values in to table with DBI
by kodo (Hermit) on Dec 08, 2003 at 12:38 UTC |