Returning Cursor

Started by ravi kiranover 17 years ago4 messagesgeneral
Jump to latest
#1ravi kiran
ravysters@gmail.com

Hello,

I am a developer working on postgres. I just wrote a function which ll
return a refcurosor as shown below.

CREATE OR REPLACE FUNCTION reffunc(refcursor)
RETURNS refcursor AS
$BODY$
BEGIN
OPEN $1 FOR SELECT * FROM SAM1;
RETURN $1;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;

i have problems accessing this function from my middle tier i.e VC++.

I wrote a VC statement to retrieve values from this refcursor using a record
set. I cant access any of the values that the select statement in the
function should retrieve.When we executed the above function from VC we only
got the cursor name. We've been trying to access the values for the past one
week. Can you please help me by sending me a sample code as to how to get
the values in a recordset using this refcursor. Please do reply. This is
very urgent.

Thanks and regards
Ravi Kiran L

#2ravi kiran
ravysters@gmail.com
In reply to: ravi kiran (#1)
Fwd: Returning Cursor

Hello,

I am a developer working on postgres. I just wrote a function which ll
return a refcurosor as shown below.

CREATE OR REPLACE FUNCTION reffunc(refcursor)
RETURNS refcursor AS
$BODY$
BEGIN
OPEN $1 FOR SELECT * FROM SAM1;
RETURN $1;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;

i have problems accessing this function from my middle tier i.e VC++.

I wrote a VC statement to retrieve values from this refcursor using a record
set. I cant access any of the values that the select statement in the
function should retrieve.When we executed the above function from VC we only
got the cursor name. We've been trying to access the values for the past one
week. Can you please help me by sending me a sample code as to how to get
the values in a recordset using this refcursor. Please do reply. This is
very urgent.

Thanks and regards
Ravi Kiran L

#3ravi kiran
ravysters@gmail.com
In reply to: ravi kiran (#2)
Fwd: Returning Cursor

Hello,

I am a developer working on postgres. I just wrote a function which ll
return a refcurosor as shown below.

CREATE OR REPLACE FUNCTION reffunc(refcursor)
RETURNS refcursor AS
$BODY$
BEGIN
OPEN $1 FOR SELECT * FROM SAM1;
RETURN $1;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;

i have problems accessing this function from my middle tier i.e VC++.

I wrote a VC statement to retrieve values from this refcursor using a record
set. I cant access any of the values that the select statement in the
function should retrieve.When we executed the above function from VC we only
got the cursor name. We've been trying to access the values for the past one
week. Can you please help me by sending me a sample code as to how to get
the values in a recordset using this refcursor. Please do reply. This is
very urgent.

Thanks and regards
Ravi Kiran L

#4Craig Ringer
craig@2ndquadrant.com
In reply to: ravi kiran (#2)
Re: Fwd: Returning Cursor

ravi kiran wrote:

Hello,

I am a developer working on postgres. I just wrote a function which ll
return a refcurosor as shown below.

[snip]

i have problems accessing this function from my middle tier i.e VC++.

I wrote a VC statement to retrieve values from this refcursor using a record
set.

Please show us your code. Also, what access method are you using? "VC"
isn't a database access method. Are you using libpq? ODBC? LINQ?

--
Craig Ringer