Thread: plpgsql/cursor

plpgsql/cursor

From
"augie"
Date:
can i declare and fetch from a cursor inside a plpgsql function?  (pg
version 7.0.3)

if so, what would the syntax look like?  i continue to get parse errors on
'cursor' in a very, very simple test.

thanks

greg





Re: plpgsql/cursor

From
Date:
> can i declare and fetch from a cursor inside a
plpgsql function?  (pg version 7.0.3)

In 7.1, the pl/pgsql document says you can code like
this:

DECLARE
 rec record;
BEGIN
 for rec in SELECT * from MyTable LOOP
    update tableX set tableX=rec.fieldA;
 END LOOP;
END;

CN

--------------------------------------------------------
You too can have your own email address from Eurosport.
http://www.eurosport.com






Re: plpgsql/cursor

From
Jan Wieck
Date:
augie wrote:
> can i declare and fetch from a cursor inside a plpgsql function?  (pg
> version 7.0.3)
>
> if so, what would the syntax look like?  i continue to get parse errors on
> 'cursor' in a very, very simple test.

    Refernce cursors will occur in PostgreSQL v7.2. Not sure when
    it'll be finally released yet.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com