"SunMie Won" <sunmiewon(at)yahoo(dot)com> writes:
> Any tips on how to use a cursor within a function?
You don't, at least not before 7.2. The 7.2 support for cursors
in plpgsql is documented in the development docs:
http://candle.pha.pa.us/main/writings/pgsql/sgml/plpgsql-cursors.html
I don't really know why the syntax is what it is; it's a tad odd and
not anything like the normal SQL DECLARE x CURSOR. Possibly Jan
borrowed it from Oracle.
regards, tom lane