Search Postgresql Archives

Re: http://www.postgresql.org/docs/8.0/static/xfunc-sql.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> I can't work out from that how to return more than one value.

Hi Nigel,

Add SETOF to your function like so:

CREATE TABLE test (id int);
INSERT INTO test VALUES(1);
INSERT INTO test VALUES(2);

CREATE FUNCTION test_func() RETURNS SETOF integer AS '
    SELECT id FROM test;
' LANGUAGE SQL;

SELECT test_func();

Cheers

Adam


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux