Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The variables I am using ($Pu_strID, $Pu_PuStOp_strID, etc..) are taken from the column names themselves (Pu_strID, Pu_PuStOp_strID, etc..). This has been working well until recently. A coworker added a new feild betwen the 0 and 1st columns and now $publication_record[2] and $publication_record[3] are not what I was expecting. I would like to avoid this in the future. How can I say to sql/dbi/whatever to grab the data from the column named "Pu_strName" and assign it to the $Pu_strName variable, regardless of where the Pu_strName column is? (hope at least some of this makes any sense at all)$dbi = DBI->connect('Blah', 'Blah', 'Blah', 'ODBC'); $dbistmt = $dbi->prepare(" SELECT * FROM MyTable" ); $dbistmt->execute; while(@publication_record = $dbistmt->fetchrow()){ last if $publication_record[0]=~/^$PublicationId$/ } $dbistmt->finish; $dbi->disconnect; $Pu_strID = $publication_record[0]; $Pu_PuStOp_strID = $publication_record[1]; $Pu_PuTy_strID = $publication_record[2]; $Pu_strName = $publication_record[3]; etc..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jefffa) Re: Database Problems
by jeffa (Bishop) on Apr 16, 2003 at 15:00 UTC | |
by Coplan (Pilgrim) on Apr 16, 2003 at 16:02 UTC | |
by mpeppler (Vicar) on Apr 17, 2003 at 00:32 UTC | |
by dws (Chancellor) on Apr 17, 2003 at 00:35 UTC | |
|
Re: Database Problems
by jasonk (Parson) on Apr 16, 2003 at 14:58 UTC | |
|
Re: Database Problems
by physi (Friar) on Apr 16, 2003 at 15:03 UTC |