Leo,
You're gonna feel like a dork when I point it out ...
> -- if the emailaddr was found, then update the record.
> -- if it wasn't, then insert the new record.
^^^ SINGLE QUOTE HERE!! BAD!
You can't have single quotes inside a function, especially in comments.
They will be treated as the end of the function definition string.
If you write the T-SQL Procedure ---> PostgreSQL function porting guide,
I volunteer to edit (certifiable MS SQL DBA). You might wanna wait for
7.2, where Jan says that cursor support in PL/pgSQL functions will be
added.
-Josh
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco