Search Postgresql Archives

Re: Count(*) throws error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 -------------- Original message ----------------------
From: "Jasbinder Singh Bali" <jsbali@xxxxxxxxx>
> 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
> 

Try SELECT COUNT(*) INTO no _rows FROM tbl_concurrent;
See
http://www.postgresql.org/docs/8.2/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-ASSIGNMENT
for complete syntax.
> If i comment this count(*) line, the error goes.
> 
> I don't know why isn't count(*) working
> 
> Thanks
> Jas


--- Begin Message --- 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

Thanks
Jas

--- End Message ---

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux