When I execute the SELECT statement directly I get:

psql:table.sql:28: out of memory for query result

I've read the way around this is to use cursors.  So I read and I see that I 
can use a FOR statement but I need that inside a function.

So far, I've come up with this:

> CREATE OR REPLACE FUNCTION blah() RETURNS integer AS $$
> 
> DECLARE
>   xyz CURSOR FOR SELECT * FROM shipped_files WHERE aix_file = 
> '/usr/lib/drivers/vioentdd' AND service_pack = '7100-01-06';
> 
> BEGIN
>   FOR my_rec IN xyz LOOP
>     -- xyxyxy what to do where? xyxyxy  These things don't work:
>     COPY ( my_rec ) TO stdout;
>     SELECT * FROM my_rec;
>     etc.
>   END LOOP;
> 
>   RETURN 5;
> END
> $$ LANGUAGE plpgsql;
> 
> SELECT * FROM blah();

I just want to output the rows being selected as text.  Basically I want the 
same output that the SELECT statement would produce if it didn't fail.

Also, what should I do with the SELECT * FROM blah() statement?  I'm doing that 
just to get blah() to execute.  I have a feeling I'm way far off base.

Thank you,
Perry

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to