rajsai28 has asked for the wisdom of the Perl Monks concerning the following question:
I want to fecth list of values from the database as shown below in perl script
ABC JKL HGJ KJI GHJ LKJ
sub Emp_Name { my $sth = $dbh->prepare(<<"SQL") or die "Prepare failed: " . $dbh->err +str(); SELECT DISTINCT EMP_NAME FROM EMPLOYEE WHERE EMP_ID = ? SQL $sth->execute () or die "Cannot execute: " . $sth->errstr(); while ( %Result = $sth->fetchrow() ) { print Dumper(%Result); } $sth->finish; }# end
I want to store the list in hash or array and use the same in perl to check if an element exist in hash/array
I am reading field from the input record and checking whether that field exist in hash/array
Can i store the list in Hash, please let me know
thanks & regards,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to store the data fetched from the database in perl
by frozenwithjoy (Priest) on Jun 11, 2013 at 06:18 UTC | |
by rajsai28 (Novice) on Jun 11, 2013 at 06:38 UTC | |
by choroba (Cardinal) on Jun 11, 2013 at 06:51 UTC | |
by Neighbour (Friar) on Jun 11, 2013 at 06:53 UTC | |
by frozenwithjoy (Priest) on Jun 11, 2013 at 06:51 UTC | |
|
Re: How to store the data fetched from the database in perl
by rpnoble419 (Pilgrim) on Jun 12, 2013 at 01:05 UTC |