![]() |
|
Perl Monk, Perl Meditation | |
PerlMonks |
Re: Going to first record on a record set in DBIby gmax (Abbot) |
on Jul 21, 2003 at 12:14 UTC ( #276232=note: print w/replies, xml ) | Need Help?? |
Using DBI, you access the recordset in two ways:
A word of caution, though. If you are referring to the first physical record in a table, then be aware that there is no such a thing in a relational database. You can have a record where a specific column (e.g. the primary key) is "1", but it does not mean that this is the "first" record, whatever you mean by that. The data set that you are "navigating" with the DBI is the result of a query, which can be influenced by WHERE and ORDER BY clauses. This data set is not guaranteed to have any relation whatsoever with the physical order of the records in your tables. There are some DBMS that implement a "record number" or similar attribute, but it is not standard, not portable, not relational. See also the discussion following this node for some practical examples. And, I almost forgot. You are using a "fetchrow" record. Update
See Reading from a database in our Tutorials for more information.
In Section
Seekers of Perl Wisdom
|
|