Win has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I'm having difficulty returning tworecords fields from this select statement. What is the best way of doing it?
Update: My file handle is declared earlier in the program.
I'm having difficulty returning two
foreach (@regions_A_array){ my $Select_two_records = " SELECT G.Region, G.Score FROM Gov_regions_scores_TEMP G, Region_lo +okup R WHERE R.String = '".$_."' AND RTRIM(R.Place) = RTRIM(G.Region) "; my $sth_m_A = $dbh->prepare($Select_two_records) or die "Couldn't pr +epare query: ".$dbh->errstr; $sth_m_A->execute() or die "Couldn't execute query: ".$sth_m_A->errs +tr; my @regions_A; while (@regions_A = $sth_m_A->fetchrow_array) { print OUTPUT $_; print OUTPUT "\n"; } }
Update: My file handle is declared earlier in the program.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Returning two records with SELECT statement and then printing to file. Best way?
by andreas1234567 (Vicar) on Dec 07, 2007 at 13:06 UTC | |
Re: Returning two records with SELECT statement and then printing to file
by jrsimmon (Hermit) on Dec 07, 2007 at 13:16 UTC | |
by andreas1234567 (Vicar) on Dec 07, 2007 at 13:52 UTC | |
Re: Returning two records with SELECT statement and then printing to file
by roboticus (Chancellor) on Dec 07, 2007 at 13:15 UTC | |
Re: Returning two records with SELECT statement and then printing to file
by izut (Chaplain) on Dec 07, 2007 at 13:27 UTC | |
Re: Returning two records with SELECT statement and then printing to file
by graff (Chancellor) on Dec 08, 2007 at 01:39 UTC |
Back to
Seekers of Perl Wisdom