Re: Affected Rows

From: Amonotod (amonotod_at_charter.net)
Date: 01/24/05


To: <dbi-users@perl.org>
Date: Mon, 24 Jan 2005 15:47:50 -0600


> From: amonotod <amonotod@charter.net>
> Date: 2005/01/24 Mon PM 02:03:18 CST

> > From: Hernan Arredondo <hernan.arredondo@gmail.com>
> > Date: 2005/01/24 Mon PM 12:41:56 CST
 
> > anyone knows other easy method ?

> FROM THE DOCS!
> <snip>
> One alternative method to get a row count for a SELECT is to
> execute a ``SELECT COUNT(*) FROM ...'' SQL statement with the same
> ``...'' as your query and then fetch the row count from that.
> </snip>

  I guess I should have pointed out that the part you really need to take notice of was the last paragraph, in which it is suggested that you run a "select count()" before you run your real query.

 One extra piece of advice, it says "select count(*)", but I suggest you use just "select count(<first_column>)" instead.

  Also, keep in mind that you're not guaranteed that the return from the "select count()" is the actual number of rows you'll get back from your "select ..." statement. The accuracy obviously depends on level of activity in your database...

HTH,
amonotod

--
    `\|||/         amonotod@    | sun|perl|windows
      (@@)         charter.net  | sysadmin|dba
  ooO_(_)_Ooo____________________________________
  _____|_____|_____|_____|_____|_____|_____|_____|


Relevant Pages

  • Re: Limiting Large Result Sets
    ... Oracle 9i - Database ... Using query based approach, i was able to retreive all the million rows ... Fetch Size ... rows at a time from the database cursor. ...
    (comp.lang.java.programmer)
  • Re: previous value in a table
    ... (e.g., max id for prev, and min id for next). ... See if the following query works for you: ... > way to fetch fetch event IDs instead of dates: ... Each calendar has a set ...
    (microsoft.public.sqlserver.programming)
  • Re: RealThinClient SDK 1.8q > GPL Open Source with Demos
    ... When you fetch the top level rows from a query, all other rows are stored on ... the database engine waiting to be fetch. ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: -1555-ORA-01555: snapshot too old: rollback segment number 7 with name "_SYSSMU7$" t
    ... it happen to fetch something from a big result set in a loop and commit ... Or does it happen that the query runs longer than ... Well, if this script receives ORA-1555 on regular basis, then you ...
    (comp.databases.oracle.server)
  • Re: Query load every row
    ... >>That was not the case with query using BDE. ... If you user a clientside cursor ADO will fetch ... > records unless you specify a MaxRecords property. ...
    (borland.public.delphi.database.ado)