Re: Do Stored Procedures exist (Besides FUNCTIONs)
От | Joshua b. Jore |
---|---|
Тема | Re: Do Stored Procedures exist (Besides FUNCTIONs) |
Дата | |
Msg-id | Pine.BSO.4.40.0203041635500.25700-100000@kitten.greentechnologist.org обсуждение исходный текст |
Ответ на | Re: Do Stored Procedures exist (Besides FUNCTIONs) ("Josh Berkus" <josh@agliodbs.com>) |
Список | pgsql-novice |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Mon, 4 Mar 2002, Josh Berkus wrote: > > 2. Ability to return multiple values ? > > > > Are both of these on the TODO list ?. > > Just #2. And, as I said, there is some limited ability to return > mutliple values now. I just don't know how to use it. Hopefully > another developer will speak up. I've used the 'SETOF' token to get my functions to return multiple single attribute tuples. There is some support for returning multiple attributes but it didn't work well for me so I don't use it. For the record: CREATE TABLE bran( flake integer, fiber integer ); INSERT INTO bran (1,2); INSERT INTO bran (2,3); INSERT INTO bran (3,4); 1 x 1 CREATE FUNCTION blah() RETURNS integer AS ' SELECT flake FROM bran; ' LANGUAGE 'sql'; returns a single row 1 x n CREATE FUNCTION blan() RETURNS SETOF integer AS ' SELECT flake FROM bran; ' LANGUAGE 'sql'; returns all the n x 1 CREATE FUNCTION blah() RETURNS bran AS ' SELECT * FROM bran; ' LANGUAGE 'sql'; Returns an oid, use the projection syntax to get the individual attributes: SELECT flake(blah()), fiber(blah()); n x n CREATE FRUNCTION blah() RETURNS SETOF bran AS ' SELECT * FROM bran; ' LANGUAGE 'sql'; SELECT flake(blah()), fiber(blah()); Joshua b. Jore http://www.greentechnologist.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (OpenBSD) Comment: For info see http://www.gnupg.org iD8DBQE8g/jtfexLsowstzcRAmHTAKCaZjZ3OOMVxUo0yiHU0cd9on7PFgCg7VL4 P5l42NyWNSlpOPI+a2a4GBA= =ed42 -----END PGP SIGNATURE-----
В списке pgsql-novice по дате отправления: