Scott Yohonn wrote:
> Jean-Paul,
>
> Thanks! This did work. The output put the name of the function
> (get_table_count) as the header. How would I display the name of the table
> that I am requesting the row count of?
The only way I know is to alias the output in the query calling the
function, s
On 5/14/06, Scott Yohonn <[EMAIL PROTECTED]> wrote:
Using PL/PGSQL, I am trying to create a procedure to display the
count of rows in any single table of a database. The End-user would
pass in a table name and the prodecure would display the table name
with the row count.
I am able to hardcode t
Hi Scott,
You'll have to execute dynamic SQL (see doc chapter "36.6.5. Executing
Dynamic Commands") for your function to work:
CREATE FUNCTION get_table_count(tablename text) RETURNS integer AS
$$
DECLARE
--tablename ALIAS FOR $1;
rowcount INTEGER;
BEGIN
execute 'SELECT count(*) F
Using PL/PGSQL, I am trying to create a procedure to display the count of rows in any single table of a database. The End-user would pass in a table name and the prodecure would display the table name with the row count.
I am able to hardcode the variable for table and get the appropriate results