If you are using oracle count(*) is best.  According to oracle anyways.
-----Original Message-----
From: "amonotod"<[EMAIL PROTECTED]>
Date: Mon, 24 Jan 2005 21:47:00 
To:"dbi-users@perl.org"<dbi-users@perl.org>
Cc:"Hernan Arredondo"<[EMAIL PROTECTED]>
Subject: Re: Affected Rows




> From: amonotod <[EMAIL PROTECTED]>
> Date: 2005/01/24 Mon PM 02:03:18 CST

> > From: Hernan Arredondo <[EMAIL PROTECTED]>
> > 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____________________________________
_____|_____|_____|_____|_____|_____|_____|_____|

Sent wirelessly via BlackBerry from T-Mobile.

Reply via email to