Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f5KGhIa92607 for ; Wed, 20 Jun 2001 12:43:18 -0400 (EDT) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5IJ1Ra35345; Mon, 18 Jun 2001 15:01:27 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id f5IIY3Q69084; Mon, 18 Jun 2001 14:34:03 -0400 (EDT) (envelope-from news) From: alla@sergey.com (Alla) X-Newsgroups: comp.databases.postgresql.general,comp.databases.postgresql.sql Subject: Passing cursor between functions in embedded SQL Date: 18 Jun 2001 11:34:00 -0700 Organization: http://groups.google.com/ Lines: 40 Message-ID: <9275d56e.0106181034.51a22104@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-support@google.com To: pgsql-general@postgresql.org.pgsql-sql@postgresql.org X-Archive-Number: 200106/311 X-Sequence-Number: 3579 Did anybody try to do something like this? int open_cursor(...) { EXEC SQL DECLARE cur CURSOR FOR ... EXEC SQL OPEN cur; return cur1; /* how can I do that???? */ } int fetch_cursor(... cur) { EXEC SQL FETCH cur; return some data; } That's how it's going to look in the calling program: cur := open_cursor; while (not found) { fetch_cursor(cur); do some processing with the data } My point is I don't want to declare huge arrays or linked lists and keep all the fetched data in the memory. I want to fetch a row, process it and move on to the next one. May be there is another approach to do this? Please help Thanks Alla Gribov