Re: [GENERAL] How to create a function with multiple RefCursor OUT parameters

2008-05-17 Thread Francisco Figueiredo Jr.
On Fri, May 16, 2008 at 10:06 AM, Merlin Moncure [EMAIL PROTECTED] wrote: On Fri, May 16, 2008 at 2:17 AM, Albe Laurenz [EMAIL PROTECTED] wrote: Chuck Bai wrote: Hi, Chuck! What's the Npgsql code you are using to call this function? Thanks in advance. -- Regards, Francisco Figueiredo Jr.

Re: [GENERAL] How to create a function with multiple RefCursor OUT parameters

2008-05-16 Thread Albe Laurenz
Please don't top post! Chuck Bai wrote: CREATE OR REPLACE FUNCTION test_refcursor(INOUT tcount integer, OUT o_user refcursor, OUT o_name refcursor) RETURNS record AS $BODY$ BEGIN tcount := tcount + 1; OPEN o_user FOR SELECT * FROM user_table; OPEN o_name FOR SELECT * FROM

Re: [GENERAL] How to create a function with multiple RefCursor OUT parameters

2008-05-16 Thread Merlin Moncure
On Fri, May 16, 2008 at 2:17 AM, Albe Laurenz [EMAIL PROTECTED] wrote: Chuck Bai wrote: CREATE OR REPLACE FUNCTION test_refcursor(INOUT tcount integer, OUT o_user refcursor, OUT o_name refcursor) RETURNS record AS $BODY$ BEGIN o_user := 'o_user'; o_name := 'o_name'; tcount :=

Re: [GENERAL] How to create a function with multiple RefCursor OUT parameters

2008-05-15 Thread Chuck Bai
Thank you Albe. I test your script using psql and it works as you found out. If the function is correct. Now the problem is how to use the function from client side. It could not use unnamed portal # kind of thing from client. I tested the function using Npgsql connector and it did not work. I

Re: [GENERAL] How to create a function with multiple RefCursor OUT parameters

2008-05-13 Thread Albe Laurenz *EXTERN*
Chuck Bai wrote: I have the following function: CREATE OR REPLACE FUNCTION test_refcursor(INOUT tcount integer, OUT o_user refcursor, OUT o_name refcursor) RETURNS record AS $BODY$ BEGIN tcount := tcount + 1; OPEN o_user FOR SELECT * FROM user_table; OPEN o_name FOR

Re: [GENERAL] How to create a function with multiple RefCursor OUT parameters

2008-05-12 Thread Merlin Moncure
On Sun, May 11, 2008 at 2:43 PM, Chuck Bai [EMAIL PROTECTED] wrote: CREATE OR REPLACE FUNCTION test_refcursor(INOUT tcount integer, OUT o_user refcursor, OUT o_name refcursor) RETURNS record AS $BODY$ BEGIN tcount := tcount + 1; OPEN o_user FOR SELECT * FROM user_table; OPEN

Re: [GENERAL] How to create a function with multiple RefCursor OUT parameters

2008-05-12 Thread Chuck Bai
The following is a function from PosgreSQL documentation to return multiple cursors from a single function: CREATE FUNCTION myfunc(refcursor, refcursor) RETURNS SETOF refcursor AS $$ BEGIN OPEN $1 FOR SELECT * FROM table_1; RETURN NEXT $1; OPEN $2 FOR SELECT * FROM table_2; RETURN

[GENERAL] How to create a function with multiple RefCursor OUT parameters

2008-05-11 Thread Chuck Bai
I have the following function: CREATE OR REPLACE FUNCTION test_refcursor(INOUT tcount integer, OUT o_user refcursor, OUT o_name refcursor) RETURNS record AS $BODY$ BEGIN tcount := tcount + 1; OPEN o_user FOR SELECT * FROM user_table; OPEN o_name FOR SELECT * FROM name_table; END;