Re: [GENERAL] table name in pl/pgsql

2004-11-25 Thread CoL
hi, ON.KG wrote: New question: i have tables like table_20041124, table_20041125, etc... i'm trying to make function (for example): = CREATE FUNCTION get_count(text, text) RETURNS int2 AS ' DECLARE cnt int4; BEGIN SELECT INTO cnt COUNT(*) FROM tab

Re: [GENERAL] table name in pl/pgsql

2004-11-25 Thread Tino Wildenhain
Hi, Am Donnerstag, den 25.11.2004, 19:42 +0300 schrieb ON.KG: > New question: > > i have tables like > table_20041124, > table_20041125, > etc... > > i'm trying to make function (for example): > = > CREATE FUNCTION get_count(text, text) > RETURNS int2 AS ' >

Re: [GENERAL] table name in pl/pgsql

2004-11-25 Thread Richard Huxton
Adam Witney wrote: I think you would have to do it something like this, although whether the SELECT INTO works in an EXECUTE context I am not sure (note, completely untested code!) CREATE FUNCTION get_count(text, text) RETURNS int2 AS ' DECLARE cnt int4; BEGIN EXECUTE ''SELECT INTO cnt COUNT

Re: [GENERAL] table name in pl/pgsql

2004-11-25 Thread Adam Witney
I think you would have to do it something like this, although whether the SELECT INTO works in an EXECUTE context I am not sure (note, completely untested code!) CREATE FUNCTION get_count(text, text) RETURNS int2 AS ' DECLARE cnt int4; BEGIN EXECUTE ''SELECT INTO cnt COUNT(*) FROM table_''

[GENERAL] table name in pl/pgsql

2004-11-25 Thread ON.KG
New question: i have tables like table_20041124, table_20041125, etc... i'm trying to make function (for example): = CREATE FUNCTION get_count(text, text) RETURNS int2 AS ' DECLARE cnt int4; BEGIN SELECT INTO cnt COUNT(*) FROM table_$1