Re: Count(*) throws error

From: Erik Jones <erik(at)myemma(dot)com>
To: Jasbinder Singh Bali <jsbali(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Count(*) throws error
Date: 2007-07-11 21:14:02
Message-ID: 63E40961-FFAD-464C-A96F-D1D20053BCE0@myemma.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


On Jul 11, 2007, at 4:00 PM, Jasbinder Singh Bali wrote:

> Hi,
>
> I'm using the following statement in my plpgsql function
>
> SELECT INTO no_rows COUNT(*) FROM tbl_concurrent;
>
> I have decalred no_rows int4 and initialized it to zero
>
> Running the function throws the following error:
>
> ERROR: syntax error at or near "(" at character 13
> QUERY: SELECT $1 (*) FROM tbl_concurrent
> CONTEXT: SQL statement in PL/PgSQL function
> "sp_insert_tbl_concurrent" near line 8
>
>
> If i comment this count(*) line, the error goes.
>
> I don't know why isn't count(*) working

SELECT COUNT(*) INTO no_rows FROM tbl_concurrent;

Erik Jones

Software Developer | Emma®
erik(at)myemma(dot)com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2007-07-11 21:14:46 Re: Count(*) throws error
Previous Message Anton Melser 2007-07-11 21:07:35 Re: Postgres 8.2 binary for ubuntu 6.10?

Browse pgsql-hackers by date

  From Date Subject
Next Message Rodrigo De León 2007-07-11 21:21:31 Re: Count(*) throws error
Previous Message Stefan Kaltenbrunner 2007-07-11 21:03:19 Re: minor compiler warning on OpenBSD