Skip site navigation (1) Skip section navigation (2)

plpgsql help

From: "toto" <yanto(at)jetcoms(dot)net>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: plpgsql help
Date: 2001-05-18 11:40:56
Message-ID: NEBBJICJDKGCAAHENJJGMEMBCJAA.yanto@jetcoms.net (view raw or flat)
Thread:
Lists: pgsql-novice
i create a little stored procedure using plpgsql from pgaccess. function
input is table name where the function will simply iterate along each record
in the table and raise notice for each of them.

when i run this function from shell command using : select
browse_table('sex'), the function error with error message 'ERROR:  parser:
parse error at or near "$1"'. As i concern, this error came from the line i
mark because the function can't receive variable 'table_name' to generate
query.

i'm new here, so can some body help me, please....

the source code is below.
===========================================================
DECLARE
	table_name ALIAS for $1;
	each_row RECORD;
BEGIN
	FOR each_row IN select * from table_name LOOP     ==> i believe this's an
error source
		raise notice 'row';
	END LOOP;
END;
===========================================================
function description :
function name : browse_table
returns	  : bpchar
parameters	  : bpchar
language	  : plpgsql


-toto-



pgsql-novice by date

Next:From: Oliver BeddowsDate: 2001-05-18 12:20:25
Subject: SQL query help - online music shop - labels & styles
Previous:From: totoDate: 2001-05-18 11:15:28
Subject: testing...just skip

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group