pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Returning just one resultset from function call with refcursor return
3+ messages / 2 participants
[nested] [flat]

* Returning just one resultset from function call with refcursor return
@ 2004-09-20 22:59 Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>
  2004-09-20 23:11 ` Re: Returning just one resultset from function call with refcursor Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Francisco Figueiredo Jr. @ 2004-09-20 22:59 UTC (permalink / raw)
  To: pgsql-jdbc



Hi guys,

I'd like to know how you are doing to return a cursor resultset from 
function call.

I know, from documentation, that I can do the following:

CREATE TABLE test (col text);
INSERT INTO test VALUES ('123');

CREATE FUNCTION reffunc(refcursor) RETURNS refcursor AS '
BEGIN
      OPEN $1 FOR SELECT col FROM test;
      RETURN $1;
END;
' LANGUAGE plpgsql;

BEGIN;
SELECT reffunc('funccursor');
FETCH ALL IN funccursor;
COMMIT;




The problem is that when I execute the lines above I get:


    reffunc
------------
   funccursor
(1 row)
   col
-----
   123
(1 row)




I'd like to omit the reffunc resultset return and get directly the col 
resultset. Is this possible?

Thanks in advance.

Please, let me know if this is not the appropriated place to do such 
questions.

Regards,

Francisco Figueiredo Jr.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Returning just one resultset from function call with refcursor
  2004-09-20 22:59 Returning just one resultset from function call with refcursor return Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>
@ 2004-09-20 23:11 ` Oliver Jowett <oliver@opencloud.com>
  2004-09-21 00:19   ` Re: Returning just one resultset from function call with refcursor Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>
  0 siblings, 1 reply; 3+ messages in thread

From: Oliver Jowett @ 2004-09-20 23:11 UTC (permalink / raw)
  To: Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>; +Cc: pgsql-jdbc

Francisco Figueiredo Jr. wrote:

> I'd like to omit the reffunc resultset return and get directly the col 
> resultset. Is this possible?

See http://www.postgresql.org/docs/7.4/static/jdbc-callproc.html.

-O



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Returning just one resultset from function call with refcursor
  2004-09-20 22:59 Returning just one resultset from function call with refcursor return Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>
  2004-09-20 23:11 ` Re: Returning just one resultset from function call with refcursor Oliver Jowett <oliver@opencloud.com>
@ 2004-09-21 00:19   ` Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>
  0 siblings, 0 replies; 3+ messages in thread

From: Francisco Figueiredo Jr. @ 2004-09-21 00:19 UTC (permalink / raw)
  To: pgsql-jdbc

Oliver Jowett wrote:
> Francisco Figueiredo Jr. wrote:
> 
>> I'd like to omit the reffunc resultset return and get directly the col 
>> resultset. Is this possible?
> 
> 
> See http://www.postgresql.org/docs/7.4/static/jdbc-callproc.html.
> 
> -O
> 



Hi Oliver, thanks for the tip.

But I'd like to know how internally you handle the two resultsets return 
and returns only one to user. Do you make special handling of the return 
type of the function? I mean, if you check that the function returns a 
refcursor, you eat the first resultset and shows to user just the second?

If so, could you point me where I could find the metadata about the 
function return type?

Thanks in advance.

Regards,

Francisco Figueiredo Jr.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-09-21 00:19 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-09-20 22:59 Returning just one resultset from function call with refcursor return Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>
2004-09-20 23:11 ` Re: Returning just one resultset from function call with refcursor Oliver Jowett <oliver@opencloud.com>
2004-09-21 00:19   ` Re: Returning just one resultset from function call with refcursor Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox