pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how can i return multiple values from a function
2+ messages / 2 participants
[nested] [flat]

* how can i return multiple values from a function
@ 2001-09-25 11:35  srinivas <srinivaschowdary@essemm.co.in>
  0 siblings, 1 reply; 2+ messages in thread

From: srinivas @ 2001-09-25 11:35 UTC (permalink / raw)
  To: pgsql-sql

i have tried retrieving multiple values using setof function but i
couldnt solve it.when i am trying using setof iam getting this as
output.
 

      1 CREATE FUNCTION hobbies (varchar) RETURNS SETOF bank
      2     AS 'SELECT * FROM bank
      3          '
      4     LANGUAGE 'sql';


~
output:  
select hobbies('srinivas') as col;
    col    
-----------
 137462096
 137462096
(2 rows)

please let me know what is the alternative and if possible with a sample
piece of code.

cheers
chowdary.




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

* Re: how can i return multiple values from a function
@ 2001-10-04 20:30  Allan Engelhardt <allane@cybaea.com>
  parent: srinivas <srinivaschowdary@essemm.co.in>
  0 siblings, 0 replies; 2+ messages in thread

From: Allan Engelhardt @ 2001-10-04 20:30 UTC (permalink / raw)
  To: pgsql-sql

Try using temporary tables.  Functions can't return tables and, it would seem, SETOFs.

srinivas wrote:

> i have tried retrieving multiple values using setof function but i
> couldnt solve it.when i am trying using setof iam getting this as
> output.
>
>
>       1 CREATE FUNCTION hobbies (varchar) RETURNS SETOF bank
>       2     AS 'SELECT * FROM bank
>       3          '
>       4     LANGUAGE 'sql';
>
> ~
> output:
> select hobbies('srinivas') as col;
>     col
> -----------
>  137462096
>  137462096
> (2 rows)
>
> please let me know what is the alternative and if possible with a sample
> piece of code.
>
> cheers
> chowdary.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly



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


end of thread, other threads:[~2001-10-04 20:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-09-25 11:35 how can i return multiple values from a function srinivas <srinivaschowdary@essemm.co.in>
2001-10-04 20:30 ` Allan Engelhardt <allane@cybaea.com>

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